Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

馃悰 Parser doesn't throw an error about the duplicate private class member #4143

Closed
1 task done
nissy-dev opened this issue Jan 7, 2023 · 4 comments 路 Fixed by #4144
Closed
1 task done

馃悰 Parser doesn't throw an error about the duplicate private class member #4143

nissy-dev opened this issue Jan 7, 2023 · 4 comments 路 Fixed by #4144
Labels
A-Linter Area: linter enhancement New feature request or improvement to existing functionality good first issue Good for newcomers I-Easy Implementation: easy task, usually a good fit for new contributors S-Bug: confirmed Status: report has been confirmed as a valid bug

Comments

@nissy-dev
Copy link
Contributor

nissy-dev commented Jan 7, 2023

Environment information

I will share the playground link in the next section.

What happened?

Parser doesn't throw an error about the duplicate private class member.
The duplicate private class member raises the syntax error in runtime.

Playground Link

https://docs.rome.tools/playground/?indentStyle=space&quoteStyle=single&trailingComma=none&lintRules=all&enabledLinting=false&code=YwBsAGEAcwBzACAAQQAgAHsACgAgACAAIwBmAG8AbwA7AAoAIAAgACMAZgBvAG8AOwAKAH0ACgA%3D

https://docs.rome.tools/playground/?indentStyle=space&quoteStyle=single&trailingComma=none&lintRules=all&enabledLinting=false&code=YwBsAGEAcwBzACAAQQAgAHsACgAgACAAZwBlAHQAIAAjAGYAbwBvACgAKQAgAHsAfQAKACAAIAAjAGYAbwBvADsACgB9AAoA

Expected result

Prettier and TypeScript throw an error about the duplicate private class member. Rome also throw an error?

TypeScript Playground Link
https://www.typescriptlang.org/play?#code/MYGwhgzhAECC0G8BQ1oGIBmB7L0C80AjANwrra4EBMpAvkkA

Code of Conduct

  • I agree to follow Rome's Code of Conduct
@nissy-dev nissy-dev added the S-To triage Status: user report of a possible bug that needs to be triaged label Jan 7, 2023
@ematipico ematipico added enhancement New feature request or improvement to existing functionality S-Bug: confirmed Status: report has been confirmed as a valid bug A-Linter Area: linter and removed S-To triage Status: user report of a possible bug that needs to be triaged labels Jan 7, 2023
@ematipico
Copy link
Contributor

This is a nice opportunity to create a new analyzer rule that checks that.

We already have an analyzer that check syntax errors: https://github.com/rome/tools/blob/main/crates/rome_js_analyze/src/syntax/nursery/no_super_without_extends.rs

@ematipico ematipico added I-Easy Implementation: easy task, usually a good fit for new contributors good first issue Good for newcomers labels Jan 7, 2023
@nissy-dev
Copy link
Contributor Author

OK. I will update #4137 and the rule noDuplicateClassMembers will check duplicate private class members.

@ematipico
Copy link
Contributor

OK. I will update #4137 and the rule noDuplicateClassMembers will check duplicate private class members.

Actually, that's not needed.

What I was suggesting was creating a NEW rule. That new rule will be a syntax rule, like the one I showed in my previous comment.

Those rules are particular: they don't have code actions and can't be turned off. These are rules that should check syntax or runtime errors

@nissy-dev
Copy link
Contributor Author

Thank you for your explanation. I could understand. I will take this issue and create the new syntax rule.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Linter Area: linter enhancement New feature request or improvement to existing functionality good first issue Good for newcomers I-Easy Implementation: easy task, usually a good fit for new contributors S-Bug: confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants