eslint-config-prettier
Advanced tools
Comparing version 5.1.0 to 6.0.0
@@ -20,3 +20,3 @@ #!/usr/bin/env node | ||
"", | ||
" eslint --print-config . | eslint-config-prettier-check", | ||
" eslint --print-config path/to/main.js | eslint-config-prettier-check", | ||
" eslint --print-config test/index.js | eslint-config-prettier-check", | ||
@@ -23,0 +23,0 @@ "", |
@@ -35,7 +35,7 @@ "use strict"; | ||
if (options.length === 0) { | ||
return true; | ||
return false; | ||
} | ||
const firstOption = options[0]; | ||
return !(firstOption && firstOption.allowParens); | ||
return firstOption ? firstOption.allowParens === false : false; | ||
}, | ||
@@ -42,0 +42,0 @@ |
@@ -0,1 +1,35 @@ | ||
### 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. | ||
If the CLI helper tool gives you errors about this after upgrading, the | ||
solution is to change this: | ||
```json | ||
{ | ||
"rules": { | ||
"no-confusing-arrow": ["error"] | ||
} | ||
} | ||
``` | ||
Into this: | ||
```json | ||
{ | ||
"rules": { | ||
"no-confusing-arrow": ["error", { "allowParens": false }] | ||
} | ||
} | ||
``` | ||
The latter works in both ESLint 6 as well as in ESLint 5 and older. | ||
- 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`.) | ||
### Version 5.1.0 (2019-06-25) | ||
@@ -296,3 +330,3 @@ | ||
[react/jsx-closing-tag-location]: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-tag-location.md | ||
[react/jsx-curly-newline]: [react/jsx-curly-newline] | ||
[react/jsx-curly-newline]: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-newline.md | ||
[react/jsx-one-expression-per-line]: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-one-expression-per-line.md | ||
@@ -299,0 +333,0 @@ [react/jsx-props-no-multi-spaces]: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-multi-spaces.md |
{ | ||
"name": "eslint-config-prettier", | ||
"version": "5.1.0", | ||
"version": "6.0.0", | ||
"license": "MIT", | ||
@@ -33,3 +33,3 @@ "author": "Simon Lydell", | ||
"test:jest": "jest", | ||
"test:cli-sanity": "eslint --print-config . | node ./bin/cli.js", | ||
"test:cli-sanity": "eslint --print-config index.js | node ./bin/cli.js", | ||
"test:cli-sanity-warning": "eslint --print-config ./bin/cli.js | node ./bin/cli.js", | ||
@@ -47,3 +47,3 @@ "test": "npm run test:lint && npm run test:jest && npm run test:cli-sanity && npm run test:cli-sanity-warning" | ||
"doctoc": "1.4.0", | ||
"eslint": "5.16.0", | ||
"eslint": "6.0.1", | ||
"eslint-config-google": "0.13.0", | ||
@@ -50,0 +50,0 @@ "eslint-plugin-babel": "5.3.0", |
@@ -122,3 +122,3 @@ # eslint-config-prettier [![Build Status][travis-badge]][travis] | ||
"scripts": { | ||
"eslint-check": "eslint --print-config . | eslint-config-prettier-check" | ||
"eslint-check": "eslint --print-config path/to/main.js | eslint-config-prettier-check" | ||
} | ||
@@ -128,10 +128,18 @@ } | ||
Then run `npm run eslint-check`. | ||
Then run `npm run eslint-check`. (Change `path/to/main.js` to a file that | ||
exists in your project.) | ||
If you use [multiple configuration files] or [overrides], you may need to run | ||
the above script several times with different `--print-config` arguments, such | ||
as: | ||
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: | ||
``` | ||
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 | ||
``` | ||
@@ -370,18 +378,10 @@ | ||
By default, ESLint suggests switching to an explicit return: | ||
With `{allowParens: true}` (the default since ESLint 6.0.0), adding | ||
parentheses is considered a valid way to avoid the arrow confusion: | ||
```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); | ||
``` | ||
While Prettier keeps thoses parentheses, it removes them if the line is long | ||
While Prettier keeps those parentheses, it removes them if the line is long | ||
enough to introduce a line break: | ||
@@ -394,2 +394,11 @@ | ||
With `{allowParens: false}`, ESLint instead suggests switching to an explicit | ||
return: | ||
```js | ||
var x = a => { return 1 ? 2 : 3; }; | ||
``` | ||
That causes no problems with Prettier. | ||
If you like this rule, it can be used just fine with Prettier as long as the | ||
@@ -403,3 +412,3 @@ `allowParens` option is off. | ||
"rules": { | ||
"no-confusing-arrow": "error" | ||
"no-confusing-arrow": ["error", { "allowParens": false }] | ||
} | ||
@@ -409,2 +418,9 @@ } | ||
(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.) | ||
### [no-mixed-operators] | ||
@@ -773,3 +789,4 @@ | ||
- ESLint 5.16.0 | ||
- ESLint 6.0.1 | ||
- eslint-config-prettier 5.1.0 and older were tested with ESLint 5.x | ||
- eslint-config-prettier 2.10.0 and older were tested with ESLint 4.x | ||
@@ -776,0 +793,0 @@ - eslint-config-prettier 2.1.1 and older were tested with ESLint 3.x |
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
55305
895