mirror of https://github.com/vuejs/core.git
chore(eslint): update eslint `no-unused-vars` rules (#9028)
This commit is contained in:
parent
df81da8be9
commit
aacb66def4
|
@ -1,3 +1,5 @@
|
||||||
|
/* eslint-disable no-restricted-globals */
|
||||||
|
|
||||||
const DOMGlobals = ['window', 'document']
|
const DOMGlobals = ['window', 'document']
|
||||||
const NodeGlobals = ['module', 'require']
|
const NodeGlobals = ['module', 'require']
|
||||||
|
|
||||||
|
@ -9,12 +11,6 @@ module.exports = {
|
||||||
plugins: ['jest'],
|
plugins: ['jest'],
|
||||||
rules: {
|
rules: {
|
||||||
'no-debugger': 'error',
|
'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
|
// most of the codebase are expected to be env agnostic
|
||||||
'no-restricted-globals': ['error', ...DOMGlobals, ...NodeGlobals],
|
'no-restricted-globals': ['error', ...DOMGlobals, ...NodeGlobals],
|
||||||
|
|
||||||
|
@ -72,6 +68,14 @@ module.exports = {
|
||||||
'no-restricted-syntax': 'off'
|
'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
|
// Node scripts
|
||||||
{
|
{
|
||||||
files: ['scripts/**', '*.{js,ts}', 'packages/**/index.js'],
|
files: ['scripts/**', '*.{js,ts}', 'packages/**/index.js'],
|
||||||
|
|
Loading…
Reference in New Issue