-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate ESLint to use new flat config (Fixes #42)
- Loading branch information
1 parent
e43de00
commit 8e8144e
Showing
7 changed files
with
171 additions
and
64 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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 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,94 @@ | ||
const js = require('@eslint/js'); | ||
const globals = require('globals'); | ||
const eslintConfigPrettier = require('eslint-config-prettier'); | ||
|
||
const rules = { | ||
// Use type-safe equality operators | ||
// https://eslint.org/docs/rules/eqeqeq | ||
eqeqeq: ['error', 'always'], | ||
|
||
// Treat var statements as if they were block scoped | ||
// https://eslint.org/docs/rules/block-scoped-var | ||
'block-scoped-var': 'error', | ||
|
||
// Disallow Use of alert, confirm, prompt | ||
// https://eslint.org/docs/rules/no-alert | ||
'no-alert': 'error', | ||
|
||
// Disallow eval() | ||
// https://eslint.org/docs/rules/no-eval | ||
'no-eval': 'error', | ||
|
||
// Disallow empty functions | ||
// https://eslint.org/docs/rules/no-empty-function | ||
'no-empty-function': 'error', | ||
|
||
// Require radix parameter | ||
// https://eslint.org/docs/rules/radix | ||
radix: 'error', | ||
|
||
// Disallow the use of `console` | ||
// https://eslint.org/docs/rules/no-console | ||
'no-console': 'error' | ||
}; | ||
|
||
module.exports = [ | ||
js.configs.recommended, | ||
eslintConfigPrettier, | ||
{ | ||
ignores: ['dist/**/*.js', 'demo/libs/**/*.js'] | ||
}, | ||
{ | ||
files: ['src/**/*.js'], | ||
languageOptions: { | ||
ecmaVersion: 2017, | ||
globals: { | ||
Mozilla: true, | ||
...globals.browser, | ||
...globals.commonjs | ||
} | ||
}, | ||
rules: rules | ||
}, | ||
{ | ||
files: ['demo/**/*.js'], | ||
languageOptions: { | ||
ecmaVersion: 'latest', | ||
globals: { | ||
Mozilla: true, | ||
...globals.browser, | ||
...globals.node, | ||
...globals.commonjs | ||
} | ||
}, | ||
rules: rules | ||
}, | ||
{ | ||
files: ['tests/**/*.js'], | ||
languageOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
globals: { | ||
Mozilla: true, | ||
...globals.browser, | ||
...globals.jasmine | ||
} | ||
}, | ||
rules: rules | ||
}, | ||
{ | ||
files: [ | ||
'webpack.config.js', | ||
'webpack.test.config.js', | ||
'eslint.config.js' | ||
], | ||
languageOptions: { | ||
ecmaVersion: 'latest', | ||
globals: { | ||
...globals.node, | ||
...globals.commonjs | ||
} | ||
}, | ||
rules: rules | ||
} | ||
]; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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