eslint-config-prettier
Advanced tools
Comparing version 6.10.0 to 6.10.1
@@ -16,4 +16,4 @@ "use strict"; | ||
"@typescript-eslint/space-before-function-paren": "off", | ||
"@typescript-eslint/type-annotation-spacing": "off" | ||
} | ||
"@typescript-eslint/type-annotation-spacing": "off", | ||
}, | ||
}; |
@@ -8,4 +8,4 @@ "use strict"; | ||
"babel/object-curly-spacing": "off", | ||
"babel/semi": "off" | ||
} | ||
"babel/semi": "off", | ||
}, | ||
}; |
@@ -20,4 +20,4 @@ #!/usr/bin/env node | ||
"", | ||
" eslint --print-config path/to/main.js | eslint-config-prettier-check", | ||
" eslint --print-config test/index.js | eslint-config-prettier-check", | ||
" npx eslint --print-config path/to/main.js | npx eslint-config-prettier-check", | ||
" npx eslint --print-config test/index.js | npx eslint-config-prettier-check", | ||
"", | ||
@@ -31,3 +31,3 @@ "Exit codes:", | ||
"For more information, see:", | ||
"https://github.com/prettier/eslint-config-prettier#cli-helper-tool" | ||
"https://github.com/prettier/eslint-config-prettier#cli-helper-tool", | ||
].join("\n") | ||
@@ -39,3 +39,3 @@ ); | ||
getStdin() | ||
.then(string => { | ||
.then((string) => { | ||
const result = processString(string); | ||
@@ -50,3 +50,3 @@ if (result.stderr) { | ||
}) | ||
.catch(error => { | ||
.catch((error) => { | ||
console.error("Unexpected error", error); | ||
@@ -64,3 +64,3 @@ process.exit(1); | ||
stderr: `Failed to parse JSON:\n${error.message}`, | ||
code: 1 | ||
code: 1, | ||
}; | ||
@@ -77,3 +77,3 @@ } | ||
stderr: `Expected a \`{"rules: {...}"}\` JSON object, but got:\n${string}`, | ||
code: 1 | ||
code: 1, | ||
}; | ||
@@ -89,4 +89,4 @@ } | ||
.readdirSync(path.join(__dirname, "..")) | ||
.filter(name => !name.startsWith(".") && name.endsWith(".js")) | ||
.map(ruleFileName => require(`../${ruleFileName}`).rules) | ||
.filter((name) => !name.startsWith(".") && name.endsWith(".js")) | ||
.map((ruleFileName) => require(`../${ruleFileName}`).rules) | ||
); | ||
@@ -108,3 +108,3 @@ | ||
const flaggedRules = Object.keys(config.rules) | ||
.map(ruleName => { | ||
.map((ruleName) => { | ||
const value = config.rules[ruleName]; | ||
@@ -121,3 +121,3 @@ const arrayValue = Array.isArray(value) ? value : [value]; | ||
flaggedRules, | ||
ruleName => ruleName in regularRules | ||
(ruleName) => ruleName in regularRules | ||
); | ||
@@ -131,3 +131,3 @@ const optionsFlaggedRuleNames = filterRuleNames( | ||
flaggedRules, | ||
ruleName => ruleName in specialRules | ||
(ruleName) => ruleName in specialRules | ||
); | ||
@@ -151,3 +151,3 @@ | ||
"", | ||
printRuleNames(specialFlaggedRuleNames) | ||
printRuleNames(specialFlaggedRuleNames), | ||
].join("\n"); | ||
@@ -157,3 +157,3 @@ | ||
stdout: message, | ||
code: 0 | ||
code: 0, | ||
}; | ||
@@ -165,3 +165,3 @@ } | ||
"", | ||
printRuleNames(regularFlaggedRuleNames) | ||
printRuleNames(regularFlaggedRuleNames), | ||
].join("\n"); | ||
@@ -173,3 +173,3 @@ | ||
"", | ||
printRuleNames(optionsFlaggedRuleNames) | ||
printRuleNames(optionsFlaggedRuleNames), | ||
].join("\n"); | ||
@@ -181,3 +181,3 @@ | ||
"", | ||
printRuleNames(specialFlaggedRuleNames) | ||
printRuleNames(specialFlaggedRuleNames), | ||
].join("\n"); | ||
@@ -188,3 +188,3 @@ | ||
optionsFlaggedRuleNames.length === 0 ? null : optionsMessage, | ||
specialFlaggedRuleNames.length === 0 ? null : specialMessage | ||
specialFlaggedRuleNames.length === 0 ? null : specialMessage, | ||
] | ||
@@ -196,3 +196,3 @@ .filter(Boolean) | ||
stdout: message, | ||
code: 2 | ||
code: 2, | ||
}; | ||
@@ -203,3 +203,3 @@ } | ||
return Object.keys(rules) | ||
.filter(ruleName => fn(ruleName, rules[ruleName])) | ||
.filter((ruleName) => fn(ruleName, rules[ruleName])) | ||
.reduce((obj, ruleName) => { | ||
@@ -213,4 +213,4 @@ obj[ruleName] = true; | ||
return rules | ||
.filter(rule => fn(rule.ruleName, rule.options)) | ||
.map(rule => rule.ruleName); | ||
.filter((rule) => fn(rule.ruleName, rule.options)) | ||
.map((rule) => rule.ruleName); | ||
} | ||
@@ -222,3 +222,3 @@ | ||
.sort() | ||
.map(ruleName => `- ${ruleName}`) | ||
.map((ruleName) => `- ${ruleName}`) | ||
.join("\n"); | ||
@@ -225,0 +225,0 @@ } |
@@ -53,3 +53,3 @@ "use strict"; | ||
); | ||
} | ||
}, | ||
}; |
175
CHANGELOG.md
@@ -0,5 +1,9 @@ | ||
### Version 6.10.1 (2020-03-22) | ||
- Improved: Recommend using `npx` when running the CLI helper tool. | ||
- Updated: Mention that eslint-config-prettier has been tested with Prettier 2.0 and the latest versions of plugins. | ||
### Version 6.10.0 (2020-01-28) | ||
- Added: [@typescript-eslint/comma-spacing]. Thanks to Thanks to Masafumi | ||
Koba (@ybiquitous)!! | ||
- Added: [@typescript-eslint/comma-spacing]. Thanks to Thanks to Masafumi Koba (@ybiquitous)!! | ||
@@ -16,44 +20,33 @@ ### Version 6.9.0 (2019-12-27) | ||
- Added: [@typescript-eslint/space-before-function-paren]. Thanks to Masafumi | ||
Koba (@ybiquitous)! | ||
- Added: [@typescript-eslint/space-before-function-paren]. Thanks to Masafumi Koba (@ybiquitous)! | ||
### Version 6.6.0 (2019-11-17) | ||
- Added: New [eslint-plugin-vue] rules: [vue/dot-location] and | ||
[vue/keyword-spacing]. Thanks to @xcatliu! | ||
- Added: New [eslint-plugin-vue] rules: [vue/dot-location] and [vue/keyword-spacing]. Thanks to @xcatliu! | ||
### Version 6.5.0 (2019-10-26) | ||
- Added: Support for [excluding deprecated rules]. Thanks to Alex Ilyaev | ||
(@alexilyaev)! | ||
- Added: Support for [excluding deprecated rules]. Thanks to Alex Ilyaev (@alexilyaev)! | ||
### Version 6.4.0 (2019-10-05) | ||
- Added: [unicorn/no-nested-ternary]. Thanks to Yang Mingshan | ||
(@yangmingshan)! | ||
- Added: [unicorn/no-nested-ternary]. Thanks to Yang Mingshan (@yangmingshan)! | ||
### Version 6.3.0 (2019-09-10) | ||
- Added: [@typescript-eslint/brace-style]. Thanks to Masafumi Koba | ||
(@ybiquitous)! | ||
- Added: [@typescript-eslint/brace-style]. Thanks to Masafumi Koba (@ybiquitous)! | ||
### Version 6.2.0 (2019-09-03) | ||
- Added: [@typescript-eslint/quotes] (as a [special | ||
rule][@typescript-eslint/quotes-special]). Thanks to Masafumi Koba | ||
(@ybiquitous)! | ||
- Added: [@typescript-eslint/quotes] (as a [special rule][@typescript-eslint/quotes-special]). Thanks to Masafumi Koba (@ybiquitous)! | ||
### Version 6.1.0 (2019-08-19) | ||
- Added: [function-call-argument-newline] \(new in ESLint 6.2.0). Thanks to | ||
Masafumi Koba (@ybiquitous)! | ||
- Added: [function-call-argument-newline] \(new in ESLint 6.2.0). Thanks to Masafumi Koba (@ybiquitous)! | ||
### Version 6.0.0 (2019-06-25) | ||
- Changed: The CLI helper tool now considers [no-confusing-arrow] to conflict | ||
if you use the default value of its `allowParens` option. The default was | ||
changed to `true` in ESLint 6, which conflicts with Prettier. | ||
- Changed: The CLI helper tool now considers [no-confusing-arrow] to conflict if you use the default value of its `allowParens` option. The default was changed to `true` in ESLint 6, which conflicts with Prettier. | ||
If the CLI helper tool gives you errors about this after upgrading, the | ||
solution is to change this: | ||
If the CLI helper tool gives you errors about this after upgrading, the solution is to change this: | ||
@@ -80,6 +73,3 @@ ```json | ||
- Improved: `eslint --print-config` usage instructions. The CLI tool help | ||
text as well as the documentation has been updated to suggest commands that | ||
work in ESLint 6.0 as well as in ESLint 5 and older. (Instead of `eslint | ||
--print-config .`, use `eslint --print-config path/to/main.js`.) | ||
- Improved: `eslint --print-config` usage instructions. The CLI tool help text as well as the documentation has been updated to suggest commands that work in ESLint 6.0 as well as in ESLint 5 and older. (Instead of `eslint --print-config .`, use `eslint --print-config path/to/main.js`.) | ||
@@ -92,34 +82,21 @@ ### Version 5.1.0 (2019-06-25) | ||
- Removed: [react/self-closing-comp]. This rule was added in v4.1.0 not | ||
because it _conflicted_ with Prettier but because it was _unnecessary_ when | ||
using Prettier. However, in v1.18.0 [Prettier stopped converting empty | ||
elements to self-closing elements][prettier-self-closing]. So the rule is | ||
not unnecessary anymore. | ||
- Removed: [react/self-closing-comp]. This rule was added in v4.1.0 not because it _conflicted_ with Prettier but because it was _unnecessary_ when using Prettier. However, in v1.18.0 [Prettier stopped converting empty elements to self-closing elements][prettier-self-closing]. So the rule is not unnecessary anymore. | ||
If you use Prettier v1.17.1 or older you should be able to upgrade | ||
eslint-config-prettier to v5.0.0 without having to do anything else. | ||
If you use Prettier v1.17.1 or older you should be able to upgrade eslint-config-prettier to v5.0.0 without having to do anything else. | ||
If you use Prettier v1.18.0 or newer, you might get lint errors about for | ||
example changing `<div></div>` into `<div />`. You have two options: | ||
If you use Prettier v1.18.0 or newer, you might get lint errors about for example changing `<div></div>` into `<div />`. You have two options: | ||
- Run `eslint --fix` if you prefer to enforce self-closing elements where | ||
possible. This should fix all the errors. | ||
- Add `"react/self-closing-comp": "off"` to your ESLint config if you use | ||
autofix from your editor and you face the same [issue as Prettier | ||
did][prettier-self-closing]. | ||
- Run `eslint --fix` if you prefer to enforce self-closing elements where possible. This should fix all the errors. | ||
- Add `"react/self-closing-comp": "off"` to your ESLint config if you use autofix from your editor and you face the same [issue as Prettier did][prettier-self-closing]. | ||
- Changed: Node.js 6 is no longer officially supported, but v5.0.0 should | ||
still work with it. | ||
- Changed: Node.js 6 is no longer officially supported, but v5.0.0 should still work with it. | ||
### Version 4.3.0 (2019-05-16) | ||
- Added: New [eslint-plugin-vue] rules: [vue/arrow-spacing], | ||
[vue/block-spacing], [vue/brace-style] and [vue/comma-dangle]. | ||
- Added: New [@typescript-eslint/eslint-plugin] rules: | ||
[@typescript-eslint/func-call-spacing] and [@typescript-eslint/semi]. | ||
- Added: New [eslint-plugin-vue] rules: [vue/arrow-spacing], [vue/block-spacing], [vue/brace-style] and [vue/comma-dangle]. | ||
- Added: New [@typescript-eslint/eslint-plugin] rules: [@typescript-eslint/func-call-spacing] and [@typescript-eslint/semi]. | ||
### Version 4.2.0 (2019-04-25) | ||
- Added: [@typescript-eslint/no-extra-parens]. Thanks to Keiichiro Amemiya | ||
(@Hoishin) and Jen Gorfine (@jgorfine)! | ||
- Added: [@typescript-eslint/no-extra-parens]. Thanks to Keiichiro Amemiya (@Hoishin) and Jen Gorfine (@jgorfine)! | ||
@@ -133,26 +110,12 @@ ### Version 4.1.0 (2019-02-26) | ||
- Breaking change: Support for [eslint-plugin-typescript] has been removed and | ||
replaced with support for its successor [@typescript-eslint/eslint-plugin]. | ||
Thanks to TANIGUCHI Masaya (@ta2gch) and everyone else who helped with this! | ||
- Changed: [arrow-body-style] and [prefer-arrow-callback] are now marked as | ||
[special rules][arrow-special], since they might cause problems if using | ||
[eslint-plugin-prettier] and `--fix`. They are turned off by default, and the | ||
CLI helper tool will _warn_ about them (but not error if you do enable them). | ||
This won’t break your linting checks, but do note that these rules will be | ||
disabled unless you explicitly enable them again, and that you might see new | ||
warnings when running the CLI helper tool. | ||
- Breaking change: Support for [eslint-plugin-typescript] has been removed and replaced with support for its successor [@typescript-eslint/eslint-plugin]. Thanks to TANIGUCHI Masaya (@ta2gch) and everyone else who helped with this! | ||
- Changed: [arrow-body-style] and [prefer-arrow-callback] are now marked as [special rules][arrow-special], since they might cause problems if using [eslint-plugin-prettier] and `--fix`. They are turned off by default, and the CLI helper tool will _warn_ about them (but not error if you do enable them). This won’t break your linting checks, but do note that these rules will be disabled unless you explicitly enable them again, and that you might see new warnings when running the CLI helper tool. | ||
### Version 3.6.0 (2019-01-19) | ||
- Added: Support for [eslint-plugin-babel]. Thanks to Matija Marohnić | ||
(@silvenon)! | ||
- Added: Support for [eslint-plugin-babel]. Thanks to Matija Marohnić (@silvenon)! | ||
### Version 3.5.0 (2019-01-16) | ||
- Fixed: The eslint-plugin-vue change from 3.4.0 has been reverted. That change | ||
requires eslint-plugin-vue@5, while many use eslint-plugin-vue@4. In other | ||
words, it was an accidental breaking change. Also, after thinking about it | ||
some more, it makes sense to have a Prettier-specific list of rules, rather | ||
than using the `vue/no-layout-rules` list, since there can be layout rules | ||
that don’t conflict with but rather complement Prettier. | ||
- Fixed: The eslint-plugin-vue change from 3.4.0 has been reverted. That change requires eslint-plugin-vue@5, while many use eslint-plugin-vue@4. In other words, it was an accidental breaking change. Also, after thinking about it some more, it makes sense to have a Prettier-specific list of rules, rather than using the `vue/no-layout-rules` list, since there can be layout rules that don’t conflict with but rather complement Prettier. | ||
- Added: New eslint-plugin-vue rules coming in the next version after 5.1.0. | ||
@@ -163,11 +126,7 @@ | ||
- Added: Support for [eslint-plugin-typescript]. Thanks to Jed Fox (@j-f1)! | ||
- Improved: The eslint-plugin-vue integration is now using the | ||
`vue/no-layout-rules` config behind the scenes, so it should automatically | ||
stay up-to-date when new eslint-plugin-vue versions are released. Thanks to | ||
Michał Sajnóg (@michalsnik)! | ||
- Improved: The eslint-plugin-vue integration is now using the `vue/no-layout-rules` config behind the scenes, so it should automatically stay up-to-date when new eslint-plugin-vue versions are released. Thanks to Michał Sajnóg (@michalsnik)! | ||
### Version 3.3.0 (2018-11-11) | ||
- Added: The [vue/html-self-closing] rule (as a [special | ||
rule][vue/html-self-closing-special]). Thanks to Yamagishi Kazutoshi (@ykzts)! | ||
- Added: The [vue/html-self-closing] rule (as a [special rule][vue/html-self-closing-special]). Thanks to Yamagishi Kazutoshi (@ykzts)! | ||
@@ -177,4 +136,3 @@ ### Version 3.2.0 (2018-11-10) | ||
- Added: Support for [eslint-plugin-vue]. | ||
- Fixed: The CLI helper tool should now work in Node.js 6 with npm 3 again. | ||
Thanks to Grant Snodgrass (@meeber)! | ||
- Fixed: The CLI helper tool should now work in Node.js 6 with npm 3 again. Thanks to Grant Snodgrass (@meeber)! | ||
- Improved: Updated documentation. | ||
@@ -185,6 +143,3 @@ | ||
- Added: Support for [eslint-plugin-unicorn]. Thanks to John Mars (@j0hnm4r5)! | ||
- Changed: The [quotes] rule is now allowed to be used to forbid unnecessary | ||
backticks. This means that the CLI helper tool no longer can automatically | ||
validate it, so you’ll need to refer the [quotes special rule | ||
documentation][quotes-special]. Thanks to Nick Petruzzelli (@npetruzzelli)! | ||
- Changed: The [quotes] rule is now allowed to be used to forbid unnecessary backticks. This means that the CLI helper tool no longer can automatically validate it, so you’ll need to refer the [quotes special rule documentation][quotes-special]. Thanks to Nick Petruzzelli (@npetruzzelli)! | ||
@@ -215,8 +170,4 @@ ### Version 3.0.1 (2018-08-13) | ||
- Added: The [lines-around-comment] rule (as a [special | ||
rule][lines-around-comment-special]). Thanks to Maurice de Beijer | ||
(@mauricedb)! | ||
- Added: The [no-unexpected-multiline] rule (as a [special | ||
rule][no-unexpected-multiline-special]). Thanks to Suhas Karanth | ||
(@sudo-suhas)! | ||
- Added: The [lines-around-comment] rule (as a [special rule][lines-around-comment-special]). Thanks to Maurice de Beijer (@mauricedb)! | ||
- Added: The [no-unexpected-multiline] rule (as a [special rule][no-unexpected-multiline-special]). Thanks to Suhas Karanth (@sudo-suhas)! | ||
@@ -229,14 +180,11 @@ ### Version 2.6.0 (2017-09-23) | ||
- Added: Support for [eslint-plugin-standard]. Thanks to Christian Pekeler | ||
(@pekeler)! | ||
- Added: Support for [eslint-plugin-standard]. Thanks to Christian Pekeler (@pekeler)! | ||
### Version 2.4.0 (2017-09-02) | ||
- Added: The [function-paren-newline] rule (new in [ESLint 4.6.0]). Thanks to | ||
Pierre Vanduynslager (@vanduynslagerp)! | ||
- Added: The [function-paren-newline] rule (new in [ESLint 4.6.0]). Thanks to Pierre Vanduynslager (@vanduynslagerp)! | ||
### Version 2.3.0 (2017-06-30) | ||
- Added: The (deprecated) [indent-legacy] rule. Thanks to M. Ian Graham | ||
(@miangraham)! | ||
- Added: The (deprecated) [indent-legacy] rule. Thanks to M. Ian Graham (@miangraham)! | ||
@@ -258,4 +206,3 @@ ### Version 2.2.0 (2017-06-17) | ||
- Added: The [no-tabs] rule (as a [special rule][no-tabs-special]). Thanks to | ||
Alex Meah (@AlexMeah)! | ||
- Added: The [no-tabs] rule (as a [special rule][no-tabs-special]). Thanks to Alex Meah (@AlexMeah)! | ||
@@ -266,22 +213,13 @@ ### Version 2.0.0 (2017-05-07) | ||
- The options of special rules are now validated if possible. If a special | ||
rule is enabled with non-conflicting options, the CLI no longer warns about | ||
it. | ||
- If only special rules that cannot be automatically checked are found, the | ||
CLI no longer exists with a non-zero exit code. Instead, it only warns about | ||
the rules. | ||
- The options of special rules are now validated if possible. If a special rule is enabled with non-conflicting options, the CLI no longer warns about it. | ||
- If only special rules that cannot be automatically checked are found, the CLI no longer exists with a non-zero exit code. Instead, it only warns about the rules. | ||
- Changed: The [no-confusing-arrow] is now a special rule again, since it might | ||
conflict with recent Prettier versions. | ||
- Changed: The [no-confusing-arrow] is now a special rule again, since it might conflict with recent Prettier versions. | ||
- Removed: The `react/wrap-multilines` rule (which has been deprecated for a | ||
while), since it was removed in eslint-plugin-react@7. | ||
- Removed: The `react/wrap-multilines` rule (which has been deprecated for a while), since it was removed in eslint-plugin-react@7. | ||
### Version 1.7.0 (2017-04-19) | ||
- Changed: The [no-confusing-arrow] is no longer a special rule, but simply | ||
turned off, since recent Prettier versions make it redundant. | ||
- Improved: The CLI helper tool now has a more helpful message for special | ||
rules, and exits with a different status code if only special rules were | ||
found. The exit codes are now documented as well. | ||
- Changed: The [no-confusing-arrow] is no longer a special rule, but simply turned off, since recent Prettier versions make it redundant. | ||
- Improved: The CLI helper tool now has a more helpful message for special rules, and exits with a different status code if only special rules were found. The exit codes are now documented as well. | ||
@@ -298,22 +236,16 @@ ### Version 1.6.0 (2017-04-05) | ||
- Improved: eslint-config-prettier is now part of the [prettier] organization! | ||
This version updates all URLs to point to the new home of the project. | ||
- Improved: eslint-config-prettier is now part of the [prettier] organization! This version updates all URLs to point to the new home of the project. | ||
### Version 1.4.0 (2017-02-26) | ||
- Added: The [no-confusing-arrow] rule (as a | ||
[special rule][no-confusing-arrow-special]). Thanks to Dominik Ferber | ||
(@dferber90)! | ||
- Added: Deprecated or removed rules that might conflict with prettier. Thanks | ||
to Dominik Ferber (@dferber90)! | ||
- Added: The [no-confusing-arrow] rule (as a [special rule][no-confusing-arrow-special]). Thanks to Dominik Ferber (@dferber90)! | ||
- Added: Deprecated or removed rules that might conflict with prettier. Thanks to Dominik Ferber (@dferber90)! | ||
### Version 1.3.0 (2017-02-21) | ||
- Added: The [template-tag-spacing] rule. Thanks to Thibault Derousseaux | ||
(@tibdex)! | ||
- Added: The [template-tag-spacing] rule. Thanks to Thibault Derousseaux (@tibdex)! | ||
### Version 1.2.0 (2017-02-14) | ||
- Added: The [one-var-declaration-per-line] rule. Thanks to Ruben Oostinga | ||
(@0xR)! | ||
- Added: The [one-var-declaration-per-line] rule. Thanks to Ruben Oostinga (@0xR)! | ||
@@ -327,4 +259,3 @@ ### Version 1.1.1 (2017-02-12) | ||
- Fixed: The [eslint-plugin-react] exclusion rules now actually work. | ||
- Fixed: The CLI helper tool now works in Node.js 4. Thanks to Nathan Friedly | ||
(@nfriedly)! | ||
- Fixed: The CLI helper tool now works in Node.js 4. Thanks to Nathan Friedly (@nfriedly)! | ||
- Added: Support for [eslint-plugin-flowtype]. | ||
@@ -366,4 +297,4 @@ - Improved: Minor things for the CLI helper tool. | ||
[end-of-line]: https://prettier.io/docs/en/options.html#end-of-line | ||
[ESLint 4.0.0]: https://eslint.org/blog/2017/06/eslint-v4.0.0-released | ||
[ESLint 4.6.0]: https://eslint.org/blog/2017/09/eslint-v4.6.0-released | ||
[eslint 4.0.0]: https://eslint.org/blog/2017/06/eslint-v4.0.0-released | ||
[eslint 4.6.0]: https://eslint.org/blog/2017/09/eslint-v4.6.0-released | ||
[eslint-plugin-babel]: https://github.com/babel/eslint-plugin-babel | ||
@@ -370,0 +301,0 @@ [eslint-plugin-flowtype]: https://github.com/gajus/eslint-plugin-flowtype |
@@ -13,4 +13,4 @@ "use strict"; | ||
"flowtype/space-before-type-colon": "off", | ||
"flowtype/union-intersection-spacing": "off" | ||
} | ||
"flowtype/union-intersection-spacing": "off", | ||
}, | ||
}; |
@@ -92,3 +92,3 @@ "use strict"; | ||
"wrap-regex": "off", | ||
"yield-star-spacing": "off" | ||
"yield-star-spacing": "off", | ||
}, | ||
@@ -101,5 +101,5 @@ includeDeprecated && { | ||
// https://eslint.org/docs/rules/no-spaced-func | ||
"no-spaced-func": "off" | ||
"no-spaced-func": "off", | ||
} | ||
) | ||
), | ||
}; |
{ | ||
"name": "eslint-config-prettier", | ||
"version": "6.10.0", | ||
"version": "6.10.1", | ||
"license": "MIT", | ||
@@ -29,3 +29,4 @@ "author": "Simon Lydell", | ||
"doctoc": "doctoc README.md && replace \"\\[\\[([\\w/-]+)\\](?:([^\\[\\]]+)\\[([\\w/-]+)\\])?\\]\" \"[\\$1\\$2\\$3]\" README.md", | ||
"test:lint": "eslint .", | ||
"prettier": "prettier --write .", | ||
"test:lint": "eslint . && prettier --check .", | ||
"test:lint-verify-fail": "eslint \"test-lint/*.{js,ts,vue}\" --config .eslintrc.base.js --format json", | ||
@@ -43,6 +44,6 @@ "test:lint-rules": "eslint index.js --config test-config/.eslintrc.js --format json", | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "2.18.0", | ||
"@typescript-eslint/parser": "2.18.0", | ||
"babel-eslint": "10.0.3", | ||
"cross-spawn": "6.0.5", | ||
"@typescript-eslint/eslint-plugin": "2.24.0", | ||
"@typescript-eslint/parser": "2.24.0", | ||
"babel-eslint": "10.1.0", | ||
"cross-spawn": "7.0.1", | ||
"doctoc": "1.4.0", | ||
@@ -55,10 +56,10 @@ "eslint": "6.8.0", | ||
"eslint-plugin-prettier": "3.1.2", | ||
"eslint-plugin-react": "7.18.0", | ||
"eslint-plugin-react": "7.19.0", | ||
"eslint-plugin-standard": "4.0.1", | ||
"eslint-plugin-unicorn": "15.0.1", | ||
"eslint-plugin-vue": "6.1.2", | ||
"eslint-plugin-unicorn": "17.2.0", | ||
"eslint-plugin-vue": "6.2.2", | ||
"jest": "25.1.0", | ||
"prettier": "1.19.1", | ||
"prettier": "2.0.1", | ||
"replace": "1.1.5", | ||
"rimraf": "3.0.1", | ||
"rimraf": "3.0.2", | ||
"typescript": "3.7.5" | ||
@@ -65,0 +66,0 @@ }, |
@@ -21,3 +21,3 @@ "use strict"; | ||
"react/jsx-tag-spacing": "off", | ||
"react/jsx-wrap-multilines": "off" | ||
"react/jsx-wrap-multilines": "off", | ||
}, | ||
@@ -27,5 +27,5 @@ includeDeprecated && { | ||
// https://github.com/yannickcr/eslint-plugin-react/blob/master/CHANGELOG.md#700---2017-05-06 | ||
"react/jsx-space-before-closing": "off" | ||
"react/jsx-space-before-closing": "off", | ||
} | ||
) | ||
), | ||
}; |
326
README.md
@@ -1,10 +0,8 @@ | ||
# eslint-config-prettier [![Build Status][travis-badge]][travis] | ||
# eslint-config-prettier | ||
Turns off all rules that are unnecessary or might conflict with [Prettier]. | ||
This lets you use your favorite shareable config without letting its stylistic | ||
choices get in the way when using Prettier. | ||
This lets you use your favorite shareable config without letting its stylistic choices get in the way when using Prettier. | ||
Note that this config _only_ turns rules _off,_ so it only makes sense using | ||
it together with some other config. | ||
Note that this config _only_ turns rules _off,_ so it only makes sense using it together with some other config. | ||
@@ -16,3 +14,2 @@ ## Contents | ||
- [Installation](#installation) | ||
@@ -46,5 +43,2 @@ - [Excluding deprecated rules](#excluding-deprecated-rules) | ||
Tip: First, you might be interested in installing [eslint-plugin-prettier]. | ||
Follow the instructions over there. This is optional, though. | ||
Install eslint-config-prettier: | ||
@@ -56,6 +50,5 @@ | ||
Then, add eslint-config-prettier to the "extends" array in your `.eslintrc.*` | ||
file. Make sure to put it **last,** so it gets the chance to override other | ||
configs. | ||
Then, add eslint-config-prettier to the "extends" array in your `.eslintrc.*` file. Make sure to put it **last,** so it gets the chance to override other configs. | ||
<!-- prettier-ignore --> | ||
```json | ||
@@ -82,2 +75,3 @@ { | ||
<!-- prettier-ignore --> | ||
```json | ||
@@ -99,6 +93,5 @@ { | ||
If you extend a config which uses a plugin, it is recommended to add | ||
`"prettier/that-plugin"` (if available). For example, [eslint-config-airbnb] | ||
enables [eslint-plugin-react] rules, so `"prettier/react"` is needed: | ||
If you extend a config which uses a plugin, it is recommended to add `"prettier/that-plugin"` (if available). For example, [eslint-config-airbnb] enables [eslint-plugin-react] rules, so `"prettier/react"` is needed: | ||
<!-- prettier-ignore --> | ||
```json | ||
@@ -114,12 +107,7 @@ { | ||
If you’re unsure which plugins are used, you can usually find them in your | ||
`package.json`. | ||
If you’re unsure which plugins are used, you can usually find them in your `package.json`. | ||
### Excluding deprecated rules | ||
Some of the rules that eslint-config-prettier turns off may be deprecated. | ||
**This is perfectly fine,** but if you really need to omit the | ||
deprecated rules, you can do so by setting the | ||
`ESLINT_CONFIG_PRETTIER_NO_DEPRECATED` environment variable to a non-empty | ||
value. For example: | ||
Some of the rules that eslint-config-prettier turns off may be deprecated. **This is perfectly fine,** but if you really need to omit the deprecated rules, you can do so by setting the `ESLINT_CONFIG_PRETTIER_NO_DEPRECATED` environment variable to a non-empty value. For example: | ||
@@ -132,32 +120,18 @@ ``` | ||
eslint-config-prettier also ships with a little CLI tool to help you check if | ||
your configuration contains any rules that are unnecessary or conflict with | ||
Prettier. | ||
eslint-config-prettier also ships with a little CLI tool to help you check if your configuration contains any rules that are unnecessary or conflict with Prettier. | ||
First, add a script for it to package.json: | ||
You can run it using `npx`: | ||
```json | ||
{ | ||
"scripts": { | ||
"eslint-check": "eslint --print-config path/to/main.js | eslint-config-prettier-check" | ||
} | ||
} | ||
``` | ||
npx eslint --print-config path/to/main.js | npx eslint-config-prettier-check | ||
``` | ||
Then run `npm run eslint-check`. (Change `path/to/main.js` to a file that | ||
exists in your project.) | ||
(Change `path/to/main.js` to a file that exists in your project.) | ||
In theory you need to run `eslint --print-config file.js | | ||
eslint-config-prettier-check` for every single file in your project to be | ||
100% sure that there are no conflicting rules, because ESLint supports having | ||
different rules for different files. But usually you’ll have about the same | ||
rules for all files, so it is enough to run the command on one file (pick one | ||
that you won’t be moving). If you use [multiple configuration files] or | ||
[overrides], you can (but you probably don’t need to!) run the above script | ||
several times with different `--print-config` arguments, such as: | ||
In theory you need to run `npx eslint --print-config file.js | npx eslint-config-prettier-check` for every single file in your project to be 100% sure that there are no conflicting rules, because ESLint supports having different rules for different files. But usually you’ll have about the same rules for all files, so it is enough to run the command on one file (pick one that you won’t be moving). If you use [multiple configuration files] or [overrides], you can (but you probably don’t need to!) run the above script several times with different `--print-config` arguments, such as: | ||
``` | ||
eslint --print-config index.js | eslint-config-prettier-check | ||
eslint --print-config test/index.js | eslint-config-prettier-check | ||
eslint --print-config legacy/main.js | eslint-config-prettier-check | ||
npx eslint --print-config index.js | npx eslint-config-prettier-check | ||
npx eslint --print-config test/index.js | npx eslint-config-prettier-check | ||
npx eslint --print-config legacy/main.js | npx eslint-config-prettier-check | ||
``` | ||
@@ -173,2 +147,3 @@ | ||
<!-- prettier-ignore --> | ||
```json | ||
@@ -196,3 +171,2 @@ { | ||
"flowtype", | ||
"prettier", | ||
"react", | ||
@@ -212,5 +186,2 @@ "standard", | ||
"node": true | ||
}, | ||
"rules": { | ||
"prettier/prettier": "error" | ||
} | ||
@@ -222,13 +193,9 @@ } | ||
There a few rules that eslint-config-prettier disables that actually can be | ||
enabled in some cases. | ||
There a few rules that eslint-config-prettier disables that actually can be enabled in some cases. | ||
- Some require certain options. The CLI helper tool validates this. | ||
- Some require special attention when writing code. The CLI helper tool warns | ||
you if any of those rules are enabled, but can’t tell if anything is | ||
problematic. | ||
- Some require special attention when writing code. The CLI helper tool warns you if any of those rules are enabled, but can’t tell if anything is problematic. | ||
- Some can cause problems if using [eslint-plugin-prettier] and `--fix`. | ||
For maximum ease of use, the special rules are disabled by default. If you want | ||
them, you need to explicitly specify them in your ESLint config. | ||
For maximum ease of use, the special rules are disabled by default. If you want them, you need to explicitly specify them in your ESLint config. | ||
@@ -239,21 +206,12 @@ ### [arrow-body-style] and [prefer-arrow-callback] | ||
If you use any of these rules together with the `prettier/prettier` rule from | ||
[eslint-plugin-prettier], you can in some cases end up with invalid code due to | ||
a bug in ESLint’s autofix. | ||
If you use any of these rules together with the `prettier/prettier` rule from [eslint-plugin-prettier], you can in some cases end up with invalid code due to a bug in ESLint’s autofix. | ||
These rules are safe to use if: | ||
- You don’t use [eslint-plugin-prettier]. In other words, you run `eslint --fix` | ||
and `prettier --write` as separate steps. | ||
- You _do_ use [eslint-plugin-prettier], but don’t use `--fix`. (But then, | ||
what’s the point?) | ||
- You don’t use [eslint-plugin-prettier]. In other words, you run `eslint --fix` and `prettier --write` as separate steps. | ||
- You _do_ use [eslint-plugin-prettier], but don’t use `--fix`. (But then, what’s the point?) | ||
You _can_ still use these rules together with [eslint-plugin-prettier] if you | ||
want, because the bug does not occur _all the time._ But if you do, you need to | ||
keep in mind that you might end up with invalid code, where you manually have to | ||
insert a missing closing parenthesis to get going again. | ||
You _can_ still use these rules together with [eslint-plugin-prettier] if you want, because the bug does not occur _all the time._ But if you do, you need to keep in mind that you might end up with invalid code, where you manually have to insert a missing closing parenthesis to get going again. | ||
If you’re fixing large of amounts of previously unformatted code, consider | ||
temporarily disabling the `prettier/prettier` rule and running `eslint --fix` | ||
and `prettier --write` separately. | ||
If you’re fixing large of amounts of previously unformatted code, consider temporarily disabling the `prettier/prettier` rule and running `eslint --fix` and `prettier --write` separately. | ||
@@ -266,4 +224,3 @@ See these issues for more information: | ||
When the autofix bug in ESLint has been fixed, the special case for these rules | ||
can be removed. | ||
When the autofix bug in ESLint has been fixed, the special case for these rules can be removed. | ||
@@ -274,11 +231,9 @@ ### [curly] | ||
If a block (for example after `if`, `else`, `for` or `while`) contains only one | ||
statement, JavaScript allows omitting the curly braces around that statement. | ||
This rule enforces if or when those optional curly braces should be omitted. | ||
If a block (for example after `if`, `else`, `for` or `while`) contains only one statement, JavaScript allows omitting the curly braces around that statement. This rule enforces if or when those optional curly braces should be omitted. | ||
If you use the `"multi-line"` or `"multi-or-nest"` option, the rule can conflict | ||
with Prettier. | ||
If you use the `"multi-line"` or `"multi-or-nest"` option, the rule can conflict with Prettier. | ||
For example, the `"multi-line"` option allows this line: | ||
<!-- prettier-ignore --> | ||
```js | ||
@@ -288,5 +243,5 @@ if (cart.items && cart.items[0] && cart.items[0].quantity === 0) updateCart(cart); | ||
However, Prettier might consider the line too long and turn it into the | ||
following, which the `"multi-line"` option does _not_ allow: | ||
However, Prettier might consider the line too long and turn it into the following, which the `"multi-line"` option does _not_ allow: | ||
<!-- prettier-ignore --> | ||
```js | ||
@@ -297,7 +252,7 @@ if (cart.items && cart.items[0] && cart.items[0].quantity === 0) | ||
If you like this rule, it can be used just fine with Prettier as long as you | ||
don’t use the `"multi-line"` or `"multi-or-nest"` option. | ||
If you like this rule, it can be used just fine with Prettier as long as you don’t use the `"multi-line"` or `"multi-or-nest"` option. | ||
Example ESLint configuration: | ||
<!-- prettier-ignore --> | ||
```json | ||
@@ -315,12 +270,10 @@ { | ||
This rule requires empty lines before and/or after comments. Prettier preserves | ||
blank lines, with two exceptions: | ||
This rule requires empty lines before and/or after comments. Prettier preserves blank lines, with two exceptions: | ||
- Several blank lines in a row are collapsed into a single blank line. This is | ||
fine. | ||
- Blank lines at the beginning and end of blocks, objects and arrays are always | ||
removed. This may lead to conflicts. | ||
- Several blank lines in a row are collapsed into a single blank line. This is fine. | ||
- Blank lines at the beginning and end of blocks, objects and arrays are always removed. This may lead to conflicts. | ||
By default, ESLint requires a blank line above the comment is this case: | ||
<!-- prettier-ignore --> | ||
```js | ||
@@ -336,2 +289,3 @@ if (result) { | ||
<!-- prettier-ignore --> | ||
```js | ||
@@ -344,8 +298,7 @@ if (result) { | ||
If you like this rule, it can be used just fine with Prettier as long as you add | ||
some extra configuration to allow comments at the start and end of blocks, | ||
objects and arrays. | ||
If you like this rule, it can be used just fine with Prettier as long as you add some extra configuration to allow comments at the start and end of blocks, objects and arrays. | ||
Example ESLint configuration: | ||
<!-- prettier-ignore --> | ||
```json | ||
@@ -379,15 +332,11 @@ { | ||
Usually, Prettier takes care of following a maximum line length automatically. | ||
However, there are cases where Prettier can’t do anything, such as for long | ||
strings, regular expressions and comments. Those need to be split up by a human. | ||
Usually, Prettier takes care of following a maximum line length automatically. However, there are cases where Prettier can’t do anything, such as for long strings, regular expressions and comments. Those need to be split up by a human. | ||
If you’d like to enforce an even stricter maximum line length policy than | ||
Prettier can provide automatically, you can enable this rule. Just remember to | ||
keep `max-len`’s options and Prettier’s `printWidth` option in sync. | ||
If you’d like to enforce an even stricter maximum line length policy than Prettier can provide automatically, you can enable this rule. Just remember to keep `max-len`’s options and Prettier’s `printWidth` option in sync. | ||
Keep in mind that you might have to refactor code slightly if Prettier formats | ||
lines in a way that the `max-len` rule does not approve of. | ||
Keep in mind that you might have to refactor code slightly if Prettier formats lines in a way that the `max-len` rule does not approve of. | ||
Example ESLint configuration: | ||
<!-- prettier-ignore --> | ||
```json | ||
@@ -407,2 +356,3 @@ { | ||
<!-- prettier-ignore --> | ||
```js | ||
@@ -412,5 +362,5 @@ var x = a => 1 ? 2 : 3; | ||
With `{allowParens: true}` (the default since ESLint 6.0.0), adding | ||
parentheses is considered a valid way to avoid the arrow confusion: | ||
With `{allowParens: true}` (the default since ESLint 6.0.0), adding parentheses is considered a valid way to avoid the arrow confusion: | ||
<!-- prettier-ignore --> | ||
```js | ||
@@ -420,5 +370,5 @@ var x = a => (1 ? 2 : 3); | ||
While Prettier keeps those parentheses, it removes them if the line is long | ||
enough to introduce a line break: | ||
While Prettier keeps those parentheses, it removes them if the line is long enough to introduce a line break: | ||
<!-- prettier-ignore --> | ||
```js | ||
@@ -429,5 +379,5 @@ EnterpriseCalculator.prototype.calculateImportantNumbers = inputNumber => | ||
With `{allowParens: false}`, ESLint instead suggests switching to an explicit | ||
return: | ||
With `{allowParens: false}`, ESLint instead suggests switching to an explicit return: | ||
<!-- prettier-ignore --> | ||
```js | ||
@@ -439,7 +389,7 @@ var x = a => { return 1 ? 2 : 3; }; | ||
If you like this rule, it can be used just fine with Prettier as long as the | ||
`allowParens` option is off. | ||
If you like this rule, it can be used just fine with Prettier as long as the `allowParens` option is off. | ||
Example ESLint configuration: | ||
<!-- prettier-ignore --> | ||
```json | ||
@@ -453,8 +403,3 @@ { | ||
(Note: The CLI helper tool considers `{allowParens: true}` to be the default, | ||
which is the case since ESLint 6.0.0. The tool will produce a warning if you | ||
use the default even if you use an older version of ESLint. It doesn’t hurt | ||
to explicitly set `{allowParens: false}` even though it is technically | ||
redundant. This way you are prepared for a future ESLint upgrade and the CLI | ||
tool can be kept simple.) | ||
(Note: The CLI helper tool considers `{allowParens: true}` to be the default, which is the case since ESLint 6.0.0. The tool will produce a warning if you use the default even if you use an older version of ESLint. It doesn’t hurt to explicitly set `{allowParens: false}` even though it is technically redundant. This way you are prepared for a future ESLint upgrade and the CLI tool can be kept simple.) | ||
@@ -469,2 +414,3 @@ ### [no-mixed-operators] | ||
<!-- prettier-ignore --> | ||
```js | ||
@@ -476,2 +422,3 @@ var foo = a + b * c; | ||
<!-- prettier-ignore --> | ||
```js | ||
@@ -483,2 +430,3 @@ var foo = a + (b * c); | ||
<!-- prettier-ignore --> | ||
```js | ||
@@ -488,5 +436,5 @@ var foo = a + b * c; | ||
If you want to use this rule with Prettier, you need to split the expression | ||
into another variable: | ||
If you want to use this rule with Prettier, you need to split the expression into another variable: | ||
<!-- prettier-ignore --> | ||
```js | ||
@@ -499,2 +447,3 @@ var bar = b * c; | ||
<!-- prettier-ignore --> | ||
```js | ||
@@ -506,2 +455,3 @@ var foo = (a && b) || c; | ||
<!-- prettier-ignore --> | ||
```json | ||
@@ -519,7 +469,7 @@ { | ||
This rule disallows the use of tab characters at all. It can be used just fine | ||
with Prettier as long as you don’t configure Prettier to indent using tabs. | ||
This rule disallows the use of tab characters at all. It can be used just fine with Prettier as long as you don’t configure Prettier to indent using tabs. | ||
Example ESLint configuration: | ||
<!-- prettier-ignore --> | ||
```json | ||
@@ -533,5 +483,5 @@ { | ||
Example Prettier configuration (this is the default, so adding this is not | ||
required): | ||
Example Prettier configuration (this is the default, so adding this is not required): | ||
<!-- prettier-ignore --> | ||
```json | ||
@@ -543,5 +493,5 @@ { | ||
**Note:** Since [ESlint 5.7.0] this rule can be configured to work regardless of | ||
your Prettier configuration: | ||
**Note:** Since [ESlint 5.7.0] this rule can be configured to work regardless of your Prettier configuration: | ||
<!-- prettier-ignore --> | ||
```json | ||
@@ -561,7 +511,7 @@ { | ||
This rule disallows confusing multiline expressions where a newline looks like | ||
it is ending a statement, but is not. | ||
This rule disallows confusing multiline expressions where a newline looks like it is ending a statement, but is not. | ||
For example, the rule could warn about this: | ||
<!-- prettier-ignore --> | ||
```js | ||
@@ -572,5 +522,5 @@ var hello = "world" | ||
Prettier usually formats this in a way that makes it obvious that a semicolon | ||
was missing: | ||
Prettier usually formats this in a way that makes it obvious that a semicolon was missing: | ||
<!-- prettier-ignore --> | ||
```js | ||
@@ -580,5 +530,5 @@ var hello = "world"[(1, 2, 3)].forEach(addNumber); | ||
However, there are cases where Prettier breaks things into several lines such | ||
that the `no-unexpected-multiline` conflicts. | ||
However, there are cases where Prettier breaks things into several lines such that the `no-unexpected-multiline` conflicts. | ||
<!-- prettier-ignore --> | ||
```js | ||
@@ -590,2 +540,3 @@ const value = text.trim().split("\n")[position].toLowerCase(); | ||
<!-- prettier-ignore --> | ||
```js | ||
@@ -598,6 +549,5 @@ const value = text | ||
If you like this rule, it can usually be used with Prettier without problems, | ||
but occasionally you might need to either temporarily disable the rule or | ||
refactor your code. | ||
If you like this rule, it can usually be used with Prettier without problems, but occasionally you might need to either temporarily disable the rule or refactor your code. | ||
<!-- prettier-ignore --> | ||
```js | ||
@@ -616,9 +566,7 @@ const value = text | ||
**Note:** If you _do_ enable this rule, you have to run ESLint and Prettier as | ||
two separate steps (and ESLint first) in order to get any value out of it. | ||
Otherwise Prettier might reformat your code in such a way that ESLint never gets | ||
a chance to report anything (as seen in the first example). | ||
**Note:** If you _do_ enable this rule, you have to run ESLint and Prettier as two separate steps (and ESLint first) in order to get any value out of it. Otherwise Prettier might reformat your code in such a way that ESLint never gets a chance to report anything (as seen in the first example). | ||
Example configuration: | ||
<!-- prettier-ignore --> | ||
```json | ||
@@ -638,7 +586,5 @@ { | ||
Usually, you don’t need this rule at all. But there are two cases where it could | ||
be useful: | ||
Usually, you don’t need this rule at all. But there are two cases where it could be useful: | ||
- To enforce the use of backticks rather than single or double quotes for | ||
strings. | ||
- To enforce the use of backticks rather than single or double quotes for strings. | ||
- To forbid backticks where regular strings could have been used. | ||
@@ -648,7 +594,7 @@ | ||
If you’d like all strings to use backticks (never quotes), enable the | ||
`"backtick"` option. | ||
If you’d like all strings to use backticks (never quotes), enable the `"backtick"` option. | ||
Example ESLint configuration: | ||
<!-- prettier-ignore --> | ||
```json | ||
@@ -664,5 +610,5 @@ { | ||
In the following example, the first array item could have been written with | ||
quotes instead of backticks. | ||
In the following example, the first array item could have been written with quotes instead of backticks. | ||
<!-- prettier-ignore --> | ||
```js | ||
@@ -680,8 +626,5 @@ const strings = [ | ||
If you’d like ESLint to enforce `` `could have been a regular string` `` being | ||
written as either `"could have been a regular string"` or `'could have been a | ||
regular string'`, you need to use some specific configuration. The `quotes` rule has two options, a string option and an object option. | ||
If you’d like ESLint to enforce `` `could have been a regular string` `` being written as either `"could have been a regular string"` or `'could have been a regular string'`, you need to use some specific configuration. The `quotes` rule has two options, a string option and an object option. | ||
- The first (string) option needs to be set to `"single"` or `"double"` and be | ||
kept in sync with Prettier’s [singleQuote] option. | ||
- The first (string) option needs to be set to `"single"` or `"double"` and be kept in sync with Prettier’s [singleQuote] option. | ||
- The second (object) option needs the following properties: | ||
@@ -695,2 +638,3 @@ - `"avoidEscape": true` to follow Prettier’s [string formatting rules]. | ||
<!-- prettier-ignore --> | ||
```json | ||
@@ -710,2 +654,3 @@ { | ||
<!-- prettier-ignore --> | ||
```json | ||
@@ -721,2 +666,3 @@ { | ||
<!-- prettier-ignore --> | ||
```json | ||
@@ -736,2 +682,3 @@ { | ||
<!-- prettier-ignore --> | ||
```json | ||
@@ -751,2 +698,3 @@ { | ||
<!-- prettier-ignore --> | ||
```vue | ||
@@ -761,10 +709,9 @@ <div /> | ||
But for known _void_ HTML elements, Prettier always uses the self-closing style. | ||
For example, `<img>` is turned into `<img />`. | ||
But for known _void_ HTML elements, Prettier always uses the self-closing style. For example, `<img>` is turned into `<img />`. | ||
If you like this rule, it can be used just fine with Prettier as long as you | ||
set `html.void` to `"any"`. | ||
If you like this rule, it can be used just fine with Prettier as long as you set `html.void` to `"any"`. | ||
Example ESLint configuration: | ||
<!-- prettier-ignore --> | ||
```json | ||
@@ -787,10 +734,9 @@ { | ||
These rules don’t conflict with Prettier, but have some gotchas when used with | ||
Prettier. | ||
These rules don’t conflict with Prettier, but have some gotchas when used with Prettier. | ||
### [no-sequences] | ||
This rule forbids using JavaScript’s confusing comma operator (sequence | ||
expressions). This piece of code is not doing what it looks like: | ||
This rule forbids using JavaScript’s confusing comma operator (sequence expressions). This piece of code is not doing what it looks like: | ||
<!-- prettier-ignore --> | ||
```js | ||
@@ -800,5 +746,5 @@ matrix[4, 7]; | ||
Prettier adds parentheses to the above to make it clear that a sequence | ||
expression is used: | ||
Prettier adds parentheses to the above to make it clear that a sequence expression is used: | ||
<!-- prettier-ignore --> | ||
```js | ||
@@ -808,12 +754,7 @@ matrix[(4, 7)]; | ||
However, the `no-sequences` rule allows comma operators if the expression | ||
sequence is explicitly wrapped in parentheses. Since Prettier automatically | ||
wraps them in parentheses, you might never see any warnings from ESLint about | ||
comma operators. | ||
However, the `no-sequences` rule allows comma operators if the expression sequence is explicitly wrapped in parentheses. Since Prettier automatically wraps them in parentheses, you might never see any warnings from ESLint about comma operators. | ||
Ending up with an accidental sequence expression can easily happen while | ||
refactoring. If you want ESLint to catch such mistakes, it is recommended to | ||
forbid sequence expressions entirely using [no-restricted-syntax] \([as | ||
mentioned in the `no-sequences` documentation][no-sequences-full]): | ||
Ending up with an accidental sequence expression can easily happen while refactoring. If you want ESLint to catch such mistakes, it is recommended to forbid sequence expressions entirely using [no-restricted-syntax] \([as mentioned in the `no-sequences` documentation][no-sequences-full]): | ||
<!-- prettier-ignore --> | ||
```json | ||
@@ -827,9 +768,7 @@ { | ||
If you still need to use the comma operator for some edge case, you can place an | ||
`// eslint-disable-next-line no-restricted-syntax` comment on the line above the | ||
expression. `no-sequences` can safely be disabled if you use the | ||
`no-restricted-syntax` approach. | ||
If you still need to use the comma operator for some edge case, you can place an `// eslint-disable-next-line no-restricted-syntax` comment on the line above the expression. `no-sequences` can safely be disabled if you use the `no-restricted-syntax` approach. | ||
You can also supply a custom message if you want: | ||
<!-- prettier-ignore --> | ||
```json | ||
@@ -857,20 +796,18 @@ { | ||
- eslint-config-prettier 2.1.1 and older were tested with ESLint 3.x | ||
- prettier 1.19.1 | ||
- @typescript-eslint/eslint-plugin 2.18.0 | ||
- prettier 2.0.1 | ||
- @typescript-eslint/eslint-plugin 2.24.0 | ||
- eslint-plugin-babel 5.3.0 | ||
- eslint-plugin-flowtype 4.6.0 | ||
- eslint-plugin-react 7.18.0 | ||
- eslint-plugin-react 7.19.0 | ||
- eslint-plugin-standard 4.0.1 | ||
- eslint-plugin-unicorn 15.0.1 | ||
- eslint-plugin-vue 6.1.2 | ||
- eslint-plugin-unicorn 17.2.1 | ||
- eslint-plugin-vue 6.2.2 | ||
Have new rules been added since those versions? Have we missed any rules? Is | ||
there a plugin you would like to see exclusions for? Open an issue or a pull | ||
request! | ||
Have new rules been added since those versions? Have we missed any rules? Is there a plugin you would like to see exclusions for? Open an issue or a pull request! | ||
If you’d like to add support for eslint-plugin-foobar, this is how you’d go | ||
about it: | ||
If you’d like to add support for eslint-plugin-foobar, this is how you’d go about it: | ||
First, create `foobar.js`: | ||
<!-- prettier-ignore --> | ||
```js | ||
@@ -888,2 +825,3 @@ "use strict"; | ||
<!-- prettier-ignore --> | ||
```js | ||
@@ -898,6 +836,3 @@ /* eslint-disable quotes */ | ||
`test-lint/foobar.js` must fail when used with eslint-plugin-foobar and | ||
eslint-plugin-prettier at the same time – until `"prettier/foobar"` is added to | ||
the "extends" property of an ESLint config. The file should be formatted | ||
according to Prettier, and that formatting should disagree with the plugin. | ||
`test-lint/foobar.js` must fail when used with eslint-plugin-foobar and eslint-plugin-prettier at the same time – until `"prettier/foobar"` is added to the "extends" property of an ESLint config. The file should be formatted according to Prettier, and that formatting should disagree with the plugin. | ||
@@ -908,13 +843,8 @@ Finally, you need to mention the plugin in several places: | ||
- Add eslint-plugin-foobar to the "devDependencies" field in `package.json`. | ||
- Make sure that at least one rule from eslint-plugin-foobar gets used in | ||
`.eslintrc.base.js`. | ||
- Add it to the list of supported plugins, to the example config and to | ||
Contributing section in `README.md`. | ||
- Make sure that at least one rule from eslint-plugin-foobar gets used in `.eslintrc.base.js`. | ||
- Add it to the list of supported plugins, to the example config and to Contributing section in `README.md`. | ||
When you’re done, run `npm test` to verify that you got it all right. It runs | ||
several other npm scripts: | ||
When you’re done, run `npm test` to verify that you got it all right. It runs several other npm scripts: | ||
- `"test:lint"` makes sure that the files in `test-lint/` pass ESLint when | ||
the exclusions from eslint-config-prettier are used. It also lints the code of | ||
eslint-config-prettier itself. | ||
- `"test:lint"` makes sure that the files in `test-lint/` pass ESLint when the exclusions from eslint-config-prettier are used. It also lints the code of eslint-config-prettier itself, and checks that Prettier has been run on all files. | ||
- `"test:lint-verify-fail"` is run by a test in `test/lint-verify-fail.test.js`. | ||
@@ -924,7 +854,5 @@ - `"test:lint-rules"` is run by a test in `test/rules.test.js`. | ||
- That eslint-plugin-foobar is mentioned in all the places shown above. | ||
- That no unknown rules are turned off. This helps catching typos, for | ||
example. | ||
- That no unknown rules are turned off. This helps catching typos, for example. | ||
- That the CLI works. | ||
- `"test:cli-sanity"` and `"test:cli-sanity-warning"` are sanity checks for the | ||
CLI. | ||
- `"test:cli-sanity"` and `"test:cli-sanity-warning"` are sanity checks for the CLI. | ||
@@ -937,4 +865,4 @@ ## License | ||
[@typescript-eslint/quotes]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/quotes.md | ||
[ESlint 5.7.0]: https://eslint.org/blog/2018/10/eslint-v5.7.0-released | ||
[Prettier]: https://github.com/prettier/prettier | ||
[eslint 5.7.0]: https://eslint.org/blog/2018/10/eslint-v5.7.0-released | ||
[prettier]: https://github.com/prettier/prettier | ||
[arrow-body-style]: https://eslint.org/docs/rules/arrow-body-style | ||
@@ -967,7 +895,5 @@ [babel/quotes]: https://github.com/babel/eslint-plugin-babel#rules | ||
[quotes]: https://eslint.org/docs/rules/quotes | ||
[singleQuote]: https://prettier.io/docs/en/options.html#quotes | ||
[singlequote]: https://prettier.io/docs/en/options.html#quotes | ||
[string formatting rules]: https://prettier.io/docs/en/rationale.html#strings | ||
[travis-badge]: https://travis-ci.org/prettier/eslint-config-prettier.svg?branch=master | ||
[travis]: https://travis-ci.org/prettier/eslint-config-prettier | ||
[vue/html-self-closing]: https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/html-self-closing.md | ||
[vue/max-len]: https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/max-len.md |
@@ -7,4 +7,4 @@ "use strict"; | ||
"standard/computed-property-even-spacing": "off", | ||
"standard/object-curly-even-spacing": "off" | ||
} | ||
"standard/object-curly-even-spacing": "off", | ||
}, | ||
}; |
@@ -6,4 +6,4 @@ "use strict"; | ||
"unicorn/no-nested-ternary": "off", | ||
"unicorn/number-literal-case": "off" | ||
} | ||
"unicorn/number-literal-case": "off", | ||
}, | ||
}; |
@@ -30,4 +30,4 @@ "use strict"; | ||
"vue/space-infix-ops": "off", | ||
"vue/space-unary-ops": "off" | ||
} | ||
"vue/space-unary-ops": "off", | ||
}, | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61201
838