Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: [no-shadow] It would really help, if the error message would show where the original identifier has been defined #2458

Closed
doberkofler opened this issue Sep 1, 2020 · 2 comments
Labels
awaiting response Issues waiting for a reply from the OP or another party package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@doberkofler
Copy link
Contributor

In my experience, the no-shadow rule could greatly benefit from an error message that also describes where the identifier has already been defined and not only where the redefinition has occurred.

const a = 1;

if (a === 1) {
	const a = 5;
	console.log(a);
}

Instead of the current error:

4:8 error 'a' is already declared in the upper scope @typescript-eslint/no-shadow

the following would be most helpful:

4:8 error 'a' is already declared in the upper scope (1:7) @typescript-eslint/no-shadow

Versions

package version
@typescript-eslint/eslint-plugin 4.0.1
@typescript-eslint/parser 4.0.1
TypeScript 4.0.2
ESLint 7.8.0
node 14.8.0
@doberkofler doberkofler added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Sep 1, 2020
@doberkofler doberkofler changed the title [no-shadow] It would really help, if the error message would show where the original identifier has been defined Feature request: [no-shadow] It would really help, if the error message would show where the original identifier has been defined Sep 1, 2020
@bradzacher
Copy link
Member

Thanks for the request! Whilst our version of the rule is currently a reimplementation of no-shadow, I don't want to break parity with the base eslint rule.

Extension rules are intended to be extended versions with as few changes as possible to make them work for TS.

Please submit this as a request to eslint core. If they are aligned then happy to update our version to match.

@bradzacher bradzacher added awaiting response Issues waiting for a reply from the OP or another party and removed triage Waiting for maintainers to take a look labels Sep 1, 2020
@doberkofler
Copy link
Contributor Author

I've created the sr eslint/eslint#13646

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
awaiting response Issues waiting for a reply from the OP or another party package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

No branches or pull requests

2 participants