microsoft / vscode-typescript-tslint-plugin

VS Code extension that provides TSLint support using the typescript-tslint-plugin
https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-typescript-tslint-plugin
MIT License
188 stars 35 forks source link

Feature request: Separate config for linting and autofixing #101

Closed LendaVadym closed 5 years ago

LendaVadym commented 5 years ago

It's a feature request. I want to auto fix a specific number of rules (not all). It would be good if I can specify separate configuration files, e.g.: tslint.json tslint-autofix.json

first one would be used to lint files on the fly and hint the errors in IDE, the second one would be used for auto fixing errors on save...

mjbvz commented 5 years ago

Can you please share more information about how this would be helpful for your workflow?

LendaVadym commented 5 years ago

Can you please share more information about how this would be helpful for your workflow?

Hi, I've separated tslint rules into two categories:

I don't want to move this logic into npm scripts because it needs to involve additional actions from developer while vscode-typescript-tslint-plugin extension is seamlessly integrated into VSCode.

At the moment if I configure VSCode with this setting: "editor.codeActionsOnSave": { "source.fixAll.tslint": true },

it will apply all rules from tslint.json that have fixers ("Has fixer" label)... Therefore I wan't to separate first category into tslint-autofix.json and second category into tslint.json (will extend tslint-autofix.json) and provide both files to extension.

mjbvz commented 5 years ago

@LendaVadym Thanks. I think this workflow is out of scope of this extension.

You may want to investigate setting up a vs code task that runs tslint --fix with your tslint.autofix.json. Then disable "editor.codeActionsOnSave": { "source.fixAll" }. That should let you get pretty close to the workflow you describe