Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: consume new scope analysis package
- Loading branch information
1 parent
1b0d6d9
commit 517de6c
Showing
55 changed files
with
2,315 additions
and
165,740 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
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
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,50 @@ | ||
# Disallow variable declarations from shadowing variables declared in the outer scope (`no-shadow`) | ||
|
||
## Rule Details | ||
|
||
This rule extends the base [`eslint/no-shadow`](https://eslint.org/docs/rules/no-shadow) rule. | ||
It adds support for TypeScript's `this` parameters, and adds options for TypeScript features. | ||
|
||
## How to use | ||
|
||
```jsonc | ||
{ | ||
// note you must disable the base rule as it can report incorrect errors | ||
"no-shadow": "off", | ||
"@typescript-eslint/no-shadow": ["error"] | ||
} | ||
``` | ||
|
||
## Options | ||
|
||
See [`eslint/no-shadow` options](https://eslint.org/docs/rules/no-shadow#options). | ||
This rule adds the following options: | ||
|
||
```ts | ||
interface Options extends BaseNoShadowOptions { | ||
ignoreTypeValueShadow?: boolean; | ||
} | ||
|
||
const defaultOptions: Options = { | ||
...baseNoShadowDefaultOptions, | ||
ignoreTypeValueShadow: true, | ||
}; | ||
``` | ||
|
||
### `ignoreTypeValueShadow` | ||
|
||
When set to `true`, the rule will ignore when you name a type and a variable with the same name. | ||
|
||
Examples of **correct** code with `{ ignoreTypeValueShadow: true }`: | ||
|
||
```ts | ||
type Foo = number; | ||
const Foo = 1; | ||
|
||
interface Bar { | ||
prop: number; | ||
} | ||
const Bar = 'test'; | ||
``` | ||
|
||
<sup>Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/no-shadow.md)</sup> |
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
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
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
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
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
Oops, something went wrong.