tools
tools copied to clipboard
🐛 Semantics: Incorrect redeclaration error for parameters of arrow function expressions
Environment information
This is found inside material-ui.
What happened?
const {
a = (arg) => {},
b = (arg) => {},
} = props;
errored with
error[SyntaxError]: Declarations inside of a `const` declaration may not have duplicates
┌─ main.js:3:8
│
2 │ a = (arg) => {},
│ --- `arg` is first declared here
3 │ b = (arg) => {},
│ ^^^ a second declaration of `arg` is not allowed
Expected result
No error.
Code of Conduct
- [X] I agree to follow Rome's Code of Conduct
Found another case in react-admin
error[SyntaxError]: Declarations inside of a `const` declaration may not have duplicates
┌─ react-admin/packages/ra-ui-materialui/src/layout/Menu.tsx:54:22
│
53 │ .filter(name => resources[name].hasList)
│ ---- `name` is first declared here
54 │ .map(name => (
│ ^^^^ a second declaration of `name` is not allowed
Yeah, moving this to the analyzer is a good idea, now that @xunilrj implemented the semantic model.
One thing that we may need to do tough is to change the t262 tests to no longer run against the parser only but run with analyze.
@xunilrj is this something you might be interested in looking at? There are probably more checks that we could move from our parser into the analyzer.
There are a couple of other changes I want to move from the parser to linters. I will create a small list and we can decide if makes sense or not.
This issue is stale because it has been open 14 days with no activity.
Going to re-open: @xunilrj are there any progress around this issue? Should we close it?
This issue is stale because it has been open 14 days with no activity.