prettier/prettier-eslint

prettier-eslint fails due to an eslint config error; eslint works if called directly. Typescript overrides issue?

Sweater-Baron opened this issue · 1 comments

Versions:

  • prettier-eslint version: 15.0.1
  • node version: v14.20.0
  • npm (or yarn) version: 8.15.1

Have you followed the debugging tips?

Yes

Relevant code or config

I made a repo to reproduce this with: https://github.com/Sweater-Baron/prettier-eslint-dot-notation-bug-repro/

The failure no longer happens if I remove airbnb eslint stuff.

What I did:

Ran prettier-eslint on a .js file

What happened:
Running eslint directly, it works fine with no errors. Running prettier-eslint, it fails due to an eslint error.

Command line output:

alex ~/prettier-eslint-bug [main] $ npx eslint example.js
alex ~/prettier-eslint-bug [main] $ npx prettier-eslint example.js
prettier-eslint [ERROR]: eslint fix failed due to an eslint error
prettier-eslint-cli [ERROR]: There was an error formatting "/Users/alex/prettier-eslint-bug/example.js":
    Error: CLIOptions:
    	Configuration for rule "dot-notation" is invalid:
    	Value {"allowKeywords":true,"allowPattern":"","allowPrivateClassPropertyAccess":false,"allowProtectedClassPropertyAccess":false,"allowIndexSignaturePropertyAccess":false} should NOT have additional properties.

        at ConfigValidator.validateRuleOptions (/Users/alex/prettier-eslint-bug/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2027:23)
        at /Users/alex/prettier-eslint-bug/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2082:18
        at Array.forEach (<anonymous>)
        at ConfigValidator.validateRules (/Users/alex/prettier-eslint-bug/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2079:34)
        at ConfigValidator.validateConfigArray (/Users/alex/prettier-eslint-bug/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2205:18)
        at CascadingConfigArrayFactory._finalizeConfigArray (/Users/alex/prettier-eslint-bug/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3962:23)
        at CascadingConfigArrayFactory.getConfigArrayForFile (/Users/alex/prettier-eslint-bug/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3768:21)
        at CLIEngine.isPathIgnored (/Users/alex/prettier-eslint-bug/node_modules/eslint/lib/cli-engine/cli-engine.js:989:18)
        at CLIEngine.executeOnText (/Users/alex/prettier-eslint-bug/node_modules/eslint/lib/cli-engine/cli-engine.js:899:38)
        at ESLint.lintText (/Users/alex/prettier-eslint-bug/node_modules/eslint/lib/eslint/eslint.js:593:23)
failure formatting 1 file with prettier-eslint

Reproduction repository:

https://github.com/Sweater-Baron/prettier-eslint-dot-notation-bug-repro/

Problem description:

This seems to be an interaction between Typescript-specific eslint config overrides, prettier-eslint, and the airbnb eslint rules. As far as I can tell, some Typescript-specific configuration for "dot-notation" is leaking out of the overrides that I've set up for .ts and .tsx files, and affecting regular .js files. The configuration of "dot-notation" that's present in my ts overrides does not seem to be valid for the pure js version of that rule, so causes an error.

Suggested solution:

I wish I knew.

Stale issue