丶远方
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
10 additions and
6 deletions
-
.eslintrc.cjs
|
|
@ -1,3 +1,5 @@ |
|
|
|
/* eslint-disable no-restricted-globals */ |
|
|
|
|
|
|
|
const DOMGlobals = ['window', 'document'] |
|
|
|
const NodeGlobals = ['module', 'require'] |
|
|
|
|
|
|
@ -9,12 +11,6 @@ module.exports = { |
|
|
|
plugins: ['jest'], |
|
|
|
rules: { |
|
|
|
'no-debugger': 'error', |
|
|
|
'no-unused-vars': [ |
|
|
|
'error', |
|
|
|
// we are only using this rule to check for unused arguments since TS |
|
|
|
// catches unused variables but not args. |
|
|
|
{ varsIgnorePattern: '.*', args: 'none' } |
|
|
|
], |
|
|
|
// most of the codebase are expected to be env agnostic |
|
|
|
'no-restricted-globals': ['error', ...DOMGlobals, ...NodeGlobals], |
|
|
|
|
|
|
@ -72,6 +68,14 @@ module.exports = { |
|
|
|
'no-restricted-syntax': 'off' |
|
|
|
} |
|
|
|
}, |
|
|
|
// JavaScript files |
|
|
|
{ |
|
|
|
files: ['*.js', '*.cjs'], |
|
|
|
rules: { |
|
|
|
// We only do `no-unused-vars` checks for js files, TS files are checked by TypeScript itself. |
|
|
|
'no-unused-vars': ['error', { vars: 'all', args: 'none' }] |
|
|
|
} |
|
|
|
}, |
|
|
|
// Node scripts |
|
|
|
{ |
|
|
|
files: ['scripts/**', '*.{js,ts}', 'packages/**/index.js'], |
|
|
|