Skip to content

Commit

Permalink
Add @babel/eslint-plugin (#187)
Browse files Browse the repository at this point in the history
Closes #186.
  • Loading branch information
lydell committed Apr 24, 2021
1 parent 8954ede commit 79db534
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 26 deletions.
5 changes: 3 additions & 2 deletions .eslintrc.base.js
Expand Up @@ -23,7 +23,7 @@ module.exports = {
),
],
parserOptions: {
parser: "babel-eslint",
parser: "@babel/eslint-parser",
ecmaVersion: 2018,
sourceType: "script",
// Needed for the lint-verify-fail.test.js test.
Expand Down Expand Up @@ -63,9 +63,10 @@ module.exports = {
"unicorn/prefer-module": "off",
"unicorn/prefer-spread": "off",
"unicorn/prevent-abbreviations": "off",
// Force a conflict with Prettier in test-lint/babel.js.
// Force a conflict with Prettier in test-lint/@babel.js. and test-lint/babel.js.
"object-curly-spacing": "off",
"babel/object-curly-spacing": ["error", "never"],
"@babel/object-curly-spacing": ["error", "never"],
},
overrides: [
{
Expand Down
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -60,6 +60,7 @@ Then, add `"prettier"` to the "extends" array in your `.eslintrc.*` file. Make s
That’s it! Extending `"prettier"` turns off a bunch of core ESLint rules, as well as a few rules from these plugins:

- [@typescript-eslint/eslint-plugin]
- [@babel/eslint-plugin]
- [eslint-plugin-babel]
- [eslint-plugin-flowtype]
- [eslint-plugin-react]
Expand Down Expand Up @@ -655,6 +656,7 @@ 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 2.2.1
- @babel/eslint-plugin 7.13.16
- @typescript-eslint/eslint-plugin 4.22.0
- eslint-plugin-babel 5.3.1
- eslint-plugin-flowtype 5.7.2
Expand Down Expand Up @@ -710,6 +712,7 @@ When you’re done, run `npm test` to verify that you got it all right. It runs

[MIT](LICENSE).

[@babel/eslint-plugin]: https://github.com/babel/babel/tree/main/eslint/babel-eslint-plugin
[@typescript-eslint/eslint-plugin]: https://github.com/typescript-eslint/typescript-eslint
[@typescript-eslint/quotes]: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/quotes.md
[arrow-body-style]: https://eslint.org/docs/rules/arrow-body-style
Expand Down
3 changes: 3 additions & 0 deletions babel.config.json
@@ -0,0 +1,3 @@
{
"plugins": ["@babel/plugin-syntax-jsx", "@babel/plugin-syntax-flow"]
}
2 changes: 2 additions & 0 deletions index.js
Expand Up @@ -92,6 +92,8 @@ module.exports = {
"wrap-iife": "off",
"wrap-regex": "off",
"yield-star-spacing": "off",
"@babel/object-curly-spacing": "off",
"@babel/semi": "off",
"@typescript-eslint/brace-style": "off",
"@typescript-eslint/comma-dangle": "off",
"@typescript-eslint/comma-spacing": "off",
Expand Down
65 changes: 43 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Expand Up @@ -14,9 +14,12 @@
"build": "node scripts/build.js"
},
"devDependencies": {
"@babel/eslint-parser": "7.13.14",
"@babel/eslint-plugin": "7.13.16",
"@babel/plugin-syntax-flow": "7.12.13",
"@babel/plugin-syntax-jsx": "7.12.13",
"@typescript-eslint/eslint-plugin": "4.22.0",
"@typescript-eslint/parser": "4.22.0",
"babel-eslint": "10.1.0",
"doctoc": "2.0.0",
"eslint": "7.25.0",
"eslint-config-google": "0.14.0",
Expand Down
6 changes: 6 additions & 0 deletions test-lint/@babel.js
@@ -0,0 +1,6 @@
/* eslint-disable quotes, babel/object-curly-spacing */
"use strict";

// Prettier wants spacing between curly braces, but
// `@babel/object-curly-spacing` doesn’t.
module.exports = { foo: "bar" };
2 changes: 1 addition & 1 deletion test-lint/babel.js
@@ -1,4 +1,4 @@
/* eslint-disable quotes */
/* eslint-disable quotes, @babel/object-curly-spacing */
"use strict";

// Prettier wants spacing between curly braces, but `babel/object-curly-spacing`
Expand Down

0 comments on commit 79db534

Please sign in to comment.