eslint-config-prettier
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -59,5 +59,3 @@ #!/usr/bin/env node | ||
return { | ||
stderr: ( | ||
`Expected a \`{"rules: {...}"}\` JSON object, but got:\n${string}` | ||
), | ||
stderr: `Expected a \`{"rules: {...}"}\` JSON object, but got:\n${string}`, | ||
code: 1 | ||
@@ -64,0 +62,0 @@ }; |
@@ -0,1 +1,9 @@ | ||
### 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)! | ||
### Version 1.3.0 (2017-02-21) | ||
@@ -42,3 +50,5 @@ | ||
[eslint-plugin-react]: https://github.com/yannickcr/eslint-plugin-react | ||
[no-confusing-arrow]: http://eslint.org/docs/rules/no-confusing-arrow | ||
[no-confusing-arrow-special]: https://github.com/lydell/eslint-config-prettier/blob/08ac5bcc25c9cdc71864b4a1e4191e7d28dd2bc2/README.md#no-confusing-arrow | ||
[one-var-declaration-per-line]: http://eslint.org/docs/rules/one-var-declaration-per-line | ||
[template-tag-spacing]: http://eslint.org/docs/rules/template-tag-spacing |
21
index.js
@@ -9,2 +9,3 @@ "use strict"; | ||
"max-len": 0, | ||
"no-confusing-arrow": 0, | ||
"no-mixed-operators": 0, | ||
@@ -25,2 +26,3 @@ quotes: 0, | ||
"func-call-spacing": "off", | ||
"generator-star": "off", | ||
"generator-star-spacing": "off", | ||
@@ -34,9 +36,15 @@ indent: "off", | ||
"new-parens": "off", | ||
"no-arrow-condition": "off", | ||
"no-comma-dangle": "off", | ||
"no-extra-parens": "off", | ||
"no-extra-semi": "off", | ||
"no-mixed-spaces-and-tabs": "off", | ||
"no-multi-spaces": "off", | ||
"no-multiple-empty-lines": "off", | ||
"no-multi-spaces": "off", | ||
"no-reserved-keys": "off", | ||
"no-space-before-semi": "off", | ||
"no-spaced-func": "off", | ||
"no-trailing-spaces": "off", | ||
"no-whitespace-before-property": "off", | ||
"no-wrap-func": "off", | ||
"object-curly-newline": "off", | ||
@@ -50,9 +58,16 @@ "object-curly-spacing": "off", | ||
"rest-spread-spacing": "off", | ||
semi: "off", | ||
"semi-spacing": "off", | ||
semi: "off", | ||
"space-after-function-name": "off", | ||
"space-after-keywords": "off", | ||
"space-before-blocks": "off", | ||
"space-before-function-paren": "off", | ||
"space-before-function-parentheses": "off", | ||
"space-before-keywords": "off", | ||
"space-in-brackets": "off", | ||
"space-in-parens": "off", | ||
"space-infix-ops": "off", | ||
"space-in-parens": "off", | ||
"space-return-throw-case": "off", | ||
"space-unary-ops": "off", | ||
"space-unary-word-ops": "off", | ||
"template-curly-spacing": "off", | ||
@@ -59,0 +74,0 @@ "template-tag-spacing": "off", |
{ | ||
"name": "eslint-config-prettier", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"license": "MIT", | ||
@@ -34,12 +34,12 @@ "author": "Simon Lydell", | ||
"devDependencies": { | ||
"ava": "^0.18.1", | ||
"ava": "^0.18.2", | ||
"babel-eslint": "^7.1.1", | ||
"dedent": "^0.7.0", | ||
"eslint": "^3.15.0", | ||
"eslint": "^3.16.1", | ||
"eslint-config-google": "^0.7.1", | ||
"eslint-plugin-flowtype": "^2.30.0", | ||
"eslint-plugin-prettier": "^2.0.0", | ||
"eslint-plugin-react": "^6.9.0", | ||
"prettier": "^0.16.0", | ||
"rimraf": "^2.5.4" | ||
"eslint-plugin-prettier": "^2.0.1", | ||
"eslint-plugin-react": "^6.10.0", | ||
"prettier": "^0.19.0", | ||
"rimraf": "^2.6.1" | ||
}, | ||
@@ -46,0 +46,0 @@ "peerDependencies": { |
@@ -14,4 +14,5 @@ "use strict"; | ||
"react/jsx-tag-spacing": "off", | ||
"react/jsx-wrap-multilines": "off" | ||
"react/jsx-wrap-multilines": "off", | ||
"react/wrap-multilines": "off" | ||
} | ||
}; |
@@ -128,2 +128,48 @@ # eslint-config-prettier [![Build Status][travis-badge]][travis] | ||
### [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] | ||
@@ -136,3 +182,3 @@ | ||
```js | ||
var foo = a && b || c; | ||
var foo = a + b * c; | ||
``` | ||
@@ -143,10 +189,9 @@ | ||
```js | ||
var foo = (a && b) || c; | ||
var foo = a + (b * c); | ||
``` | ||
However, prettier prints the minimum amount of parentheses technically needed, | ||
turning it back to: | ||
However, prettier removes many “unnecessary” parentheses, turning it back to: | ||
```js | ||
var foo = a && b || c; | ||
var foo = a + b * c; | ||
``` | ||
@@ -158,6 +203,12 @@ | ||
```js | ||
var bar = a && b; | ||
var foo = bar || c; | ||
var bar = b * c; | ||
var foo = a + bar; | ||
``` | ||
Keep in mind that prettier prints _some_ “unnecessary” parentheses, though: | ||
```js | ||
var foo = (a && b) || c; | ||
``` | ||
Example configuration: | ||
@@ -193,6 +244,6 @@ | ||
- ESLint 3.15.0 | ||
- prettier 0.16.0 | ||
- ESLint 3.16.1 | ||
- prettier 0.19.0 | ||
- eslint-plugin-flowtype 2.30.0 | ||
- eslint-plugin-react 6.9.0 | ||
- eslint-plugin-react 6.10.0 | ||
@@ -260,2 +311,3 @@ Have new rules been added since those versions? Have we missed any rules? Is | ||
[eslint-config-airbnb]: https://www.npmjs.com/package/eslint-config-airbnb | ||
[eslint-plugin-flowtype]: https://github.com/gajus/eslint-plugin-flowtype | ||
@@ -265,2 +317,3 @@ [eslint-plugin-prettier]: https://github.com/not-an-aardvark/eslint-plugin-prettier | ||
[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 | ||
@@ -267,0 +320,0 @@ [prettier]: https://github.com/jlongster/prettier |
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
18322
222
317