eslint-config-prettier
Advanced tools
Comparing version 1.6.0 to 1.7.0
@@ -13,3 +13,3 @@ #!/usr/bin/env node | ||
"This tool checks whether an ESLint configuration contains rules that are", | ||
"unnecessary or conflict with prettier. It’s supposed to be run like this:", | ||
"unnecessary or conflict with Prettier. It’s supposed to be run like this:", | ||
"", | ||
@@ -20,2 +20,9 @@ " eslint --print-config .eslintrc.js | eslint-config-prettier-check", | ||
"", | ||
"Exit codes:", | ||
"", | ||
"0: No problems found.", | ||
"1: Unexpected error.", | ||
"2: Conflicting rules found.", | ||
"3: Special rules only found.", | ||
"", | ||
"For more information, see:", | ||
@@ -77,9 +84,6 @@ "https://github.com/prettier/eslint-config-prettier#cli-helper-tool" | ||
.filter(ruleName => allRules[ruleName] === 0) | ||
.reduce( | ||
(obj, ruleName) => { | ||
obj[ruleName] = true; | ||
return obj; | ||
}, | ||
Object.create(null) | ||
); | ||
.reduce((obj, ruleName) => { | ||
obj[ruleName] = true; | ||
return obj; | ||
}, Object.create(null)); | ||
@@ -95,3 +99,3 @@ const flaggedRuleNames = Object.keys(config.rules).filter(ruleName => { | ||
return { | ||
stdout: "No rules that are unnecessary or conflict with prettier were found.", | ||
stdout: "No rules that are unnecessary or conflict with Prettier were found.", | ||
code: 0 | ||
@@ -114,3 +118,3 @@ }; | ||
const regularMessage = [ | ||
"The following rules are unnecessary or might conflict with prettier:", | ||
"The following rules are unnecessary or might conflict with Prettier:", | ||
"", | ||
@@ -121,3 +125,4 @@ regularRulesList | ||
const specialMessage = [ | ||
"The following rules can be enabled in some cases. See:", | ||
"The following rules are enabled but can only be enabled in some cases.", | ||
"It is up to you to check if they are configured correctly. See:", | ||
"https://github.com/prettier/eslint-config-prettier#special-rules", | ||
@@ -137,3 +142,3 @@ "", | ||
stdout: message, | ||
code: 2 | ||
code: regularRulesList.length > 0 ? 2 : 3 | ||
}; | ||
@@ -140,0 +145,0 @@ } |
@@ -0,1 +1,9 @@ | ||
### 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. | ||
### Version 1.6.0 (2017-04-05) | ||
@@ -2,0 +10,0 @@ |
@@ -10,6 +10,5 @@ "use strict"; | ||
"max-len": 0, | ||
"no-confusing-arrow": 0, | ||
"no-mixed-operators": 0, | ||
quotes: 0, | ||
// The rest are rules that you never need to enable when using prettier. | ||
// The rest are rules that you never need to enable when using Prettier. | ||
"array-bracket-spacing": "off", | ||
@@ -38,2 +37,3 @@ "arrow-parens": "off", | ||
"no-comma-dangle": "off", | ||
"no-confusing-arrow": "off", | ||
"no-extra-parens": "off", | ||
@@ -40,0 +40,0 @@ "no-extra-semi": "off", |
{ | ||
"name": "eslint-config-prettier", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"license": "MIT", | ||
"author": "Simon Lydell", | ||
"description": "Turns off all rules that are unnecessary or might conflict with prettier.", | ||
"description": "Turns off all rules that are unnecessary or might conflict with Prettier.", | ||
"repository": "prettier/eslint-config-prettier", | ||
@@ -34,4 +34,4 @@ "files": [ | ||
"devDependencies": { | ||
"ava": "^0.19.0", | ||
"babel-eslint": "^7.2.1", | ||
"ava": "^0.19.1", | ||
"babel-eslint": "^7.2.2", | ||
"dedent": "^0.7.0", | ||
@@ -43,3 +43,3 @@ "eslint": "^3.19.0", | ||
"eslint-plugin-react": "^6.10.3", | ||
"prettier": "^0.22.0", | ||
"prettier": "^1.1.0", | ||
"rimraf": "^2.6.1" | ||
@@ -46,0 +46,0 @@ }, |
# eslint-config-prettier [![Build Status][travis-badge]][travis] | ||
Turns off all rules that are unnecessary or might conflict with [prettier]. | ||
Turns off all rules that are unnecessary or might conflict with [Prettier]. | ||
This let’s you use you favorite shareable config without letting its stylistic | ||
choices get in the way when using prettier. | ||
This lets you use you favorite shareable config without letting its stylistic | ||
choices get in the way when using Prettier. | ||
@@ -53,3 +53,3 @@ Intended to be used together with [eslint-plugin-prettier]. | ||
your configuration contains any rules that are unnecessary or conflict with | ||
prettier. | ||
Prettier. | ||
@@ -70,2 +70,9 @@ First, add a script for it to package.json: | ||
Exit codes: | ||
- 0: No problems found. | ||
- 1: Unexpected error. | ||
- 2: Conflicting rules found. | ||
- 3: Special rules only found. | ||
## Example configuration | ||
@@ -117,3 +124,3 @@ | ||
If you use the `"multi-line"` or `"multi-or-nest"` option, the rule can conflict | ||
with prettier. | ||
with Prettier. | ||
@@ -126,3 +133,3 @@ For example, the `"multi-line"` option allows this line: | ||
However, prettier might consider the line too long and turn it into the | ||
However, Prettier might consider the line too long and turn it into the | ||
following, which the `"multi-line"` option does _not_ allow: | ||
@@ -135,7 +142,7 @@ | ||
[eslint-config-airbnb] config includes `curly` with the `"multi-line"` option | ||
turned on by default. Since that config is very popular, it makes sense for | ||
eslint-config-prettier to turn this rule off. | ||
The [eslint-config-airbnb] config includes `curly` with the `"multi-line"` | ||
option turned on by default. Since that config is very popular, it makes sense | ||
for eslint-config-prettier to turn this rule off. | ||
If you like this rule, it can be used just fine with prettier as long as you | ||
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. | ||
@@ -155,9 +162,9 @@ | ||
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 | ||
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. | ||
Prettier can provide automatically, you can enable this rule. Just remember to | ||
keep `max-len`’s options and Prettier’s `printWidth` option in sync. | ||
@@ -174,48 +181,2 @@ Example configuration: | ||
### [no-confusing-arrow] | ||
For example, the rule could warn about this line: | ||
```js | ||
var x = a => 1 ? 2 : 3; | ||
``` | ||
By default, ESLint suggests switching to an explicit return: | ||
```js | ||
var x = a => { return 1 ? 2 : 3; }; | ||
``` | ||
That causes no problems with prettier. | ||
With `{allowParens: true}`, adding parentheses is also considered a valid way to | ||
avoid the arrow confusion: | ||
```js | ||
var x = a => (1 ? 2 : 3); | ||
``` | ||
However, prettier removes many “unnecessary” parentheses, turning it back to: | ||
```js | ||
var x = a => 1 ? 2 : 3; | ||
``` | ||
[eslint-config-airbnb] config includes `no-confusing-arrow` with the | ||
`allowParens` option turned on by default. Since that config is very popular, it | ||
makes sense for eslint-config-prettier to turn this rule off. | ||
If you like this rule, it can be used just fine with prettier as long as the | ||
`allowParens` option is off. | ||
Example configuration: | ||
```json | ||
{ | ||
"rules": { | ||
"no-confusing-arrow": "error" | ||
} | ||
} | ||
``` | ||
### [no-mixed-operators] | ||
@@ -237,3 +198,3 @@ | ||
However, prettier removes many “unnecessary” parentheses, turning it back to: | ||
However, Prettier removes many “unnecessary” parentheses, turning it back to: | ||
@@ -244,3 +205,3 @@ ```js | ||
If you want to use this rule with prettier, you need to split the expression | ||
If you want to use this rule with Prettier, you need to split the expression | ||
into another variable: | ||
@@ -253,3 +214,3 @@ | ||
Keep in mind that prettier prints _some_ “unnecessary” parentheses, though: | ||
Keep in mind that Prettier prints _some_ “unnecessary” parentheses, though: | ||
@@ -291,3 +252,3 @@ ```js | ||
- ESLint 3.19.0 | ||
- prettier 0.22.0 | ||
- prettier 1.1.0 | ||
- eslint-plugin-flowtype 2.30.4 | ||
@@ -363,7 +324,6 @@ - eslint-plugin-react 6.10.3 | ||
[max-len]: http://eslint.org/docs/rules/max-len | ||
[no-confusing-arrow]: http://eslint.org/docs/rules/no-confusing-arrow | ||
[no-mixed-operators]: http://eslint.org/docs/rules/no-mixed-operators | ||
[prettier]: https://github.com/prettier/prettier | ||
[Prettier]: https://github.com/prettier/prettier | ||
[quotes]: http://eslint.org/docs/rules/quotes | ||
[travis-badge]: https://travis-ci.org/prettier/eslint-config-prettier.svg?branch=master | ||
[travis]: https://travis-ci.org/prettier/eslint-config-prettier |
229
19886
318