Variables are incorrectly marked as shadowed
See original GitHub issueTell us about your environment
- ESLint Version: v7.8.1
What parser (default, @babel/eslint-parser
, @typescript-eslint/parser
, etc.) are you using?
@typescript-eslint/parser
Please show your full configuration:
Configuration
module.exports = {
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "prettier"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/@typescript-eslint",
"prettier/standard"
],
env: {
browser: true,
node: true
},
parserOptions: {
ecmaVersion: 2018,
sourceType: "module"
},
rules: {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/no-parameter-properties": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
vars: "all",
args: "none",
ignoreRestSiblings: true
}
],
"@typescript-eslint/no-object-literal-type-assertion": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"max-len": ["error", { code: 120, tabWidth: 4 }],
"linebreak-style": ["error", "unix"],
"no-alert": "error",
"prefer-const": "error",
"no-return-assign": "error",
"no-useless-call": "error",
"no-shadow": "error",
"no-useless-concat": "error",
"no-undef": "off",
"no-prototype-builtins": "off",
"prettier/prettier": "error"
}
};
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
export function foo(bar: number, baz: (bar: number) => void) {}
What did you expect to happen?
no error
What actually happened? Please include the actual, raw output from ESLint.
'bar' is already declared in the upper scope.eslintno-shadow
Are you willing to submit a pull request to fix this bug?
no
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
[@typescript-eslint/no-shadow] Variables are incorrectly ...
I have read the FAQ and my problem is not listed. ... [@typescript-eslint/no-shadow] Variables are incorrectly marked as shadowed #2469.
Read more >What is the problem with shadowing names defined in outer ...
This inspection detects shadowing names defined in outer scopes. I know it is bad practice to access variable from the outer scope, but...
Read more >C++ static code analysis: Variables should not be shadowed
Overriding or shadowing a variable declared in an outer scope can strongly impact the readability, and therefore the maintainability, of a piece of...
Read more >Problem set 1 Mario variable issue - CS50 Stack Exchange
It's saying declaration shadows a local variable now when I type make mario. – Rayray94. May 1, 2020 at 19:11.
Read more >Shadowing built-in functions - MATLAB Answers - MathWorks
It is a well known problem from the forums, that the name of a built-in function is used for a variable ... Never...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In https://github.com/typescript-eslint/typescript-eslint/issues/2469
Closing since the issue is tracked in https://github.com/typescript-eslint/typescript-eslint/issues/2447 already.