Skip to content
Permalink
Browse files

Remove unused variable (#13716)

Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
  • Loading branch information
timneutkens and Timer committed Jun 3, 2020
1 parent 34f82a9 commit 0fc344e6a3ae5a9321b654da95d7d3bec1ac1897
@@ -22,16 +22,6 @@
"import/internal-regex": "^next/"
},
"overrides": [
{
"files": ["packages/**"],
"rules": {
"no-shadow": ["warn", { "builtinGlobals": false }],
"import/no-extraneous-dependencies": [
"error",
{ "devDependencies": false }
]
}
},
{
"files": ["test/**/*.test.js"],
"extends": ["plugin:jest/recommended"],
@@ -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": {
@@ -8,13 +8,13 @@ export default function ({
return {
inherits: require('babel-plugin-syntax-jsx'),
visitor: {
JSXElement(path, state) {
JSXElement(_path, state) {
state.set('jsx', true)
},

// Fragment syntax is still JSX since it compiles to createElement(),
// but JSXFragment is not a JSXElement
JSXFragment(path, state) {
JSXFragment(_path, state) {
state.set('jsx', true)
},

@@ -62,7 +62,6 @@ type Entrypoints = {
}

export function createEntrypoints(
dev: boolean,
pages: PagesMapping,
target: 'server' | 'serverless' | 'experimental-serverless-trace',
buildId: string,
@@ -213,7 +213,6 @@ export default async function build(dir: string, conf = null): Promise<void> {

const mappedPages = createPagesMapping(pagePaths, config.pageExtensions)
const entrypoints = createEntrypoints(
/* dev */ false,
mappedPages,
target,
buildId,
@@ -1,7 +1,7 @@
import { loader } from 'webpack'
import hash from 'next/dist/compiled/string-hash'
import { basename } from 'path'
const nextDataLoader: loader.Loader = function (source) {
const nextDataLoader: loader.Loader = function () {
const filename = this.resourcePath
return `
import {createHook} from 'next/data'
@@ -12,7 +12,7 @@ export const pluginLoaderOptions: {
plugins: [],
}

const nextPluginLoader: loader.Loader = function (source) {
const nextPluginLoader: loader.Loader = function () {
const { middleware }: NextPluginLoaderQuery =
typeof this.query === 'string' ? parse(this.query.substr(1)) : this.query

@@ -368,7 +368,7 @@ export default class NextEsmPlugin implements Plugin {
setTimeout(() => {
this.updateOptions(childCompiler)

childCompiler.runAsChild((err, entries, childCompilation) => {
childCompiler.runAsChild((err, _entries, childCompilation) => {
if (err) {
return reject(err)
}
@@ -137,13 +137,15 @@ const interceptAllParserHooks = (moduleFactory: any, tracer: any) => {
moduleTypes.forEach((moduleType) => {
moduleFactory.hooks.parser
.for(moduleType)
.tap('ProfilingPlugin', (parser: any, parserOpts: any) => {
.tap('ProfilingPlugin', (parser: any) => {
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) => {
const newFn = makeNewProfiledTapFn(hookName, tracer, {
name,
@@ -172,7 +174,7 @@ const makeInterceptorFor = (instance: any, tracer: any) => (hookName: any) => ({
* @returns {PluginFunction} Chainable hooked function.
*/
const makeNewProfiledTapFn = (
hookName: any,
_hookName: any,
tracer: any,
{ name, type, fn }: any
) => {
@@ -154,7 +154,7 @@ export class DuplicatePolyfillsConformanceCheck
},
{
visitor: 'visitCallExpression',
inspectNode: (path: NodePath, { request }: IParsedModuleDetails) => {
inspectNode: (path: NodePath) => {
const { node }: { node: types.namedTypes.CallExpression } = path
if (!node.arguments || node.arguments.length < 2) {
return EARLY_EXIT_SUCCESS_RESULT
@@ -49,7 +49,7 @@ export default class WebpackConformancePlugin {
}

private buildStartedHandler = (
compilation: CompilationType.Compilation,
_compilation: CompilationType.Compilation,
callback: () => void
) => {
const buildStartedResults: IConformanceTestResult[] = this.tests.map(
@@ -13,7 +13,7 @@ export default async ({ assetPrefix }) => {

// prevent HMR connection from being closed when running tests
if (!process.env.__NEXT_TEST_MODE) {
document.addEventListener('visibilitychange', (event) => {
document.addEventListener('visibilitychange', (_event) => {
const state = document.visibilityState
if (state === 'visible') {
setupPing(assetPrefix, () => Router.pathname, true)
@@ -28,7 +28,7 @@ const webpackHMR = initWebpackHMR({ assetPrefix: prefix })

window.next = next
initNext({ webpackHMR })
.then(({ emitter, renderCtx, render }) => {
.then(({ renderCtx, render }) => {
initOnDemandEntries({ assetPrefix: prefix })
if (process.env.__NEXT_BUILD_INDICATOR) initializeBuildWatcher()
if (
@@ -252,8 +252,7 @@ class LoadableSubscription {
this._update({})
this._clearTimeouts()
})
// eslint-disable-next-line handle-callback-err
.catch((err) => {
.catch((_err) => {
this._update({})
this._clearTimeouts()
})
@@ -475,7 +475,7 @@ export default class Server {
type,
match: getCustomRouteMatcher(r.source),
name: type,
fn: async (req, res, params, parsedUrl) => ({ finished: false }),
fn: async (_req, _res, _params, _parsedUrl) => ({ finished: false }),
} as Route & Rewrite & Header)

const updateHeaderValue = (value: string, params: Params): string => {
@@ -672,7 +672,7 @@ export default class Server {
}

// 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
@@ -265,7 +265,6 @@ export default class HotReloader {
this.config.pageExtensions
)
const entrypoints = createEntrypoints(
/* dev */ true,
pages,
'server',
this.buildId,
@@ -135,7 +135,7 @@ export default class DevServer extends Server {
match: route(path),
type: 'route',
name: `${path} exportpathmap route`,
fn: async (req, res, params, parsedUrl) => {
fn: async (req, res, _params, parsedUrl) => {
const { query: urlQuery } = parsedUrl

Object.keys(urlQuery)
@@ -681,7 +681,7 @@ export async function pages_document(task) {
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'])
}

@@ -54,7 +54,7 @@ function ReactDevOverlay({ children }) {
}, [dispatch])

const onComponentError = React.useCallback(
(error: Error, componentStack: string | null) => {
(_error: Error, _componentStack: string | null) => {
// TODO: special handling
},
[]
@@ -11,7 +11,7 @@ function webpack4(compiler: Compiler) {
const hookRequire: typeof compilation['mainTemplate']['hooks']['requireExtensions'] = (compilation
.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:
// ```
// modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));

0 comments on commit 0fc344e

Please sign in to comment.