feat(linter): add oxc/no-redundant-constructor-init#9299
feat(linter): add oxc/no-redundant-constructor-init#9299Boshen merged 5 commits intooxc-project:mainfrom
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
dbc91d2 to
d71bce9
Compare
|
Thank you so much for working on this! Here are some results from running this rule in https://github.com/oxc-project/oxlint-ecosystem-ci Kibana vscode: |
CodSpeed Performance ReportMerging #9299 will not alter performanceComparing Summary
|
crates/oxc_linter/src/rules/eslint/no_redundant_constructor_init.rs
Outdated
Show resolved
Hide resolved
|
Tests were failing because a load of snapshots had a line similar to the following where the number of rules increased by 1: - Finished in <variable>ms on 1 file with 99 rules using 1 threads.
+ Finished in <variable>ms on 1 file with 100 rules using 1 threads.I've updated and committed all those snapshots, hopefully that is correct. |
) Follow-up from #9299 As pointed out in discussions there, the initial implementation doesn't handle assignments nested in blocks as only the body's statements were being checked. This instead checks for any references to each public param, checks it is a read (which it would be in the right-side of an assignment) and then if it's part of an assignment to `this`. Adds tests for these new cases, previous tests still pass.
## [0.15.13] - 2025-03-04 ### Features - 7bb0121 linter: Add `react/no-namespace` (#9404) (Mikhail Baev) - 0a7ca20 linter: Support allowable method diagnostic for eslint/no-console (#9454) (Boshen) - d99bc51 linter: Add import/no-absolute-path rule (#9415) (yefan) - 8c71590 linter: Add import/no-mutable-exports rule (#9434) (yefan) - b65f8a5 linter: Add `promise/no-nesting` (#9345) (Tom) - d38e6de linter: Add `eslint/no-spaced-func` (#9360) (Tom) - 25392de linter: Add eslint/operator-assignment rule (#9208) (yefan) - bf77167 linter: Add `curly` rule (#8123) (Yuichiro Yamashita) - e3b6eeb linter: Add `unicorn/consistent-date-clone` (#9346) (Amol Bhave) - 5ee2cab linter: Improve no_invalid_fetch_options (#9347) (Brooooooklyn) - 4ad328b linter: Add oxc/no-redundant-constructor-init (#9299) (Ben Jones) ### Bug Fixes - c4624a6 linter: Fix panic in `import/no-absolute-path` (#9500) (camc314) - 4b0327b linter: False positive in `eslint/curly` (#9471) (Kevin Deng 三咲智子) - 8804555 linter: Skip `no-absolute-path` tests on windows (#9435) (Cameron) - 06fe76d linter: Rule `no-restricted-imports` use right span for exports statements (#9442) (Sysix) - 3da3565 linter: Rule `unicorn/no-invalid-fetch-options` (#9416) (Tom) - 85fbe8c linter: Rule `eslint/radix` look into globals config (#9407) (Sysix) - 1113e3b linter: Rule `eslint/no-object-constructor` look into globals config (#9406) (Sysix) - 0217ebb linter: Support more cases for no_redundant_constructor_init (#9364) (Ben Jones) ### Documentation - 24850e7 linter: Add example of how configure rule (#9469) (Cédric DIRAND) - acb1e2c linter: Add end code tag on rule doc (#9470) (Cédric DIRAND) - d43b456 linter: Add full documentation to rule `no-restricted-imports` (#9440) (Sysix) ### Refactor - ffec3f6 linter: Improve `eslint/no-new` (#9423) (Tom) - 7c27f10 linter: Move rule `no-restricted-imports` to category `restriction` (#9443) (Sysix) - 7e118a3 linter: Improve `typescript/explicit-function-return-type` (#9439) (Tom) - 5318cf2 linter: Improve `eslint/no-spaced-func` (#9419) (shulaoda) - 802f00e linter: Use the `javascript-globals` crate (#9412) (Boshen) - bff83c9 linter: Improve `eslint/no-unsafe-negation` (#9362) (dalaoshu) - 228bf99 linter: Improve `unicorn/empty-brace-spaces` (#9341) (dalaoshu) - 55d071b linter: Improve `unicorn/consistent-existence-index-check` (#9339) (dalaoshu) - 17acece linter: Improve `eslint/no-template-curly-in-string` (#9090) (dalaoshu) Co-authored-by: Boshen <[email protected]>
…meter_property_assignment (#9720) Followup to #9618. PRs for oxc/no-redundant-constructor-init: #9299 #9364 typescript-eslint rule: [Docs](https://typescript-eslint.io/rules/no-unnecessary-parameter-property-assignment) [Source](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/rules/no-unnecessary-parameter-property-assignment.ts) [Tests](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/tests/rules/no-unnecessary-parameter-property-assignment.test.ts) Changes of this PR: - Imported tests from typescript-eslint - Added one more passing test to the end - Fixed all new test cases - Changed rule category back to correctness This is my first major change to OXC. If there's anything wrong or not the OXC-way, I will happily improve on that.
closes #9267
I'm unsure whether the rule naming is correct, I believe this is a rule that doesn't exist elsewhere so came up with the name
no_redundant_constructor_init, if that needs to be changed or if the rule should be moved elsewhere then happy to do so.