Has anyone got TSLint rules to work in the linting process?


I am trying to increase the strictness of my TSLint rules. For example, I added a couple of obvious rules like:

"no-var-keyword": true,
"no-duplicate-variable": true,
"no-unused-variable": [

and then add some deliberate violations in my app.component code:

var x = 1;
var y;
var y;

I then added this to my package.json

"lint": "ionic-app-scripts lint",

and run

npm run lint

It says lint started… and then it finishes with NO errors or warnings. I can’t believe my code is that clean - so how can I get TSLint to run on my code source? (Note: When I use my BitBucket Build Pipeline or ionic serve it also founds 0 errors.

1 Like

Hmm - is no one using the linting process to do automatic code reviews?

Yeah this command ^ (ionic-app-scripts lint) didn’t work for me. I get no errors and I defintely have errors present that are defined as rules in my tslint.json. I’ve seen some posts about installing ionic-gulp-tslint. Do we need to do that?

So weird, while I cannot call ionic-app-scripts lint from the command lint (it fails w/ command not found) I can however, setup a npm script and use: `npm run lint’ as follows:

"scripts": {
  "lint": "ionic-app-scripts lint"

I should mention that while this runs, it fails to pickup any of my offending TSLint errors defined in tslint.json

It looks like linting is working in the latest Ionic version 3.5.3 (it now does linting with ionic serve)


If you look at node_modules/tslint-eslint-rules/dist/rules folder you will see about 15 rules which you can apply in tslint. node_modules/tslint-eslint-rules/README.md file has much more rules described in it. If you use rules that are not in the dist folder but described in the readme file tslint tends to fail. thats probably why you dont see any errors.