I'm using the Angular starter kit
and I'm trying to get tslint to autofix all my lint problems with the --fix flag.
I'm running the script:
npm run tslint --fix src/**/*.ts
It just generates the same error that I'm already being told about in tslint
and not autofixing it:
console output:
ERROR: src/app/app-routing.module.ts[10, 5]: comment must start with a space
ERROR: src/app/app-routing.module.ts[2, 20]: Too many spaces before 'from'
Am I missing something that allows it to implement the changes?
My versions are:
"tslint": "^5.6.0"
"codelyzer": "^3.1.2"
Question: How can I get tslint to implement autofix to my lint errors?
Update library
tslint
andcodelyzer
to latest.and then use this command:
tslint --fix src/**/*.ts -t verbose
without usingnpm run
after complete, it will show to you the unfixable problems so you have to fix it manually.
You can also add it to
scripts
inpackage.json
like this:"lint-fix": "tslint --fix src/**/*.ts -t verbose"