-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 607a932
Showing
11 changed files
with
1,513 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 2020, | ||
"sourceType": "module", | ||
"project": "./tsconfig.json" | ||
}, | ||
"settings": { | ||
"import/parsers": { | ||
"@typescript-eslint/parser": [".ts", ".tsx"] | ||
}, | ||
"import/resolver": { | ||
"typescript": { | ||
"alwaysTryTypes": true, | ||
"directory": "./tsconfig.json" | ||
} | ||
} | ||
}, | ||
// "plugins": ["@typescript-eslint", "deprecation"], | ||
"rules": { | ||
// "deprecation/deprecation": "warn" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"singleQuote": true, | ||
"endOfLine": "lf", | ||
"trailingComma": "all" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# eslint-plugin-deprecation | ||
|
||
> Rule that reports usage of deprecated code | ||
## Prerequisites | ||
|
||
This plugin only works with `@typescript-eslint/parser`. | ||
|
||
Which means that you should install dev deps: | ||
|
||
- `@typescript-eslint/parser` | ||
- `typescript` | ||
|
||
Then configure your `.eslintrc` like this: | ||
|
||
```jsonc | ||
{ | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 2020, | ||
"sourceType": "module", | ||
"project": "./tsconfig.json" // <-- Point to your project's tsconfig.json or create new one | ||
}, | ||
"settings": { | ||
"import/parsers": { | ||
"@typescript-eslint/parser": [".ts", ".tsx"] | ||
}, | ||
"import/resolver": { | ||
"typescript": { | ||
"alwaysTryTypes": true, | ||
"directory": "./tsconfig.json" // <-- Same tsconfig.json must be referenced | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Install | ||
|
||
Install the plugin | ||
|
||
``` | ||
npm i -D eslint-plugin-deprecation | ||
``` | ||
|
||
## Setup | ||
|
||
Now add deprecation plugin and rule to your `.eslintrc`: | ||
|
||
```jsonc | ||
{ | ||
"plugins": ["deprecation", ...], | ||
"rules": { | ||
"deprecation/deprecation": "warn", // or "error" to have stricter rule | ||
... | ||
} | ||
} | ||
``` | ||
|
||
Now eslint will report all deprecated code that you use! | ||
|
||
--- | ||
|
||
_NOTE:_ This code was ported from https://github.com/SonarSource/SonarJS repository. |
Oops, something went wrong.