mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 23:22:02 +00:00
chore(lint): improve no-unused-vars rule (#1977)
This commit is contained in:
parent
232fdd8cf3
commit
c90bc50817
13
.eslintrc
13
.eslintrc
@ -35,6 +35,11 @@
|
|||||||
"message": "nitro should not directly import other packages."
|
"message": "nitro should not directly import other packages."
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
}],
|
||||||
|
"@typescript-eslint/no-unused-vars": ["error", {
|
||||||
|
"argsIgnorePattern": "^_",
|
||||||
|
"varsIgnorePattern": "^_",
|
||||||
|
"ignoreRestSiblings": true
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
@ -44,13 +49,5 @@
|
|||||||
"note": "note"
|
"note": "note"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"files": ["*.vue"],
|
|
||||||
"rules": {
|
|
||||||
"@typescript-eslint/no-unused-vars": "off"
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ export default {
|
|||||||
|
|
||||||
const tick = () => {
|
const tick = () => {
|
||||||
const elapsedTime = clock.getElapsedTime()
|
const elapsedTime = clock.getElapsedTime()
|
||||||
const deltaTime = elapsedTime - previousTime
|
const _deltaTime = elapsedTime - previousTime
|
||||||
previousTime = elapsedTime
|
previousTime = elapsedTime
|
||||||
if (gem) {
|
if (gem) {
|
||||||
gem.rotation.y = 1.1 * elapsedTime
|
gem.rotation.y = 1.1 * elapsedTime
|
||||||
|
@ -49,7 +49,6 @@ export interface NuxtAppCompat {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface Context {
|
export interface Context {
|
||||||
// eslint-disable-next-line
|
|
||||||
$_nuxtApp: NuxtAppCompat
|
$_nuxtApp: NuxtAppCompat
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,8 +74,7 @@ export function externals (opts: NodeExternalsOptions): Plugin {
|
|||||||
// // Find all unique package names
|
// // Find all unique package names
|
||||||
const pkgs = new Set<string>()
|
const pkgs = new Set<string>()
|
||||||
for (const file of tracedFiles) {
|
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'))
|
pkgs.add(resolve(baseDir, pkgName, 'package.json'))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,8 +8,7 @@ const PUBLIC_PATH = process.env.PUBLIC_PATH // Default: /_nuxt/
|
|||||||
const TWO_DAYS = 2 * 60 * 60 * 24
|
const TWO_DAYS = 2 * 60 * 60 * 24
|
||||||
const STATIC_ASSETS_BASE = process.env.NUXT_STATIC_BASE + '/' + process.env.NUXT_STATIC_VERSION
|
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) {
|
||||||
export default async function serveStatic(req, res) {
|
|
||||||
if (!METHODS.includes(req.method)) {
|
if (!METHODS.includes(req.method)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import { useMeta } from './composables'
|
|||||||
type Props = Readonly<Record<string, any>>
|
type Props = Readonly<Record<string, any>>
|
||||||
|
|
||||||
const removeUndefinedProps = (props: Props) =>
|
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) => {
|
const setupForUseMeta = (metaFactory: (props: Props, ctx: SetupContext) => Record<string, any>, renderChild?: boolean) => (props: Props, ctx: SetupContext) => {
|
||||||
useMeta(() => metaFactory({ ...removeUndefinedProps(props), ...ctx.attrs }, ctx))
|
useMeta(() => metaFactory({ ...removeUndefinedProps(props), ...ctx.attrs }, ctx))
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getCurrentInstance, ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
|
|
||||||
import NuxtLayout from './layout'
|
import NuxtLayout from './layout'
|
||||||
import { useNuxtApp } from '#app'
|
import { useNuxtApp } from '#app'
|
||||||
|
@ -8,7 +8,6 @@ export function analyzePlugin (ctx: ViteBuildContext): Plugin[] {
|
|||||||
{
|
{
|
||||||
name: 'nuxt-analyze-minify',
|
name: 'nuxt-analyze-minify',
|
||||||
async generateBundle (_opts, outputBundle) {
|
async generateBundle (_opts, outputBundle) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
for (const [_bundleId, bundle] of Object.entries(outputBundle)) {
|
for (const [_bundleId, bundle] of Object.entries(outputBundle)) {
|
||||||
if (bundle.type !== 'chunk') { continue }
|
if (bundle.type !== 'chunk') { continue }
|
||||||
const originalEntries = Object.entries(bundle.modules)
|
const originalEntries = Object.entries(bundle.modules)
|
||||||
|
@ -92,7 +92,7 @@ module.exports = (api, options = {}) => {
|
|||||||
(corejs.version === 2 && isCorejs3Hoisted)
|
(corejs.version === 2 && isCorejs3Hoisted)
|
||||||
) {
|
) {
|
||||||
// eslint-disable-next-line no-console
|
// 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 = {
|
const defaultTargets = {
|
||||||
|
@ -201,7 +201,6 @@ class WebpackBundler {
|
|||||||
|
|
||||||
const { name } = compiler.options
|
const { name } = compiler.options
|
||||||
const buildOptions = this.nuxt.options.build
|
const buildOptions = this.nuxt.options.build
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
const { client, ...hotMiddlewareOptions } = buildOptions.hotMiddleware || {}
|
const { client, ...hotMiddlewareOptions } = buildOptions.hotMiddleware || {}
|
||||||
|
|
||||||
// Create webpack dev middleware
|
// Create webpack dev middleware
|
||||||
|
Loading…
Reference in New Issue
Block a user