-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[eslint] switch to eslint.config.js
#3600
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
'use strict'; | ||
|
||
/** @type {import('eslint-doc-generator').GenerateOptions} */ | ||
const config = { | ||
configEmoji: [ | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
'use strict'; | ||
|
||
const globals = require('globals'); | ||
const eslintPluginRecommended = require('eslint-plugin-eslint-plugin/configs/recommended'); | ||
|
||
const FlatCompat = require('@eslint/eslintrc').FlatCompat; | ||
|
||
const eslintrc = new FlatCompat({ | ||
baseDirectory: __dirname, | ||
}); | ||
|
||
module.exports = [ | ||
{ | ||
ignores: [ | ||
'coverage/', | ||
'.nyc_output/', | ||
], | ||
}, | ||
...eslintrc.extends('airbnb-base'), | ||
eslintPluginRecommended, | ||
{ | ||
languageOptions: { | ||
ecmaVersion: 6, | ||
sourceType: 'commonjs', | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
globals: globals.node, | ||
}, | ||
rules: { | ||
'comma-dangle': [2, 'always-multiline'], | ||
'object-shorthand': [2, 'always', { | ||
ignoreConstructors: false, | ||
avoidQuotes: false, // this is the override vs airbnb | ||
}], | ||
'max-len': [2, 120, { | ||
ignoreStrings: true, | ||
ignoreTemplateLiterals: true, | ||
ignoreComments: true, | ||
}], | ||
'consistent-return': 0, | ||
|
||
'prefer-destructuring': [2, { array: false, object: false }, { enforceForRenamedProperties: false }], | ||
'prefer-object-spread': 0, // until node 8 is required | ||
'prefer-rest-params': 0, // until node 6 is required | ||
'prefer-spread': 0, // until node 6 is required | ||
'function-call-argument-newline': 1, // TODO: enable | ||
'function-paren-newline': 0, | ||
'no-plusplus': [2, { allowForLoopAfterthoughts: true }], | ||
'no-param-reassign': 1, | ||
'no-restricted-syntax': [2, { | ||
selector: 'ObjectPattern', | ||
message: 'Object destructuring is not compatible with Node v4', | ||
}], | ||
strict: [2, 'safe'], | ||
'valid-jsdoc': [2, { | ||
requireReturn: false, | ||
requireParamDescription: false, | ||
requireReturnDescription: false, | ||
}], | ||
|
||
'eslint-plugin/consistent-output': 0, | ||
'eslint-plugin/require-meta-docs-description': [2, { pattern: '^(Enforce|Require|Disallow)' }], | ||
'eslint-plugin/require-meta-schema': 0, | ||
'eslint-plugin/require-meta-type': 0, | ||
|
||
// overrides airbnb config to add `eslint.config.js` to `devDependencies` | ||
'import/no-extraneous-dependencies': [ | ||
'error', | ||
{ | ||
devDependencies: [ | ||
'test/**', | ||
'tests/**', | ||
'spec/**', | ||
'**/__tests__/**', | ||
'**/__mocks__/**', | ||
'test.{js,jsx}', | ||
'test-*.{js,jsx}', | ||
'**/*{.,_}{test,spec}.{js,jsx}', | ||
'**/jest.config.js', | ||
'**/jest.setup.js', | ||
'**/vue.config.js', | ||
'**/webpack.config.js', | ||
'**/webpack.config.*.js', | ||
'**/rollup.config.js', | ||
'**/rollup.config.*.js', | ||
'**/gulpfile.js', | ||
'**/gulpfile.*.js', | ||
'**/Gruntfile{,.js}', | ||
'**/protractor.conf.js', | ||
'**/protractor.conf.*.js', | ||
'**/karma.conf.js', | ||
'**/.eslintrc.js', | ||
'eslint.config.js', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added |
||
], | ||
optionalDependencies: false, | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
files: ['tests/**'], | ||
languageOptions: { | ||
globals: globals.mocha, | ||
}, | ||
rules: { | ||
'no-template-curly-in-string': 1, | ||
}, | ||
}, | ||
{ | ||
files: ['markdown.config.js'], | ||
rules: { | ||
'no-console': 0, | ||
}, | ||
}, | ||
Comment on lines
+112
to
+117
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is copy-pasted from |
||
{ | ||
files: ['.github/workflows/*.js'], | ||
languageOptions: { | ||
ecmaVersion: 2019, | ||
}, | ||
rules: { | ||
camelcase: 0, | ||
'no-console': 0, | ||
'no-restricted-syntax': 0, | ||
}, | ||
}, | ||
|
||
]; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,7 @@ | |
"@babel/plugin-syntax-do-expressions": "^7.18.6", | ||
"@babel/plugin-syntax-function-bind": "^7.18.6", | ||
"@babel/preset-react": "^7.18.6", | ||
"@eslint/eslintrc": "^2.1.0", | ||
"@types/eslint": "=7.2.10", | ||
"@types/estree": "0.0.52", | ||
"@types/node": "^4.9.5", | ||
|
@@ -57,12 +58,13 @@ | |
"eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
"eslint-doc-generator": "^1.4.3", | ||
"eslint-plugin-eslint-plugin": "^2.3.0 || ^3.5.3 || ^4.0.1 || ^5.0.5", | ||
"eslint-plugin-eslint-plugin": "^2.3.0 || ^3.5.3 || ^4.0.1 || ^5.1.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Flat config exports that |
||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-remote-tester": "^3.0.0", | ||
"eslint-remote-tester-repositories": "^1.0.0", | ||
"eslint-scope": "^3.7.3", | ||
"espree": "^3.5.4", | ||
"globals": "^13.20.0", | ||
"istanbul": "^0.4.5", | ||
"jackspeak": "=2.1.1", | ||
"ls-engines": "^0.8.1", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file wasn't linted before because it's a dotfile.