chore(linter): Add more test cases to the no-with rule.#16791
chore(linter): Add more test cases to the no-with rule.#16791graphite-app[bot] merged 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Test coverage improved substantially for non-violations, but the violation coverage remains thin: only one with-statement variant is asserted. Adding a few representative failing cases would better protect against regressions in parsing/AST matching across formatting and nesting patterns.
Summary of changes
What changed
- Expanded the
no-withrule test coverage incrates/oxc_linter/src/rules/eslint/no_with.rsby replacing a single passing fixture ("foo.bar()") with a broaderpasssuite. - Added multiple non-
with-statement scenarios that include the tokenwithin:- comments (
/* ... */,// ...) - identifiers/properties (
obj.with,{ with: 1 },['with'], destructuring{ with: w }) - class methods (
with() {}) - string/template literals (
'with in string',`with in template`)
- comments (
- Left the failing fixture as a single canonical
with(foo) { bar() }case.
There was a problem hiding this comment.
Pull request overview
This PR enhances test coverage for the no-with ESLint rule by adding 11 new test cases to the existing single test case. The new tests comprehensively verify that the rule correctly allows the keyword "with" in contexts where it's not used as a statement (comments, strings, property names, method names, destructuring).
Key Changes:
- Expanded the
passtest vector from 1 to 12 test cases - Added edge cases covering comments, strings, template literals, property access, methods, computed properties, and destructuring
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
CodSpeed Performance ReportMerging #16791 will not alter performanceComparing Summary
Footnotes
|
Merge activity
|
Only one test case is a bit... slim.
d2850a9 to
710c3a7
Compare
Only one test case is a bit... slim.