Skip to content

Commit

Permalink
Merge branch 'v4'
Browse files Browse the repository at this point in the history
  • Loading branch information
lydell committed Jan 26, 2019
2 parents f5f7549 + 9fde1aa commit 81abe0f
Show file tree
Hide file tree
Showing 11 changed files with 983 additions and 915 deletions.
7 changes: 4 additions & 3 deletions .eslintrc.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,19 @@ module.exports = {
"react/jsx-no-bind": "off",
// Force a conflict with Prettier in test-lint/standard.js.
"standard/computed-property-even-spacing": ["error", "even"],
"unicorn/filename-case": "off",
// Force a conflict with Prettier in test-lint/babel.js.
"object-curly-spacing": "off",
"babel/object-curly-spacing": ["error", "never"]
},
overrides: [
{
files: ["*.ts", "*.tsx"],
parserOptions: { parser: "eslint-plugin-typescript/parser" },
parserOptions: { parser: "@typescript-eslint/parser" },
rules: {
// Force a conflict with Prettier in test-lint/typescript.js.
// This is included in "plugin:typescript/recommended".
"typescript/indent": "error"
// This is included in "plugin:@typescript-eslint/recommended".
"@typescript-eslint/indent": "error"
}
}
],
Expand Down
9 changes: 9 additions & 0 deletions @typescript-eslint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"use strict";

module.exports = {
rules: {
"@typescript-eslint/indent": "off",
"@typescript-eslint/member-delimiter-style": "off",
"@typescript-eslint/type-annotation-spacing": "off"
}
};
56 changes: 48 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ it together with some other config.
- [CLI helper tool](#cli-helper-tool)
- [Example configuration](#example-configuration)
- [Special rules](#special-rules)
- [arrow-body-style and prefer-arrow-callback](#arrow-body-style-and-prefer-arrow-callback)
- [curly](#curly)
- [lines-around-comment](#lines-around-comment)
- [max-len](#max-len)
Expand Down Expand Up @@ -64,11 +65,11 @@ configs.

A few ESLint plugins are supported as well:

- [@typescript-eslint/eslint-plugin]
- [eslint-plugin-babel]
- [eslint-plugin-flowtype]
- [eslint-plugin-react]
- [eslint-plugin-standard]
- [eslint-plugin-typescript]
- [eslint-plugin-unicorn]
- [eslint-plugin-vue]

Expand All @@ -79,11 +80,11 @@ Add extra exclusions for the plugins you use like so:
"extends": [
"some-other-config-you-use",
"prettier",
"prettier/@typescript-eslint",
"prettier/babel",
"prettier/flowtype",
"prettier/react",
"prettier/standard",
"prettier/typescript",
"prettier/unicorn",
"prettier/vue"
]
Expand Down Expand Up @@ -128,27 +129,27 @@ Exit codes:
{
"extends": [
"standard",
"plugin:@typescript-eslint/recommended",
"plugin:flowtype/recommended",
"plugin:react/recommended",
"plugin:typescript/recommended",
"plugin:unicorn/recommended",
"plugin:vue/recommended",
"prettier",
"prettier/@typescript-eslint",
"prettier/babel",
"prettier/flowtype",
"prettier/react",
"prettier/standard",
"prettier/typescript",
"prettier/unicorn",
"prettier/vue"
],
"plugins": [
"@typescript-eslint",
"babel",
"flowtype",
"react",
"prettier",
"react",
"standard",
"typescript",
"unicorn",
"vue"
],
Expand Down Expand Up @@ -177,10 +178,44 @@ enabled in some cases.
- 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.

### [arrow-body-style] and [prefer-arrow-callback]

**These rule might cause problems if using [eslint-plugin-prettier] and `--fix`.**

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 _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.

See these issues for more information:

- [eslint-config-prettier#31]
- [eslint-config-prettier#71]
- [eslint-plugin-prettier#65]

When the autofix bug in ESLint has been fixed, the special case for these rules
can be removed.

### [curly]

**This rule requires certain options.**
Expand Down Expand Up @@ -716,11 +751,11 @@ eslint-config-prettier has been tested with:
- eslint-config-prettier 2.10.0 and older were tested with ESLint 4.x
- eslint-config-prettier 2.1.1 and older were tested with ESLint 3.x
- prettier 1.15.3
- @typescript-eslint/eslint-plugin 1.0.0
- eslint-plugin-babel 5.3.0
- eslint-plugin-flowtype 3.2.1
- eslint-plugin-react 7.12.4
- eslint-plugin-standard 4.0.0
- eslint-plugin-typescript 1.0.0-rc.1
- eslint-plugin-unicorn 7.0.0
- eslint-plugin-vue 5.1.0

Expand Down Expand Up @@ -788,16 +823,20 @@ several other npm scripts:

[MIT](LICENSE).

[@typescript-eslint/eslint-plugin]: https://github.com/typescript-eslint/typescript-eslint
[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
[babel/quotes]: https://github.com/babel/eslint-plugin-babel#rules
[curly]: https://eslint.org/docs/rules/curly
[eslint-config-prettier#31]: https://github.com/prettier/eslint-config-prettier/issues/31
[eslint-config-prettier#71]: https://github.com/prettier/eslint-config-prettier/issues/71
[eslint-plugin-babel]: https://github.com/babel/eslint-plugin-babel
[eslint-plugin-flowtype]: https://github.com/gajus/eslint-plugin-flowtype
[eslint-plugin-prettier#65]: https://github.com/prettier/eslint-plugin-prettier/issues/65
[eslint-plugin-prettier]: https://github.com/prettier/eslint-plugin-prettier
[eslint-plugin-react]: https://github.com/yannickcr/eslint-plugin-react
[eslint-plugin-standard]: https://github.com/xjamundx/eslint-plugin-standard
[eslint-plugin-typescript]: https://github.com/bradzacher/eslint-plugin-typescript
[eslint-plugin-unicorn]: https://github.com/sindresorhus/eslint-plugin-unicorn
[eslint-plugin-vue]: https://github.com/vuejs/eslint-plugin-vue
[lines-around-comment]: https://eslint.org/docs/rules/lines-around-comment
Expand All @@ -811,6 +850,7 @@ several other npm scripts:
[no-tabs]: https://eslint.org/docs/rules/no-tabs
[no-unexpected-multiline]: https://eslint.org/docs/rules/no-unexpected-multiline
[overrides]: https://eslint.org/docs/user-guide/configuring#configuration-based-on-glob-patterns
[prefer-arrow-callback]: https://eslint.org/docs/rules/prefer-arrow-callback
[quotes]: https://eslint.org/docs/rules/quotes
[singleQuote]: https://prettier.io/docs/en/options.html#quotes
[string formatting rules]: https://prettier.io/docs/en/rationale.html#strings
Expand Down
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ module.exports = {
// The following rules can be used in some cases. See the README for more
// information. (These are marked with `0` instead of `"off"` so that a
// script can distinguish them.)
"arrow-body-style": 0,
curly: 0,
"lines-around-comment": 0,
"max-len": 0,
"no-confusing-arrow": 0,
"no-mixed-operators": 0,
"no-tabs": 0,
"no-unexpected-multiline": 0,
"prefer-arrow-callback": 0,
quotes: 0,
// The rest are rules that you never need to enable when using Prettier.
"array-bracket-newline": "off",
Expand Down
Loading

0 comments on commit 81abe0f

Please sign in to comment.