Skip to content

Instantly share code, notes, and snippets.

@armanozak
Last active December 16, 2020 11:07
Show Gist options
  • Save armanozak/76fd0d39755ce5e321805e84fccb7c78 to your computer and use it in GitHub Desktop.
Save armanozak/76fd0d39755ce5e321805e84fccb7c78 to your computer and use it in GitHub Desktop.
[Disabling TS Lint, The Easy Way] VS Code Snippet + Key Binding for Adding TS Lint Rule Flags #typescript #vscode #tip
// /User/keybindings.json
[
{
"key": "shift+alt+t",
"command": "editor.action.insertSnippet",
"when": "resourceLangId == typescript && editorTextFocus && !editorReadonly",
"args": {
"langId": "typescript",
"name": "Disable TSLint"
}
},
{
"key": "ctrl+shift+alt+t",
"command": "editor.action.insertSnippet",
"when": "resourceLangId == typescript && editorTextFocus && !editorReadonly",
"args": {
"langId": "typescript",
"name": "Disable TSLint NextLine"
}
}
]
// /User/snippets/typescript.json
{
"Disable TSLint": {
"prefix": "tsl",
"body": [
"/* tslint:disable$1 */",
"$TM_SELECTED_TEXT",
"/* tslint:enable${2:$1}$0 */"
],
"description": "Disables TSLint on selected code block"
},
"Disable TSLint NextLine": {
"prefix": "tsl1",
"body": [
"/* tslint:disable-next-line$1 */",
"$TM_SELECTED_TEXT",
],
"description": "Disables TSLint on next line"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment