sheerun / prettier-standard

Formats with Prettier and lints with ESLint+Standard! (✿◠‿◠)
MIT License
868 stars 44 forks source link

[bug] Configuration for rule XXX is invalid #72

Closed DoubleU23 closed 5 years ago

DoubleU23 commented 5 years ago

problem

"prettier-standard" throws Error, parsing some of my EsLint rules

full error message ``` prettier-eslint [ERROR]: There was trouble creating the ESLint CLIEngine. prettier-standard [ERROR]: There was an error formatting "./utils/testImportExtraneousDeps.js": Error: CLI: Configuration for rule "one-var" is invalid: Value {"initialized":"never","const":"never","var":"consecutive","let":"consecutive","separateRequires":true} should be equal to one of the allowed values. Value {"initialized":"never","const":"never","var":"consecutive","let":"consecutive","separateRequires":true} should NOT have additional properties. Value {"initialized":"never","const":"never","var":"consecutive","let":"consecutive","separateRequires":true} should NOT have additional properties. Value {"initialized":"never","const":"never","var":"consecutive","let":"consecutive","separateRequires":true} should match exactly one schema in oneOf. at Object.validateRuleOptions (/var/www/html/tools/logger/node_modules/eslint/lib/config/config-validator.js:133:19) at CLIEngine.Object.keys.forEach.name (/var/www/html/tools/logger/node_modules/eslint/lib/cli-engine.js:458:27) at Array.forEach () at new CLIEngine (/var/www/html/tools/logger/node_modules/eslint/lib/cli-engine.js:457:45) at getESLintCLIEngine (/var/www/html/tools/logger/node_modules/prettier-eslint/dist/utils.js:446:12) at eslintFix (/var/www/html/tools/logger/node_modules/prettier-eslint/dist/index.js:180:51) at format (/var/www/html/tools/logger/node_modules/prettier-eslint/dist/index.js:149:10) at MapSubscriber.project (/var/www/html/tools/logger/node_modules/prettier-standard/src/format-files.js:217:26) at MapSubscriber._next (/var/www/html/tools/logger/node_modules/rxjs/operators/map.js:79:35) at MapSubscriber.Subscriber.next (/var/www/html/tools/logger/node_modules/rxjs/Subscriber.js:93:18) failure formatting 1 file with prettier-standard ```

(my) rules affected so far:

one-var ``` "one-var": ["error", { "const": "never", "var": "consecutive", "let": "consecutive", "separateRequires": true }], ```
key-spacing ``` "key-spacing": ["error", { // "mode": "minimum", "multiLine": { "beforeColon": false, "afterColon": true }, "align": { "on": "value" } }], ```

my env

eslint@5.9.0
babel-eslint@10.0.1 prettier@1.15 prettier-eslint@8.8.2 (requires eslint@4.19.1) prettier-standard@8.0.1 (requires eslint@^4.7.2 and prettier@1.9.x)

ideas

BTW: shouldn't eslint already be dep-required by "prettier-eslint"?
maybe you should add it as peerDependecy?

it's probably 'caused by a versions-mismatch of eslint/pretty?
waiting for #60 to be merged

additional information

"prettier-eslint(-cli)" doesn't have problems with that rules

sheerun commented 5 years ago

prettier-standard 9.0.0 has been released that respects only .prettierrc config and ignores .eslintrc. It is because prettier-standard 9 no longer passes code though eslint --fix, instead it relies on just prettierx (fork of prettier) for formatting