Skip to content

test(linter/plugins): conformance tests ignore parsing errors#16717

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-09-test_linter_plugins_conformance_tests_ignore_parsing_errors
Dec 11, 2025
Merged

test(linter/plugins): conformance tests ignore parsing errors#16717
graphite-app[bot] merged 1 commit intomainfrom
12-09-test_linter_plugins_conformance_tests_ignore_parsing_errors

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Dec 11, 2025

ESLint's has many test cases with invalid code. Loosen parsing in conformance test, so parsing only errors if there's a fatal error, and allow any other error where parser can produce a valid AST.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-linter-plugins Area - Linter JS plugins C-test Category - Testing. Code is missing test cases, or a PR is adding them labels Dec 11, 2025
Copy link
Copy Markdown
Member Author

overlookmotel commented Dec 11, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a 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 improves conformance test compatibility with ESLint's test suite by enabling non-fatal parsing error handling. ESLint test cases often include intentionally invalid code (e.g., syntax errors, duplicate parameters) to verify that rules correctly handle edge cases. By setting parserOptions.ignoreNonFatalErrors = true, the parser can produce valid ASTs from code with non-fatal errors, allowing these tests to proceed and rules to be evaluated.

Key changes:

  • Modified conformance test setup to unconditionally set ignoreNonFatalErrors = true for all test cases
  • Refactored test case modification logic to create new languageOptions and parserOptions objects before TypeScript parser handling
  • Improved test pass rates: 177 rules now fully passing (up from 171), with 69 additional tests passing overall

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
apps/oxlint/conformance/src/rule_tester.ts Refactored modifyTestCase to unconditionally enable ignoreNonFatalErrors for all conformance tests, and restructured object creation to happen before TypeScript parser detection
apps/oxlint/conformance/snapshot.md Updated test results showing improved pass rates across multiple rules (accessor-pairs, class-methods-use-this, default-param-last, func-style, grouped-accessor-pairs, init-declarations, no-array-constructor, no-dupe-class-members, no-restricted-imports, no-shadow-restricted-names, no-useless-constructor, prefer-arrow-callback, strict)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@overlookmotel overlookmotel force-pushed the 12-11-test_linter_plugins_conformance_tester_error_on_test_cases_with_custom_parsers branch from 632bd1b to ee3aae5 Compare December 11, 2025 02:09
@overlookmotel overlookmotel force-pushed the 12-09-test_linter_plugins_conformance_tests_ignore_parsing_errors branch from f0a3eb7 to 20b5b7c Compare December 11, 2025 02:09
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Dec 11, 2025
@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app bot commented Dec 11, 2025

Merge activity

ESLint's has many test cases with invalid code. Loosen parsing in conformance test, so parsing only errors if there's a fatal error, and allow any other error where parser can produce a valid AST.
@graphite-app graphite-app bot force-pushed the 12-11-test_linter_plugins_conformance_tester_error_on_test_cases_with_custom_parsers branch from ee3aae5 to 773d34d Compare December 11, 2025 02:17
@graphite-app graphite-app bot force-pushed the 12-09-test_linter_plugins_conformance_tests_ignore_parsing_errors branch from 20b5b7c to 7b28b6f Compare December 11, 2025 02:17
Base automatically changed from 12-11-test_linter_plugins_conformance_tester_error_on_test_cases_with_custom_parsers to main December 11, 2025 02:23
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 11, 2025
@graphite-app graphite-app bot merged commit 7b28b6f into main Dec 11, 2025
19 checks passed
@graphite-app graphite-app bot deleted the 12-09-test_linter_plugins_conformance_tests_ignore_parsing_errors branch December 11, 2025 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins C-test Category - Testing. Code is missing test cases, or a PR is adding them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants