]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore(eslint): update eslint `no-unused-vars` rules (#9028)
author丶远方 <yangpanteng@gmail.com>
Fri, 20 Oct 2023 09:50:50 +0000 (17:50 +0800)
committerGitHub <noreply@github.com>
Fri, 20 Oct 2023 09:50:50 +0000 (17:50 +0800)
.eslintrc.cjs

index 04ecf049ca9ccadbefca598bf41410be37d101d4..4296d0f39b6a0bdc57923869bd3ad2e2a2ee643a 100644 (file)
@@ -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'],