Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
Document source.fixAll.tslint
Browse files Browse the repository at this point in the history
Fixes #2
Fixes #6
  • Loading branch information
mjbvz committed Jan 23, 2019
1 parent 90f505a commit f233f43
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions README.md
Expand Up @@ -27,8 +27,31 @@ You can either configure the TSLint extension using a `tsconfig` or `jsconfig` a

* `tslint.suppressWhileTypeErrorsPresent` - Suppress tslint errors from being reported while other errors are present.

* `tslint.autoFixOnSave` - turns auto fix on save on or off. **Note:** Auto-fixing is only done when manually saving a file. It is not performed when the file is automatically saved based on the `files.autoSave` setting. Executing a manual save on an already-saved document will trigger auto-fixing.

### Auto fix and auto fix on save
Some simple errors can be automatically fixed by tslint using the `source.fixAll.tslint` source code action in VS Code. To run this, either run the `Source Action...` command in the command palette or right click in the TS file and select `Source Action...` from the context menu:

![Source Action context menu](docs/sourceAction.png)

To enable auto fixing tslint errors on save, In VS Code set:

```json
"editor.codeActionsOnSave": {
"source.fixAll.tslint": true
}
```

You can also setup a keybinding for tslint auto fix:

```json
{
"key": "cmd+k f",
"command": "editor.action.codeAction",
"args": {
"kind": "source.fixAll.tslint",
"apply": "first"
}
}
```

## Differences with the [vscode-TSLint][vscode-tslint] extension

Expand Down
Binary file added docs/sourceAction.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f233f43

Please sign in to comment.