未验证 提交 0fc344e6 编写于 作者: T Tim Neutkens 提交者: GitHub

Remove unused variable (#13716)

Co-authored-by: NJoe Haddad <joe.haddad@zeit.co>
上级 34f82a99
...@@ -22,16 +22,6 @@ ...@@ -22,16 +22,6 @@
"import/internal-regex": "^next/" "import/internal-regex": "^next/"
}, },
"overrides": [ "overrides": [
{
"files": ["packages/**"],
"rules": {
"no-shadow": ["warn", { "builtinGlobals": false }],
"import/no-extraneous-dependencies": [
"error",
{ "devDependencies": false }
]
}
},
{ {
"files": ["test/**/*.test.js"], "files": ["test/**/*.test.js"],
"extends": ["plugin:jest/recommended"], "extends": ["plugin:jest/recommended"],
...@@ -121,6 +111,29 @@ ...@@ -121,6 +111,29 @@
} }
] ]
} }
},
{
"files": ["packages/**"],
"rules": {
"no-shadow": ["warn", { "builtinGlobals": false }],
"import/no-extraneous-dependencies": [
"error",
{ "devDependencies": false }
]
}
},
{
"files": ["packages/**/*.tsx", "packages/**/*.ts"],
"rules": {
"@typescript-eslint/no-unused-vars": [
"warn",
{
"args": "all",
"argsIgnorePattern": "^_",
"ignoreRestSiblings": true
}
]
}
} }
], ],
"rules": { "rules": {
......
...@@ -8,13 +8,13 @@ export default function ({ ...@@ -8,13 +8,13 @@ export default function ({
return { return {
inherits: require('babel-plugin-syntax-jsx'), inherits: require('babel-plugin-syntax-jsx'),
visitor: { visitor: {
JSXElement(path, state) { JSXElement(_path, state) {
state.set('jsx', true) state.set('jsx', true)
}, },
// Fragment syntax is still JSX since it compiles to createElement(), // Fragment syntax is still JSX since it compiles to createElement(),
// but JSXFragment is not a JSXElement // but JSXFragment is not a JSXElement
JSXFragment(path, state) { JSXFragment(_path, state) {
state.set('jsx', true) state.set('jsx', true)
}, },
......
...@@ -62,7 +62,6 @@ type Entrypoints = { ...@@ -62,7 +62,6 @@ type Entrypoints = {
} }
export function createEntrypoints( export function createEntrypoints(
dev: boolean,
pages: PagesMapping, pages: PagesMapping,
target: 'server' | 'serverless' | 'experimental-serverless-trace', target: 'server' | 'serverless' | 'experimental-serverless-trace',
buildId: string, buildId: string,
......
...@@ -213,7 +213,6 @@ export default async function build(dir: string, conf = null): Promise<void> { ...@@ -213,7 +213,6 @@ export default async function build(dir: string, conf = null): Promise<void> {
const mappedPages = createPagesMapping(pagePaths, config.pageExtensions) const mappedPages = createPagesMapping(pagePaths, config.pageExtensions)
const entrypoints = createEntrypoints( const entrypoints = createEntrypoints(
/* dev */ false,
mappedPages, mappedPages,
target, target,
buildId, buildId,
......
import { loader } from 'webpack' import { loader } from 'webpack'
import hash from 'next/dist/compiled/string-hash' import hash from 'next/dist/compiled/string-hash'
import { basename } from 'path' import { basename } from 'path'
const nextDataLoader: loader.Loader = function (source) { const nextDataLoader: loader.Loader = function () {
const filename = this.resourcePath const filename = this.resourcePath
return ` return `
import {createHook} from 'next/data' import {createHook} from 'next/data'
......
...@@ -12,7 +12,7 @@ export const pluginLoaderOptions: { ...@@ -12,7 +12,7 @@ export const pluginLoaderOptions: {
plugins: [], plugins: [],
} }
const nextPluginLoader: loader.Loader = function (source) { const nextPluginLoader: loader.Loader = function () {
const { middleware }: NextPluginLoaderQuery = const { middleware }: NextPluginLoaderQuery =
typeof this.query === 'string' ? parse(this.query.substr(1)) : this.query typeof this.query === 'string' ? parse(this.query.substr(1)) : this.query
......
...@@ -368,7 +368,7 @@ export default class NextEsmPlugin implements Plugin { ...@@ -368,7 +368,7 @@ export default class NextEsmPlugin implements Plugin {
setTimeout(() => { setTimeout(() => {
this.updateOptions(childCompiler) this.updateOptions(childCompiler)
childCompiler.runAsChild((err, entries, childCompilation) => { childCompiler.runAsChild((err, _entries, childCompilation) => {
if (err) { if (err) {
return reject(err) return reject(err)
} }
......
...@@ -137,13 +137,15 @@ const interceptAllParserHooks = (moduleFactory: any, tracer: any) => { ...@@ -137,13 +137,15 @@ const interceptAllParserHooks = (moduleFactory: any, tracer: any) => {
moduleTypes.forEach((moduleType) => { moduleTypes.forEach((moduleType) => {
moduleFactory.hooks.parser moduleFactory.hooks.parser
.for(moduleType) .for(moduleType)
.tap('ProfilingPlugin', (parser: any, parserOpts: any) => { .tap('ProfilingPlugin', (parser: any) => {
interceptAllHooksFor(parser, tracer, 'Parser') interceptAllHooksFor(parser, tracer, 'Parser')
}) })
}) })
} }
const makeInterceptorFor = (instance: any, tracer: any) => (hookName: any) => ({ const makeInterceptorFor = (_instance: any, tracer: any) => (
hookName: any
) => ({
register: ({ name, type, context, fn }: any) => { register: ({ name, type, context, fn }: any) => {
const newFn = makeNewProfiledTapFn(hookName, tracer, { const newFn = makeNewProfiledTapFn(hookName, tracer, {
name, name,
...@@ -172,7 +174,7 @@ const makeInterceptorFor = (instance: any, tracer: any) => (hookName: any) => ({ ...@@ -172,7 +174,7 @@ const makeInterceptorFor = (instance: any, tracer: any) => (hookName: any) => ({
* @returns {PluginFunction} Chainable hooked function. * @returns {PluginFunction} Chainable hooked function.
*/ */
const makeNewProfiledTapFn = ( const makeNewProfiledTapFn = (
hookName: any, _hookName: any,
tracer: any, tracer: any,
{ name, type, fn }: any { name, type, fn }: any
) => { ) => {
......
...@@ -154,7 +154,7 @@ export class DuplicatePolyfillsConformanceCheck ...@@ -154,7 +154,7 @@ export class DuplicatePolyfillsConformanceCheck
}, },
{ {
visitor: 'visitCallExpression', visitor: 'visitCallExpression',
inspectNode: (path: NodePath, { request }: IParsedModuleDetails) => { inspectNode: (path: NodePath) => {
const { node }: { node: types.namedTypes.CallExpression } = path const { node }: { node: types.namedTypes.CallExpression } = path
if (!node.arguments || node.arguments.length < 2) { if (!node.arguments || node.arguments.length < 2) {
return EARLY_EXIT_SUCCESS_RESULT return EARLY_EXIT_SUCCESS_RESULT
......
...@@ -49,7 +49,7 @@ export default class WebpackConformancePlugin { ...@@ -49,7 +49,7 @@ export default class WebpackConformancePlugin {
} }
private buildStartedHandler = ( private buildStartedHandler = (
compilation: CompilationType.Compilation, _compilation: CompilationType.Compilation,
callback: () => void callback: () => void
) => { ) => {
const buildStartedResults: IConformanceTestResult[] = this.tests.map( const buildStartedResults: IConformanceTestResult[] = this.tests.map(
......
...@@ -13,7 +13,7 @@ export default async ({ assetPrefix }) => { ...@@ -13,7 +13,7 @@ export default async ({ assetPrefix }) => {
// prevent HMR connection from being closed when running tests // prevent HMR connection from being closed when running tests
if (!process.env.__NEXT_TEST_MODE) { if (!process.env.__NEXT_TEST_MODE) {
document.addEventListener('visibilitychange', (event) => { document.addEventListener('visibilitychange', (_event) => {
const state = document.visibilityState const state = document.visibilityState
if (state === 'visible') { if (state === 'visible') {
setupPing(assetPrefix, () => Router.pathname, true) setupPing(assetPrefix, () => Router.pathname, true)
......
...@@ -28,7 +28,7 @@ const webpackHMR = initWebpackHMR({ assetPrefix: prefix }) ...@@ -28,7 +28,7 @@ const webpackHMR = initWebpackHMR({ assetPrefix: prefix })
window.next = next window.next = next
initNext({ webpackHMR }) initNext({ webpackHMR })
.then(({ emitter, renderCtx, render }) => { .then(({ renderCtx, render }) => {
initOnDemandEntries({ assetPrefix: prefix }) initOnDemandEntries({ assetPrefix: prefix })
if (process.env.__NEXT_BUILD_INDICATOR) initializeBuildWatcher() if (process.env.__NEXT_BUILD_INDICATOR) initializeBuildWatcher()
if ( if (
......
...@@ -252,8 +252,7 @@ class LoadableSubscription { ...@@ -252,8 +252,7 @@ class LoadableSubscription {
this._update({}) this._update({})
this._clearTimeouts() this._clearTimeouts()
}) })
// eslint-disable-next-line handle-callback-err .catch((_err) => {
.catch((err) => {
this._update({}) this._update({})
this._clearTimeouts() this._clearTimeouts()
}) })
......
...@@ -475,7 +475,7 @@ export default class Server { ...@@ -475,7 +475,7 @@ export default class Server {
type, type,
match: getCustomRouteMatcher(r.source), match: getCustomRouteMatcher(r.source),
name: type, name: type,
fn: async (req, res, params, parsedUrl) => ({ finished: false }), fn: async (_req, _res, _params, _parsedUrl) => ({ finished: false }),
} as Route & Rewrite & Header) } as Route & Rewrite & Header)
const updateHeaderValue = (value: string, params: Params): string => { const updateHeaderValue = (value: string, params: Params): string => {
...@@ -672,7 +672,7 @@ export default class Server { ...@@ -672,7 +672,7 @@ export default class Server {
} }
// Used to build API page in development // Used to build API page in development
protected async ensureApiPage(pathname: string): Promise<void> {} protected async ensureApiPage(_pathname: string): Promise<void> {}
/** /**
* Resolves `API` request, in development builds on demand * Resolves `API` request, in development builds on demand
......
...@@ -265,7 +265,6 @@ export default class HotReloader { ...@@ -265,7 +265,6 @@ export default class HotReloader {
this.config.pageExtensions this.config.pageExtensions
) )
const entrypoints = createEntrypoints( const entrypoints = createEntrypoints(
/* dev */ true,
pages, pages,
'server', 'server',
this.buildId, this.buildId,
......
...@@ -135,7 +135,7 @@ export default class DevServer extends Server { ...@@ -135,7 +135,7 @@ export default class DevServer extends Server {
match: route(path), match: route(path),
type: 'route', type: 'route',
name: `${path} exportpathmap route`, name: `${path} exportpathmap route`,
fn: async (req, res, params, parsedUrl) => { fn: async (req, res, _params, parsedUrl) => {
const { query: urlQuery } = parsedUrl const { query: urlQuery } = parsedUrl
Object.keys(urlQuery) Object.keys(urlQuery)
......
...@@ -681,7 +681,7 @@ export async function pages_document(task) { ...@@ -681,7 +681,7 @@ export async function pages_document(task) {
await task.source('pages/_document.tsx').babel('server').target('dist/pages') await task.source('pages/_document.tsx').babel('server').target('dist/pages')
} }
export async function pages(task, opts) { export async function pages(task, _opts) {
await task.parallel(['pages_app', 'pages_error', 'pages_document']) await task.parallel(['pages_app', 'pages_error', 'pages_document'])
} }
......
...@@ -54,7 +54,7 @@ function ReactDevOverlay({ children }) { ...@@ -54,7 +54,7 @@ function ReactDevOverlay({ children }) {
}, [dispatch]) }, [dispatch])
const onComponentError = React.useCallback( const onComponentError = React.useCallback(
(error: Error, componentStack: string | null) => { (_error: Error, _componentStack: string | null) => {
// TODO: special handling // TODO: special handling
}, },
[] []
......
...@@ -11,7 +11,7 @@ function webpack4(compiler: Compiler) { ...@@ -11,7 +11,7 @@ function webpack4(compiler: Compiler) {
const hookRequire: typeof compilation['mainTemplate']['hooks']['requireExtensions'] = (compilation const hookRequire: typeof compilation['mainTemplate']['hooks']['requireExtensions'] = (compilation
.mainTemplate.hooks as any).require .mainTemplate.hooks as any).require
hookRequire.tap('ReactFreshWebpackPlugin', (source, chunk, hash) => { hookRequire.tap('ReactFreshWebpackPlugin', (source, _chunk, _hash) => {
// Webpack 4 evaluates module code on the following line: // Webpack 4 evaluates module code on the following line:
// ``` // ```
// modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId)); // modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册