Skip to content

fix: relax @eslint/compat eslint peerDependencies constraint #215

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

Merged
merged 1 commit into from
Jun 21, 2025

Conversation

kellyselden
Copy link
Contributor

@kellyselden kellyselden commented May 30, 2025

Updated to the suggestion in #106 (comment). This was a breaking change, causing a refresh of our lockfile to generate the following error:

 ERR_PNPM_PEER_DEP_ISSUES  Unmet peer dependencies

XXX
└─┬ @eslint/compat 1.2.9
  └── ✕ unmet peer eslint@^9.10.0: found 8.57.0

This resolves the breaking change, since I believe @eslint/compat was introduced during the v8 eslint cycle and we don't need to go lower.

Prerequisites checklist

What is the purpose of this pull request?

To resolve a breaking change in @eslint/compat.

What changes did you make? (Give an overview)

Added eslint v8 to the peer dependencies.

Related Issues

#106 (comment)

Is there anything you'd like reviewers to focus on?

@github-project-automation github-project-automation bot moved this to Needs Triage in Triage May 30, 2025
Copy link

linux-foundation-easycla bot commented May 30, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: kellyselden / name: Kelly Selden (6d9c1e3)

@eslint-github-bot eslint-github-bot bot added the bug Something isn't working label May 30, 2025
@nzakas
Copy link
Member

nzakas commented Jun 3, 2025

Seems like a safe change to me. @fasttime because you were involved in the original discussion, what do you think?

@nzakas nzakas moved this from Needs Triage to Triaging in Triage Jun 3, 2025
@fasttime
Copy link
Member

fasttime commented Jun 4, 2025

We added a peer dependency on "eslint": "^9.10.0" because v9.10.0 was the first ESLint version to ship with built-in types. With previous ESLint versions, I think users can still get TypeScript support by installing @types/eslint, so types shouldn't be a concern.

Apart from that, it's difficult to say if the change in this PR is safe or not because we don't have unit tests for ESLint v8. I can see 13 failing tests when I run npm test locally with ESLint v8.57.1 installed in place of v9, but this could depend entirely on how the tests are written.

@kellyselden
Copy link
Contributor Author

If we are worried about breaking v8 accidentally in the future, I think this is what should be done to be SemVer compliant:

  • merge this and release as @eslint/compat@1.2.10
  • then revert this and release as @eslint/compat@2.0.0

@nzakas
Copy link
Member

nzakas commented Jun 6, 2025

@kellyselden that would introduce a potentially breaking change into the 1.x line, which is the concern here.

@fasttime which tests failed?

@kellyselden
Copy link
Contributor Author

@nzakas Do you expect there to be further 1.x development after releasing v2? If so, could we revert the breaking change as an option?

@fasttime
Copy link
Member

fasttime commented Jun 9, 2025

@nzakas To test with ESLint v8.57.1, I run these commands:

cd packages/compat
npm i -D eslint@8
npm run build
npm test

And I got test failures:


> @eslint/compat@1.2.9 test
> mocha tests/*.js



  @eslint/backcompat
    fixupRule()
      ✔ should return a new rule object with the same own properties
      ✔ should return the same fixed up rule when applied to the same rule multiple times
      ✔ should return the same fixed up rule when a fixed up rule is passed to fixupRule
      1) should return a new rule object with `meta.schema` when a rule with top-level `schema` and without `meta` is passed to fixupRule
      2) should return a new rule object with `meta.schema` when a rule with top-level `schema` and with `meta` is passed to fixupRule
      3) should return a rule object when a function-style rule is passed to fixupRule
      4) should return a rule object with `meta.schema` when a function-style rule with schema is passed to fixupRule
      5) should create a rule where getDeclaredVariables() returns the same value as sourceCode.getDeclaredVariables(node)
      6) should create a rule where context.getScope() returns the same value as sourceCode.getScope(node) in visitor methods
      7) should create a rule where context.getScope() returns the same value as sourceCode.getScope(node) in code path methods
      8) should create a rule where context.getAncestors() returns the same value as sourceCode.getAncestors(node) in visitor methods
      9) should create a rule where context.getAncestors() returns the same value as sourceCode.getAncestors(node) in code path methods
    fixupPluginRules()
      ✔ should return a new plugin object with the same own properties
      ✔ should return the same fixed up plugin when applied to the same plugin multiple times
      ✔ should return the same fixed up plugin when a fixed up plugin is passed to fixupPlugin
      ✔ should return the original plugin when it doesn't have rules
      10) should create a plugin where context.getScope() returns the same value as sourceCode.getScope(node)
      11) should create a plugin where context.getAncestors() returns the same value as sourceCode.getAncestors(node)
    fixupConfigRules()
      ✔ should return an array with the same number of items and objects with the same properties
      12) should create a configuration where context.getScope() returns the same value as sourceCode.getScope(node)
      13) should create a configuration where context.getAncestors() returns the same value as sourceCode.getAncestors(node)

  @eslint/compat
    convertIgnorePatternToMinimatch
      ✔ should convert "" to ""
      ✔ should convert "**" to "**"
      ✔ should convert "/**" to "/**"
      ✔ should convert "**/" to "**/"
      ✔ should convert "src/" to "**/src/"
      ✔ should convert "src" to "**/src"
      ✔ should convert "src/**" to "src/**/*"
      ✔ should convert "!src/" to "!**/src/"
      ✔ should convert "!src" to "!**/src"
      ✔ should convert "!src/**" to "!src/**/*"
      ✔ should convert "*/foo.js" to "*/foo.js"
      ✔ should convert "*/foo.js/" to "*/foo.js/"
      ✔ should convert "src/{a,b}.js" to "src/\{a,b}.js"
      ✔ should convert "src/?(a)b.js" to "src/?\(a)b.js"
      ✔ should convert "{.js" to "**/\{.js"
      ✔ should convert "(.js" to "**/\(.js"
      ✔ should convert "(.js" to "**/\(.js"
      ✔ should convert "{(.js" to "**/\{\(.js"
      ✔ should convert "{bar}/{baz}" to "\{bar}/\{baz}"
      ✔ should convert "\[foo]/{bar}/{baz}" to "\[foo]/\{bar}/\{baz}"
      ✔ should convert "src/\{a}" to "src/\{a}"
      ✔ should convert "src/\(a)" to "src/\(a)"
      ✔ should convert "src/\{a}/{b}" to "src/\{a}/\{b}"
      ✔ should convert "src/\(a)/(b)" to "src/\(a)/\(b)"
      ✔ should convert "a\bc{de(f\gh\{i\(j{(" to "**/a\bc\{de\(f\gh\{i\(j\{\("
    includeIgnoreFile
      ✔ should throw an error when a relative path is passed
      ✔ should return an object with an `ignores` property
      ✔ should return an object with a custom name


  36 passing (16ms)
  13 failing

  1) @eslint/backcompat
       fixupRule()
         should return a new rule object with `meta.schema` when a rule with top-level `schema` and without `meta` is passed to fixupRule:

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
�[32mactual�[39m �[31mexpected�[39m

�[32m"�[39m�[32mD�[39m�[32me�[39m�[32mf�[39m�[32mi�[39m�[32mn�[39m�[32mi�[39m�[32mt�[39m�[32mi�[39m�[32mo�[39m�[32mn�[39m�[32m �[39m�[32mf�[39m�[32mo�[39m�[32mr�[39m�[32m �[39m�[32mr�[39m�[32mu�[39m�[32ml�[39m�[32me�[39m�[32m �[39m�[39m'�[39m�[32mt�[39m�[32me�[39m�[32ms�[39m�[32mt�[39m�[32m/�[39m�[32mt�[39m�[32me�[39m�[32ms�[39m�[32mt�[39m�[31mm�[39m�[31my�[39m�[39m-�[39m�[32mr�[39m�[32mu�[39m�[32ml�[39m�[32me�[39m�[32m'�[39m�[32m �[39m�[32mw�[39m�[32ma�[39m�[32ms�[39m�[32m �[39m�[32mn�[39m�[39mo�[39m�[31mp�[39m�[39mt�[39m�[32m �[39m�[32mf�[39m�[31mi�[39m�[39mo�[39m�[32mu�[39m�[39mn�[39m�[32md�[39m�[32m.�[39m�[32m"�[39m�[31m'�[39m

      + expected - actual

      -Definition for rule 'test/test-rule' was not found.
      +my-option
      
      at Context.<anonymous> (.../rewrite/packages/compat/tests/fixup-rules.js:121:11)
      at process.processImmediate (node:internal/timers:505:21)

  2) @eslint/backcompat
       fixupRule()
         should return a new rule object with `meta.schema` when a rule with top-level `schema` and with `meta` is passed to fixupRule:

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
�[32mactual�[39m �[31mexpected�[39m

�[32m"�[39m�[32mD�[39m�[32me�[39m�[32mf�[39m�[32mi�[39m�[32mn�[39m�[32mi�[39m�[32mt�[39m�[32mi�[39m�[32mo�[39m�[32mn�[39m�[32m �[39m�[32mf�[39m�[32mo�[39m�[32mr�[39m�[32m �[39m�[32mr�[39m�[32mu�[39m�[32ml�[39m�[32me�[39m�[32m �[39m�[39m'�[39m�[32mt�[39m�[32me�[39m�[32ms�[39m�[32mt�[39m�[32m/�[39m�[32mt�[39m�[32me�[39m�[32ms�[39m�[32mt�[39m�[31mm�[39m�[31my�[39m�[39m-�[39m�[32mr�[39m�[32mu�[39m�[32ml�[39m�[32me�[39m�[32m'�[39m�[32m �[39m�[32mw�[39m�[32ma�[39m�[32ms�[39m�[32m �[39m�[32mn�[39m�[39mo�[39m�[31mp�[39m�[39mt�[39m�[32m �[39m�[32mf�[39m�[31mi�[39m�[39mo�[39m�[32mu�[39m�[39mn�[39m�[32md�[39m�[32m.�[39m�[32m"�[39m�[31m'�[39m

      + expected - actual

      -Definition for rule 'test/test-rule' was not found.
      +my-option
      
      at Context.<anonymous> (.../rewrite/packages/compat/tests/fixup-rules.js:169:11)
      at process.processImmediate (node:internal/timers:505:21)

  3) @eslint/backcompat
       fixupRule()
         should return a rule object when a function-style rule is passed to fixupRule:

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
�[32mactual�[39m �[31mexpected�[39m

�[32m"�[39m�[32mD�[39m�[32me�[39m�[32mf�[39m�[32mi�[39m�[32mn�[39m�[32mi�[39m�[32mt�[39m�[32mi�[39m�[32mo�[39m�[32mn�[39m�[31m'�[39m�[31mM�[39m�[31my�[39m�[39m �[39m�[32mf�[39m�[32mo�[39m�[32mr�[39m�[32m �[39m�[32mr�[39m�[32mu�[39m�[32ml�[39m�[31mm�[39m�[39me�[39m�[32m �[39m�[32m'�[39m�[32mt�[39m�[32me�[39m�[39ms�[39m�[32mt�[39m�[32m/�[39m�[32mt�[39m�[32me�[39m�[39ms�[39m�[32mt�[39m�[32m-�[39m�[32mr�[39m�[32mu�[39m�[32ml�[39m�[32me�[39m�[32m'�[39m�[32m �[39m�[32mw�[39m�[39ma�[39m�[32ms�[39m�[32m �[39m�[32mn�[39m�[32mo�[39m�[32mt�[39m�[32m �[39m�[32mf�[39m�[32mo�[39m�[32mu�[39m�[32mn�[39m�[32md�[39m�[31mg�[39m�[31me�[39m�[39m.�[39m�[32m"�[39m�[31m'�[39m

      + expected - actual

      -Definition for rule 'test/test-rule' was not found.
      +My message.
      
      at Context.<anonymous> (.../rewrite/packages/compat/tests/fixup-rules.js:207:11)
      at process.processImmediate (node:internal/timers:505:21)

  4) @eslint/backcompat
       fixupRule()
         should return a rule object with `meta.schema` when a function-style rule with schema is passed to fixupRule:

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
�[32mactual�[39m �[31mexpected�[39m

�[32m"�[39m�[32mD�[39m�[32me�[39m�[32mf�[39m�[32mi�[39m�[32mn�[39m�[32mi�[39m�[32mt�[39m�[32mi�[39m�[32mo�[39m�[32mn�[39m�[32m �[39m�[32mf�[39m�[32mo�[39m�[32mr�[39m�[32m �[39m�[32mr�[39m�[32mu�[39m�[32ml�[39m�[32me�[39m�[32m �[39m�[39m'�[39m�[32mt�[39m�[32me�[39m�[32ms�[39m�[32mt�[39m�[32m/�[39m�[32mt�[39m�[32me�[39m�[32ms�[39m�[32mt�[39m�[31mm�[39m�[31my�[39m�[39m-�[39m�[32mr�[39m�[32mu�[39m�[32ml�[39m�[32me�[39m�[32m'�[39m�[32m �[39m�[32mw�[39m�[32ma�[39m�[32ms�[39m�[32m �[39m�[32mn�[39m�[39mo�[39m�[31mp�[39m�[39mt�[39m�[32m �[39m�[32mf�[39m�[31mi�[39m�[39mo�[39m�[32mu�[39m�[39mn�[39m�[32md�[39m�[32m.�[39m�[32m"�[39m�[31m'�[39m

      + expected - actual

      -Definition for rule 'test/test-rule' was not found.
      +my-option
      
      at Context.<anonymous> (.../rewrite/packages/compat/tests/fixup-rules.js:254:11)
      at process.processImmediate (node:internal/timers:505:21)

  5) @eslint/backcompat
       fixupRule()
         should create a rule where getDeclaredVariables() returns the same value as sourceCode.getDeclaredVariables(node):

      AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
�[32m+ actual�[39m �[31m- expected�[39m

�[39m  [
�[32m+�[39m   'Parsing error: Unexpected token )'
�[31m-�[39m   'Program',
�[31m-�[39m   'Identifier',
�[31m-�[39m   'ArrowFunctionExpression',
�[31m-�[39m   'FunctionDeclaration',
�[31m-�[39m   'Identifier'
�[39m  ]

      + expected - actual

       [
      -  "Parsing error: Unexpected token )"
      +  "Program"
      +  "Identifier"
      +  "ArrowFunctionExpression"
      +  "FunctionDeclaration"
      +  "Identifier"
       ]
      
      at Context.<anonymous> (.../rewrite/packages/compat/tests/fixup-rules.js:317:11)
      at process.processImmediate (node:internal/timers:505:21)

  6) @eslint/backcompat
       fixupRule()
         should create a rule where context.getScope() returns the same value as sourceCode.getScope(node) in visitor methods:

      AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
�[32m+ actual�[39m �[31m- expected�[39m

�[39m  [
�[32m+�[39m   'Parsing error: Unexpected token )'
�[31m-�[39m   'Program',
�[31m-�[39m   'Identifier',
�[31m-�[39m   'ArrowFunctionExpression',
�[31m-�[39m   'FunctionDeclaration',
�[31m-�[39m   'Identifier'
�[39m  ]

      + expected - actual

       [
      -  "Parsing error: Unexpected token )"
      +  "Program"
      +  "Identifier"
      +  "ArrowFunctionExpression"
      +  "FunctionDeclaration"
      +  "Identifier"
       ]
      
      at Context.<anonymous> (.../rewrite/packages/compat/tests/fixup-rules.js:387:12)
      at process.processImmediate (node:internal/timers:505:21)

  7) @eslint/backcompat
       fixupRule()
         should create a rule where context.getScope() returns the same value as sourceCode.getScope(node) in code path methods:

      AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
�[32m+ actual�[39m �[31m- expected�[39m

�[39m  [
�[32m+�[39m   'Parsing error: Unexpected token )'
�[31m-�[39m   'onCodePathStart',
�[31m-�[39m   'onCodePathSegmentStart',
�[31m-�[39m   'onCodePathSegmentEnd',
�[31m-�[39m   'onCodePathEnd',
�[31m-�[39m   'onCodePathStart',
�[31m-�[39m   'onCodePathSegmentStart',
�[31m-�[39m   'onCodePathSegmentEnd',
�[31m-�[39m   'onCodePathEnd',
�[31m-�[39m   'onCodePathStart',
�[31m-�[39m   'onCodePathSegmentStart',
�[31m-�[39m   'onCodePathSegmentEnd',
�[31m-�[39m   'onCodePathEnd',
�[31m-�[39m   'onCodePathSegmentLoop',
�[31m-�[39m   'onCodePathSegmentEnd',
�[31m-�[39m   'onCodePathSegmentStart',
�[31m-�[39m   'onCodePathSegmentEnd',
�[31m-�[39m   'onCodePathSegmentStart',
�[31m-�[39m   'onCodePathSegmentEnd',
�[31m-�[39m   'onCodePathSegmentStart',
�[31m-�[39m   'onCodePathSegmentLoop',
�[31m-�[39m   'onCodePathSegmentEnd',
�[31m-�[39m   'onCodePathSegmentStart'
�[39m  ]

      + expected - actual

       [
      -  "Parsing error: Unexpected token )"
      +  "onCodePathStart"
      +  "onCodePathSegmentStart"
      +  "onCodePathSegmentEnd"
      +  "onCodePathEnd"
      +  "onCodePathStart"
      +  "onCodePathSegmentStart"
      +  "onCodePathSegmentEnd"
      +  "onCodePathEnd"
      +  "onCodePathStart"
      +  "onCodePathSegmentStart"
      +  "onCodePathSegmentEnd"
      +  "onCodePathEnd"
      +  "onCodePathSegmentLoop"
      +  "onCodePathSegmentEnd"
      +  "onCodePathSegmentStart"
      +  "onCodePathSegmentEnd"
      +  "onCodePathSegmentStart"
      +  "onCodePathSegmentEnd"
      +  "onCodePathSegmentStart"
      +  "onCodePathSegmentLoop"
      +  "onCodePathSegmentEnd"
      +  "onCodePathSegmentStart"
       ]
      
      at Context.<anonymous> (.../rewrite/packages/compat/tests/fixup-rules.js:467:12)
      at process.processImmediate (node:internal/timers:505:21)

  8) @eslint/backcompat
       fixupRule()
         should create a rule where context.getAncestors() returns the same value as sourceCode.getAncestors(node) in visitor methods:

      AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
�[32m+ actual�[39m �[31m- expected�[39m

�[39m  [
�[32m+�[39m   'Parsing error: Unexpected token )'
�[31m-�[39m   'Program',
�[31m-�[39m   'Identifier',
�[31m-�[39m   'ArrowFunctionExpression',
�[31m-�[39m   'FunctionDeclaration',
�[31m-�[39m   'Identifier'
�[39m  ]

      + expected - actual

       [
      -  "Parsing error: Unexpected token )"
      +  "Program"
      +  "Identifier"
      +  "ArrowFunctionExpression"
      +  "FunctionDeclaration"
      +  "Identifier"
       ]
      
      at Context.<anonymous> (.../rewrite/packages/compat/tests/fixup-rules.js:387:12)
      at process.processImmediate (node:internal/timers:505:21)

  9) @eslint/backcompat
       fixupRule()
         should create a rule where context.getAncestors() returns the same value as sourceCode.getAncestors(node) in code path methods:

      AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
�[32m+ actual�[39m �[31m- expected�[39m

�[39m  [
�[32m+�[39m   'Parsing error: Unexpected token )'
�[31m-�[39m   'onCodePathStart',
�[31m-�[39m   'onCodePathSegmentStart',
�[31m-�[39m   'onCodePathSegmentEnd',
�[31m-�[39m   'onCodePathEnd',
�[31m-�[39m   'onCodePathStart',
�[31m-�[39m   'onCodePathSegmentStart',
�[31m-�[39m   'onCodePathSegmentEnd',
�[31m-�[39m   'onCodePathEnd',
�[31m-�[39m   'onCodePathStart',
�[31m-�[39m   'onCodePathSegmentStart',
�[31m-�[39m   'onCodePathSegmentEnd',
�[31m-�[39m   'onCodePathEnd',
�[31m-�[39m   'onCodePathSegmentLoop',
�[31m-�[39m   'onCodePathSegmentEnd',
�[31m-�[39m   'onCodePathSegmentStart',
�[31m-�[39m   'onCodePathSegmentEnd',
�[31m-�[39m   'onCodePathSegmentStart',
�[31m-�[39m   'onCodePathSegmentEnd',
�[31m-�[39m   'onCodePathSegmentStart',
�[31m-�[39m   'onCodePathSegmentLoop',
�[31m-�[39m   'onCodePathSegmentEnd',
�[31m-�[39m   'onCodePathSegmentStart'
�[39m  ]

      + expected - actual

       [
      -  "Parsing error: Unexpected token )"
      +  "onCodePathStart"
      +  "onCodePathSegmentStart"
      +  "onCodePathSegmentEnd"
      +  "onCodePathEnd"
      +  "onCodePathStart"
      +  "onCodePathSegmentStart"
      +  "onCodePathSegmentEnd"
      +  "onCodePathEnd"
      +  "onCodePathStart"
      +  "onCodePathSegmentStart"
      +  "onCodePathSegmentEnd"
      +  "onCodePathEnd"
      +  "onCodePathSegmentLoop"
      +  "onCodePathSegmentEnd"
      +  "onCodePathSegmentStart"
      +  "onCodePathSegmentEnd"
      +  "onCodePathSegmentStart"
      +  "onCodePathSegmentEnd"
      +  "onCodePathSegmentStart"
      +  "onCodePathSegmentLoop"
      +  "onCodePathSegmentEnd"
      +  "onCodePathSegmentStart"
       ]
      
      at Context.<anonymous> (.../rewrite/packages/compat/tests/fixup-rules.js:467:12)
      at process.processImmediate (node:internal/timers:505:21)

  10) @eslint/backcompat
       fixupPluginRules()
         should create a plugin where context.getScope() returns the same value as sourceCode.getScope(node):

      AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
�[32m+ actual�[39m �[31m- expected�[39m

�[39m  [
�[32m+�[39m   'Parsing error: Unexpected token )'
�[31m-�[39m   'Program',
�[31m-�[39m   'Identifier',
�[31m-�[39m   'ArrowFunctionExpression',
�[31m-�[39m   'FunctionDeclaration',
�[31m-�[39m   'Identifier'
�[39m  ]

      + expected - actual

       [
      -  "Parsing error: Unexpected token )"
      +  "Program"
      +  "Identifier"
      +  "ArrowFunctionExpression"
      +  "FunctionDeclaration"
      +  "Identifier"
       ]
      
      at Context.<anonymous> (.../rewrite/packages/compat/tests/fixup-rules.js:692:12)
      at process.processImmediate (node:internal/timers:505:21)

  11) @eslint/backcompat
       fixupPluginRules()
         should create a plugin where context.getAncestors() returns the same value as sourceCode.getAncestors(node):

      AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
�[32m+ actual�[39m �[31m- expected�[39m

�[39m  [
�[32m+�[39m   'Parsing error: Unexpected token )'
�[31m-�[39m   'Program',
�[31m-�[39m   'Identifier',
�[31m-�[39m   'ArrowFunctionExpression',
�[31m-�[39m   'FunctionDeclaration',
�[31m-�[39m   'Identifier'
�[39m  ]

      + expected - actual

       [
      -  "Parsing error: Unexpected token )"
      +  "Program"
      +  "Identifier"
      +  "ArrowFunctionExpression"
      +  "FunctionDeclaration"
      +  "Identifier"
       ]
      
      at Context.<anonymous> (.../rewrite/packages/compat/tests/fixup-rules.js:692:12)
      at process.processImmediate (node:internal/timers:505:21)

  12) @eslint/backcompat
       fixupConfigRules()
         should create a configuration where context.getScope() returns the same value as sourceCode.getScope(node):

      AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
�[32m+ actual�[39m �[31m- expected�[39m

�[39m  [
�[32m+�[39m   'Parsing error: Unexpected token )'
�[31m-�[39m   'Program',
�[31m-�[39m   'Identifier',
�[31m-�[39m   'ArrowFunctionExpression',
�[31m-�[39m   'FunctionDeclaration',
�[31m-�[39m   'Identifier'
�[39m  ]

      + expected - actual

       [
      -  "Parsing error: Unexpected token )"
      +  "Program"
      +  "Identifier"
      +  "ArrowFunctionExpression"
      +  "FunctionDeclaration"
      +  "Identifier"
       ]
      
      at Context.<anonymous> (.../rewrite/packages/compat/tests/fixup-rules.js:825:12)
      at process.processImmediate (node:internal/timers:505:21)

  13) @eslint/backcompat
       fixupConfigRules()
         should create a configuration where context.getAncestors() returns the same value as sourceCode.getAncestors(node):

      AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
�[32m+ actual�[39m �[31m- expected�[39m

�[39m  [
�[32m+�[39m   'Parsing error: Unexpected token )'
�[31m-�[39m   'Program',
�[31m-�[39m   'Identifier',
�[31m-�[39m   'ArrowFunctionExpression',
�[31m-�[39m   'FunctionDeclaration',
�[31m-�[39m   'Identifier'
�[39m  ]

      + expected - actual

       [
      -  "Parsing error: Unexpected token )"
      +  "Program"
      +  "Identifier"
      +  "ArrowFunctionExpression"
      +  "FunctionDeclaration"
      +  "Identifier"
       ]
      
      at Context.<anonymous> (.../rewrite/packages/compat/tests/fixup-rules.js:825:12)
      at process.processImmediate (node:internal/timers:505:21)

On the other hand, I think the intent of this pull request is not to add compatibility with ESLint v8 (which would be a new feature), but rather to allow installing the package alongside an old version of ESLint. In that case, the test failures should be probably irrelevant.

@nzakas
Copy link
Member

nzakas commented Jun 9, 2025

@kellyselden you've lost me. There's no plan for a v2 so I don't know what you're asking.

@nzakas
Copy link
Member

nzakas commented Jun 9, 2025

@fasttime I took a look at the tests and the failures are just because ESLint v8 defaults to eslintrc while ESLint v9 defaults to flat config. If I change the tests to explicitly pass configType: "flat" into the Linter constructor then everything passes.

@fasttime
Copy link
Member

fasttime commented Jun 10, 2025

@fasttime I took a look at the tests and the failures are just because ESLint v8 defaults to eslintrc while ESLint v9 defaults to flat config. If I change the tests to explicitly pass configType: "flat" into the Linter constructor then everything passes.

You're right! I can see the tests passing with ESLint versions down to v8.40.0 if configType: "flat" is added to the Linter constructor options. @nzakas What do you recommend? I think if the tests are updated we could as well say that this package supports ESLint v8.

@nzakas
Copy link
Member

nzakas commented Jun 10, 2025

I'm not sure it's helpful to update the tests as we're not running them with ESLint v8, and anyone using ESLint v8 would necessarily be using flat config with this package.

@nzakas
Copy link
Member

nzakas commented Jun 18, 2025

ping @fasttime

@fasttime
Copy link
Member

I don't feel strongly about the peer dependency. Maybe the version range should be stricter, e.g. "^8.40 | 9" because ESLint versions before v8.40.0 lack some of the properties on the rule context required by @eslint/compat to fix up rules.

@fasttime
Copy link
Member

On closer look, if the tests are updated to use context.getSourceCode() instead of context.source then even ESLint v8.40.0 passes the tests. But there are still problems with older versions. For example ESLint v8.37.0 does not expose sourceCode.getDeclaredVariables(), and since this method is not fixed up, some tests are failing. This means that if a fixed-up rule calls sourceCode.getDeclaredVariables() in ESLint 8v.37.0, that won't work well either, I guess.

I'm not sure at this point what lower bound for the eslint peer dependency should be enforced, if any, given that ESLint v8 is EOL.

@nzakas
Copy link
Member

nzakas commented Jun 19, 2025

Then let's set the lower bound at v8.40.0?

@kellyselden kellyselden force-pushed the compat_peerDependencies branch from 98202b3 to 0118a99 Compare June 19, 2025 18:56
@kellyselden
Copy link
Contributor Author

Updated to 8.40 minimum.

@@ -56,7 +56,7 @@
"typescript": "^5.4.5"
},
"peerDependencies": {
"eslint": "^9.10.0"
"eslint": "8.40 | 9"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minimum version 8.40 makes sense, but I think there should be a caret before 8.40 to allow installing ESLint versions v8.41.0-v8.57.1, i.e. where the minor version number is higher than 40. See https://github.com/npm/node-semver?tab=readme-ov-file#caret-ranges-123-025-004. The logical or is written with a double pipe (||).

Suggested change
"eslint": "8.40 | 9"
"eslint": "^8.40 || 9"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Fixed.

@kellyselden kellyselden force-pushed the compat_peerDependencies branch from 0118a99 to 30f5884 Compare June 20, 2025 14:00
Updated to the suggestion in eslint#106 (comment). This was a breaking change, causing a refresh of our lockfile to generate the following error:

```
 ERR_PNPM_PEER_DEP_ISSUES  Unmet peer dependencies

XXX
└─┬ @eslint/compat 1.2.9
  └── ✕ unmet peer eslint@^9.10.0: found 8.57.0
```

This resolves the breaking change, since I believe @eslint/compat was introduced during the v8 eslint cycle and we don't need to go lower.
@kellyselden kellyselden force-pushed the compat_peerDependencies branch from 30f5884 to 6d9c1e3 Compare June 20, 2025 14:03
Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Would like @fasttime to review before merging.

@nzakas nzakas moved this from Triaging to Second Review Needed in Triage Jun 20, 2025
Copy link
Member

@fasttime fasttime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@fasttime fasttime merged commit b96ec0c into eslint:main Jun 21, 2025
21 checks passed
@github-project-automation github-project-automation bot moved this from Second Review Needed to Complete in Triage Jun 21, 2025
@github-actions github-actions bot mentioned this pull request Jun 21, 2025
@kellyselden kellyselden deleted the compat_peerDependencies branch June 21, 2025 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted bug Something isn't working
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy