-
Notifications
You must be signed in to change notification settings - Fork 59
Support flat config and upgrade eslint to v9 #571
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
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
0ab9d62
support flat config
gracepark 2694c92
remove package
gracepark ef5c2d6
add back packages
gracepark 6c0ea52
update package.json, remove compat
gracepark 305c0e2
add .eslintignore and prettify files
gracepark 2c0f2cf
remove resolved rules
gracepark 89cfd91
update to v9
gracepark c3fffe6
remove package-lock in tests
gracepark bba6a2a
uncomment
gracepark 2cacd29
temp comment out filenames
gracepark e7845f6
update tests
gracepark ee4439c
add additional test
gracepark ddbb63d
update to getFlatConfig function
gracepark 501313b
set back to github
gracepark fac7ddb
set back typescript prettier
gracepark 51a5db1
add back eslint-config-prettier to dev dep
gracepark 1747fdb
update packages and typescript config
gracepark 3cf39da
update to latest to compat for filenames fix
gracepark b815887
update filenames key
gracepark f179dc0
update typescript tests
gracepark 88a304a
update to getFlatConfigs
gracepark 47c24b5
update readme
gracepark 8d79189
remove s
gracepark File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const globals = require('globals') | ||
const eslintPlugin = require('eslint-plugin-eslint-plugin') | ||
const importPlugin = require('eslint-plugin-import') | ||
const filenames = require('eslint-plugin-filenames') | ||
const i18nTextPlugin = require('eslint-plugin-i18n-text') | ||
const recommendedGitHub = require('./lib/configs/flat/recommended') | ||
const {fixupPluginRules} = require('@eslint/compat') | ||
|
||
module.exports = [ | ||
recommendedGitHub, | ||
eslintPlugin.configs['flat/all'], | ||
{ | ||
ignores: ['test-examples/**'], | ||
}, | ||
{ | ||
languageOptions: { | ||
ecmaVersion: 13, | ||
globals: { | ||
...globals.es6, | ||
...globals.node, | ||
}, | ||
}, | ||
plugins: { | ||
eslintPlugin, | ||
importPlugin, | ||
filenames, | ||
'i18n-text': fixupPluginRules(i18nTextPlugin), | ||
}, | ||
rules: { | ||
'importPlugin/extensions': 'off', | ||
'importPlugin/no-commonjs': 'off', | ||
'filenamesPlugin/match-regex': 'off', | ||
'i18n-text/no-en': 'off', | ||
'eslint-plugin/prefer-placeholders': 'off', | ||
'eslint-plugin/test-case-shorthand-strings': 'off', | ||
'eslint-plugin/require-meta-docs-url': 'off', | ||
}, | ||
}, | ||
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const globals = require('globals') | ||
const github = require('../../plugin') | ||
const importPlugin = require('eslint-plugin-import') | ||
const escompatPlugin = require('eslint-plugin-escompat') | ||
|
||
module.exports = { | ||
...escompatPlugin.configs['flat/recommended'], | ||
languageOptions: { | ||
globals: { | ||
...globals.browser, | ||
}, | ||
}, | ||
plugins: {importPlugin, escompatPlugin, github}, | ||
rules: { | ||
'escompatPlugin/no-dynamic-imports': 'off', | ||
'github/async-currenttarget': 'error', | ||
'github/async-preventdefault': 'error', | ||
'github/get-attribute': 'error', | ||
'github/no-blur': 'error', | ||
'github/no-dataset': 'error', | ||
'github/no-innerText': 'error', | ||
'github/no-inner-html': 'error', | ||
'github/unescaped-html-literal': 'error', | ||
'github/no-useless-passive': 'error', | ||
'github/require-passive-events': 'error', | ||
'github/prefer-observers': 'error', | ||
'importPlugin/no-nodejs-modules': 'error', | ||
'no-restricted-syntax': [ | ||
'error', | ||
{ | ||
selector: "NewExpression[callee.name='URL'][arguments.length=1]", | ||
message: 'Please pass in `window.location.origin` as the 2nd argument to `new URL()`', | ||
}, | ||
], | ||
}, | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const github = require('../../plugin') | ||
|
||
module.exports = { | ||
plugins: {github}, | ||
rules: { | ||
'github/authenticity-token': 'error', | ||
'github/js-class-name': 'error', | ||
'github/no-d-none': 'error', | ||
}, | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
const github = require('../../plugin') | ||
const jsxA11yPlugin = require('eslint-plugin-jsx-a11y') | ||
|
||
module.exports = { | ||
...jsxA11yPlugin.flatConfigs.recommended, | ||
languageOptions: { | ||
sourceType: 'module', | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
}, | ||
plugins: {github, jsxA11yPlugin}, | ||
rules: { | ||
'jsxA11yPlugin/role-supports-aria-props': 'off', // Override with github/a11y-role-supports-aria-props until https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/910 is resolved | ||
'github/a11y-aria-label-is-well-formatted': 'error', | ||
'github/a11y-no-visually-hidden-interactive-element': 'error', | ||
'github/a11y-no-title-attribute': 'error', | ||
'github/a11y-svg-has-accessible-name': 'error', | ||
'github/a11y-role-supports-aria-props': 'error', | ||
'jsxA11yPlugin/no-aria-hidden-on-focusable': 'error', | ||
'jsxA11yPlugin/no-autofocus': 'off', | ||
'jsxA11yPlugin/anchor-ambiguous-text': [ | ||
'error', | ||
{ | ||
words: ['this', 'more', 'read here', 'read more'], | ||
}, | ||
], | ||
'jsxA11yPlugin/no-interactive-element-to-noninteractive-role': [ | ||
'error', | ||
{ | ||
tr: ['none', 'presentation'], | ||
td: ['cell'], // TODO: Remove once https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/pull/937#issuecomment-1638128318 is addressed. | ||
canvas: ['img'], | ||
}, | ||
], | ||
'jsxA11yPlugin/no-redundant-roles': [ | ||
'error', | ||
{ | ||
nav: ['navigation'], // default in eslint-plugin-jsx-a11y | ||
tbody: ['rowgroup'], | ||
thead: ['rowgroup'], | ||
}, | ||
], | ||
}, | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
const globals = require('globals') | ||
const github = require('../../plugin') | ||
const prettierPlugin = require('eslint-plugin-prettier') | ||
const eslintComments = require('eslint-plugin-eslint-comments') | ||
const importPlugin = require('eslint-plugin-import') | ||
const filenames = require('eslint-plugin-filenames') | ||
const i18nTextPlugin = require('eslint-plugin-i18n-text') | ||
const noOnlyTestsPlugin = require('eslint-plugin-no-only-tests') | ||
const {fixupPluginRules} = require('@eslint/compat') | ||
|
||
module.exports = { | ||
languageOptions: { | ||
ecmaVersion: 6, | ||
sourceType: 'module', | ||
globals: { | ||
...globals.es6, | ||
}, | ||
}, | ||
plugins: { | ||
filenamesPlugin: fixupPluginRules(filenames), | ||
prettierPlugin, | ||
eslintComments, | ||
importPlugin, | ||
'i18n-text': fixupPluginRules(i18nTextPlugin), | ||
noOnlyTestsPlugin, | ||
github, | ||
}, | ||
rules: { | ||
'constructor-super': 'error', | ||
'eslintComments/disable-enable-pair': 'off', | ||
'eslintComments/no-aggregating-enable': 'off', | ||
'eslintComments/no-duplicate-disable': 'error', | ||
'eslintComments/no-unlimited-disable': 'error', | ||
'eslintComments/no-unused-disable': 'error', | ||
'eslintComments/no-unused-enable': 'error', | ||
'eslintComments/no-use': ['error', {allow: ['eslint', 'eslint-disable-next-line', 'eslint-env', 'globals']}], | ||
'filenamesPlugin/match-regex': ['error', '^[a-z0-9-]+(.[a-z0-9-]+)?$'], | ||
'func-style': ['error', 'declaration', {allowArrowFunctions: true}], | ||
'github/array-foreach': 'error', | ||
'github/no-implicit-buggy-globals': 'error', | ||
'github/no-then': 'error', | ||
'github/no-dynamic-script-tag': 'error', | ||
'i18n-text/no-en': ['error'], | ||
'importPlugin/default': 'error', | ||
'importPlugin/export': 'error', | ||
'importPlugin/extensions': 'error', | ||
'importPlugin/first': 'error', | ||
'importPlugin/named': 'error', | ||
'importPlugin/namespace': 'error', | ||
'importPlugin/no-absolute-path': 'error', | ||
'importPlugin/no-amd': 'error', | ||
'importPlugin/no-anonymous-default-export': [ | ||
'error', | ||
{ | ||
allowAnonymousClass: false, | ||
allowAnonymousFunction: false, | ||
allowArray: true, | ||
allowArrowFunction: false, | ||
allowLiteral: true, | ||
allowObject: true, | ||
}, | ||
], | ||
'importPlugin/no-commonjs': 'error', | ||
'importPlugin/no-deprecated': 'error', | ||
'importPlugin/no-duplicates': 'error', | ||
'importPlugin/no-dynamic-require': 'error', | ||
'importPlugin/no-extraneous-dependencies': [0, {devDependencies: false}], | ||
'importPlugin/no-mutable-exports': 'error', | ||
'importPlugin/no-named-as-default': 'error', | ||
'importPlugin/no-named-as-default-member': 'error', | ||
'importPlugin/no-namespace': 'error', | ||
'importPlugin/no-unresolved': 'error', | ||
'importPlugin/no-webpack-loader-syntax': 'error', | ||
'no-case-declarations': 'error', | ||
'no-class-assign': 'error', | ||
'no-compare-neg-zero': 'error', | ||
'no-cond-assign': 'error', | ||
'no-console': 'error', | ||
'no-const-assign': 'error', | ||
'no-constant-condition': 'error', | ||
'no-control-regex': 'error', | ||
'no-debugger': 'error', | ||
'no-delete-var': 'error', | ||
'no-dupe-args': 'error', | ||
'no-dupe-class-members': 'error', | ||
'no-dupe-keys': 'error', | ||
'no-duplicate-case': 'error', | ||
'no-empty': 'error', | ||
'no-empty-character-class': 'error', | ||
'no-empty-pattern': 'error', | ||
'no-ex-assign': 'error', | ||
'no-extra-boolean-cast': 'error', | ||
'no-fallthrough': 'error', | ||
'no-func-assign': 'error', | ||
'no-global-assign': 'error', | ||
'no-implicit-globals': 'error', | ||
'no-implied-eval': 'error', | ||
'no-inner-declarations': 'error', | ||
'no-invalid-regexp': 'error', | ||
'no-invalid-this': 'error', | ||
'no-irregular-whitespace': 'error', | ||
'no-new-symbol': 'error', | ||
'no-obj-calls': 'error', | ||
'no-octal': 'error', | ||
'noOnlyTestsPlugin/no-only-tests': [ | ||
'error', | ||
{ | ||
block: ['describe', 'it', 'context', 'test', 'tape', 'fixture', 'serial', 'suite'], | ||
}, | ||
], | ||
'no-redeclare': 'error', | ||
'no-regex-spaces': 'error', | ||
'no-return-assign': 'error', | ||
'no-self-assign': 'error', | ||
'no-sequences': ['error'], | ||
'no-shadow': 'error', | ||
'no-sparse-arrays': 'error', | ||
'no-this-before-super': 'error', | ||
'no-throw-literal': 'error', | ||
'no-undef': 'error', | ||
'no-unreachable': 'error', | ||
'no-unsafe-finally': 'error', | ||
'no-unsafe-negation': 'error', | ||
'no-unused-labels': 'error', | ||
'no-unused-vars': 'error', | ||
'no-useless-concat': 'error', | ||
'no-useless-escape': 'error', | ||
'no-var': 'error', | ||
'object-shorthand': ['error', 'always', {avoidQuotes: true}], | ||
'one-var': ['error', 'never'], | ||
'prefer-const': 'error', | ||
'prefer-promise-reject-errors': 'error', | ||
'prefer-rest-params': 'error', | ||
'prefer-spread': 'error', | ||
'prefer-template': 'error', | ||
'prettierPlugin/prettier': 'error', | ||
'require-yield': 'error', | ||
'use-isnan': 'error', | ||
'valid-typeof': 'error', | ||
camelcase: ['error', {properties: 'always'}], | ||
eqeqeq: ['error', 'smart'], | ||
}, | ||
settings: { | ||
'importPlugin/resolver': { | ||
node: { | ||
extensions: ['.js', '.ts'], | ||
}, | ||
}, | ||
}, | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const eslint = require('@eslint/js') | ||
const tseslint = require('typescript-eslint') | ||
const escompatPlugin = require('eslint-plugin-escompat') | ||
const github = require('../../plugin') | ||
|
||
module.exports = tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommended, { | ||
languageOptions: { | ||
parser: tseslint.parser, | ||
}, | ||
plugins: {'@typescript-eslint': tseslint.plugin, escompatPlugin, github}, | ||
rules: { | ||
camelcase: 'off', | ||
'no-unused-vars': 'off', | ||
'no-shadow': 'off', | ||
'no-invalid-this': 'off', | ||
'@typescript-eslint/no-invalid-this': ['error'], | ||
'@typescript-eslint/no-shadow': ['error'], | ||
'@typescript-eslint/interface-name-prefix': 'off', | ||
'@typescript-eslint/array-type': ['error', {default: 'array-simple'}], | ||
'@typescript-eslint/no-use-before-define': 'off', | ||
'@typescript-eslint/explicit-member-accessibility': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
'@typescript-eslint/no-unused-vars': 'error', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
}, | ||
}) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.