tools
tools copied to clipboard
feat(rome_js_analyze): rule `noDupeArgs`
Summary
- Resolved #2735
Test Plan
- Should pass all test cases newly added.
Wait #2973 to be merged.
!bench_analyhzer
!bench_analyzer
Analyzer Benchmark Results
group main pr
----- ---- --
analyzer/css.js 1.00 2.3±0.00ms 4.9 MB/sec 1.02 2.4±0.00ms 4.9 MB/sec
analyzer/index.js 1.00 5.6±0.01ms 5.8 MB/sec 1.02 5.7±0.06ms 5.6 MB/sec
analyzer/lint.ts 1.00 3.2±0.00ms 12.8 MB/sec 1.02 3.3±0.00ms 12.6 MB/sec
analyzer/parser.ts 1.00 7.5±0.01ms 6.5 MB/sec 1.01 7.5±0.04ms 6.4 MB/sec
analyzer/router.ts 1.00 5.2±0.01ms 11.7 MB/sec 1.01 5.3±0.01ms 11.6 MB/sec
analyzer/statement.ts 1.00 7.1±0.03ms 5.0 MB/sec 1.01 7.2±0.03ms 4.9 MB/sec
analyzer/typescript.ts 1.00 10.5±0.08ms 5.2 MB/sec 1.01 10.6±0.02ms 5.1 MB/sec
!bench_analyzer
Analyzer Benchmark Results
group main pr
----- ---- --
analyzer/css.js 1.00 2.5±0.09ms 4.7 MB/sec 1.06 2.6±0.02ms 4.5 MB/sec
analyzer/index.js 1.00 6.7±0.13ms 4.8 MB/sec 1.05 7.1±0.31ms 4.6 MB/sec
analyzer/lint.ts 1.02 3.5±0.06ms 11.8 MB/sec 1.00 3.5±0.10ms 12.0 MB/sec
analyzer/parser.ts 1.00 8.1±0.13ms 6.0 MB/sec 1.04 8.4±0.10ms 5.8 MB/sec
analyzer/router.ts 1.05 5.8±0.10ms 10.6 MB/sec 1.00 5.5±0.18ms 11.1 MB/sec
analyzer/statement.ts 1.03 8.0±0.11ms 4.4 MB/sec 1.00 7.8±0.19ms 4.6 MB/sec
analyzer/typescript.ts 1.02 11.8±0.43ms 4.6 MB/sec 1.00 11.6±0.32ms 4.7 MB/sec
@ematipico I rewrite the algorithm as you said before, using a recursive pattern matching algorithm to find the duplicate params. Would you mind helping with reviewing?
So this may be more of a discussion we could have in the corresponding issue for this rule rather than in the PR, but I'm wondering if there's a way we could make the implementation for this rule more generic, into a noNameShadowing
rule that would disallow duplicate binding names in the same scope whether that's two arguments, variables, functions, object / class member ...
!bench_analyzer
Analyzer Benchmark Results
group main pr
----- ---- --
analyzer/css.js 1.00 1929.8±6.90µs 6.0 MB/sec 1.01 1943.3±6.87µs 6.0 MB/sec
analyzer/index.js 1.00 5.2±0.05ms 6.2 MB/sec 1.01 5.3±0.03ms 6.1 MB/sec
analyzer/lint.ts 1.00 2.8±0.04ms 14.9 MB/sec 1.00 2.8±0.03ms 14.9 MB/sec
analyzer/parser.ts 1.00 6.6±0.15ms 7.4 MB/sec 1.00 6.5±0.13ms 7.4 MB/sec
analyzer/router.ts 1.13 5.2±0.10ms 11.8 MB/sec 1.00 4.6±0.10ms 13.3 MB/sec
analyzer/statement.ts 1.00 6.2±0.12ms 5.7 MB/sec 1.16 7.2±0.35ms 4.9 MB/sec
analyzer/typescript.ts 1.01 9.2±0.12ms 5.9 MB/sec 1.00 9.1±0.08ms 6.0 MB/sec
@xunilrj would you mind a give a second view and merge if you think it's fine?
Done.