chore(lint): improve no-unused-vars rule (#1977)

This commit is contained in:
Xin Du (Clark) 2021-11-17 11:21:38 +00:00 committed by GitHub
parent 232fdd8cf3
commit c90bc50817
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 12 additions and 20 deletions

View File

@ -35,6 +35,11 @@
"message": "nitro should not directly import other packages."
}
]
}],
"@typescript-eslint/no-unused-vars": ["error", {
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"ignoreRestSiblings": true
}]
},
"settings": {
@ -44,13 +49,5 @@
"note": "note"
}
}
},
"overrides": [
{
"files": ["*.vue"],
"rules": {
"@typescript-eslint/no-unused-vars": "off"
}
}
]
}

View File

@ -101,7 +101,7 @@ export default {
const tick = () => {
const elapsedTime = clock.getElapsedTime()
const deltaTime = elapsedTime - previousTime
const _deltaTime = elapsedTime - previousTime
previousTime = elapsedTime
if (gem) {
gem.rotation.y = 1.1 * elapsedTime

View File

@ -49,7 +49,6 @@ export interface NuxtAppCompat {
}
export interface Context {
// eslint-disable-next-line
$_nuxtApp: NuxtAppCompat
}

View File

@ -74,8 +74,7 @@ export function externals (opts: NodeExternalsOptions): Plugin {
// // Find all unique package names
const pkgs = new Set<string>()
for (const file of tracedFiles) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [_, baseDir, pkgName, _importPath] = /^(.+\/node_modules\/)([^@/]+|@[^/]+\/[^/]+)(\/?.*?)?$/.exec(file)
const [, baseDir, pkgName, _importPath] = /^(.+\/node_modules\/)([^@/]+|@[^/]+\/[^/]+)(\/?.*?)?$/.exec(file)
pkgs.add(resolve(baseDir, pkgName, 'package.json'))
}

View File

@ -8,7 +8,6 @@ const PUBLIC_PATH = process.env.PUBLIC_PATH // Default: /_nuxt/
const TWO_DAYS = 2 * 60 * 60 * 24
const STATIC_ASSETS_BASE = process.env.NUXT_STATIC_BASE + '/' + process.env.NUXT_STATIC_VERSION
// eslint-disable-next-line
export default async function serveStatic (req, res) {
if (!METHODS.includes(req.method)) {
return

View File

@ -5,7 +5,7 @@ import { useMeta } from './composables'
type Props = Readonly<Record<string, any>>
const removeUndefinedProps = (props: Props) =>
Object.fromEntries(Object.entries(props).filter(([_key, value]) => value !== undefined))
Object.fromEntries(Object.entries(props).filter(([, value]) => value !== undefined))
const setupForUseMeta = (metaFactory: (props: Props, ctx: SetupContext) => Record<string, any>, renderChild?: boolean) => (props: Props, ctx: SetupContext) => {
useMeta(() => metaFactory({ ...removeUndefinedProps(props), ...ctx.attrs }, ctx))

View File

@ -14,7 +14,7 @@
</template>
<script>
import { getCurrentInstance, ref } from 'vue'
import { ref } from 'vue'
import NuxtLayout from './layout'
import { useNuxtApp } from '#app'

View File

@ -8,7 +8,6 @@ export function analyzePlugin (ctx: ViteBuildContext): Plugin[] {
{
name: 'nuxt-analyze-minify',
async generateBundle (_opts, outputBundle) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
for (const [_bundleId, bundle] of Object.entries(outputBundle)) {
if (bundle.type !== 'chunk') { continue }
const originalEntries = Object.entries(bundle.modules)

View File

@ -92,7 +92,7 @@ module.exports = (api, options = {}) => {
(corejs.version === 2 && isCorejs3Hoisted)
) {
// eslint-disable-next-line no-console
(console.fatal || console.error)(`babel corejs option is ${corejs.version}, please directlly install core-js@${corejs.version}.`)
(console.fatal || console.error)(`babel corejs option is ${corejs.version}, please directly install core-js@${corejs.version}.`)
}
const defaultTargets = {

View File

@ -201,7 +201,6 @@ class WebpackBundler {
const { name } = compiler.options
const buildOptions = this.nuxt.options.build
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { client, ...hotMiddlewareOptions } = buildOptions.hotMiddleware || {}
// Create webpack dev middleware