-
-
Notifications
You must be signed in to change notification settings - Fork 737
feat(linter/plugins): add ignoreNonFatalErrors option to RuleTester
#16672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(linter/plugins): add ignoreNonFatalErrors option to RuleTester
#16672
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. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Merge activity
|
…r` (#16672) Add an option to `RuleTester` to ignore non-fatal parsing errors. ```js const tester = new RuleTester({ languageOptions: { sourceType: "module", parserOptions: { ignoreNonFatalErrors: true, }, }, }); tester.run("my-rule", rule, { valid: [ // This is invalid code, but it gets a pass "function f(x, x) {}", ], invalid: [], }); ``` This will be useful in conformance tests, because ESLint's tests contain invalid syntax in many of their test cases!
227caf0 to
e39f487
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds an ignoreNonFatalErrors option to RuleTester to allow parsing to continue despite non-fatal parsing errors. This feature is designed to support ESLint conformance tests, which often contain intentionally invalid syntax in test cases. When enabled, the parser will ignore parsing and semantic errors (but not panics), allowing the linter to still run on the partially-valid AST.
Key changes:
- Added
ignoreNonFatalErrorsboolean option to parser options, configurable at global, RuleTester instance, or individual test case level - Implemented proper option merging with right-to-left precedence (local overrides base)
- Optimized to skip semantic analysis when errors are being ignored
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/oxlint/src/js_plugins/parse.rs | Adds Rust-side handling of ignore_non_fatal_errors option, modifying parsing failure detection logic and skipping semantic analysis when errors are ignored |
| apps/oxlint/src-js/package/rule_tester.ts | Adds TypeScript interface for ignoreNonFatalErrors, implements option extraction in getParseOptions, and adds mergeParserOptions helper for proper config merging |
| apps/oxlint/src-js/bindings.d.ts | Auto-generated NAPI bindings with new ignoreNonFatalErrors field in ParserOptions interface |
| apps/oxlint/test/rule_tester.test.ts | Comprehensive test suite covering default behavior, global/instance/test-case level configuration, overriding behavior, and mixed scenarios |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…r` (#16672) Add an option to `RuleTester` to ignore non-fatal parsing errors. ```js const tester = new RuleTester({ languageOptions: { sourceType: "module", parserOptions: { ignoreNonFatalErrors: true, }, }, }); tester.run("my-rule", rule, { valid: [ // This is invalid code, but it gets a pass "function f(x, x) {}", ], invalid: [], }); ``` This will be useful in conformance tests, because ESLint's tests contain invalid syntax in many of their test cases!

Add an option to
RuleTesterto ignore non-fatal parsing errors.This will be useful in conformance tests, because ESLint's tests contain invalid syntax in many of their test cases!