fix: relax @eslint/compat eslint peerDependencies constraint by kellyselden · Pull Request #215 · eslint/rewrite (original) (raw)


> @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)