Skip to content

Commit

Permalink
Remove unused variable (#13716)
Browse files Browse the repository at this point in the history
Co-authored-by: Joe Haddad <[email protected]>
  • Loading branch information
timneutkens and Timer authored Jun 3, 2020
1 parent 34f82a9 commit 0fc344e
Show file tree
Hide file tree
Showing 19 changed files with 44 additions and 33 deletions.
33 changes: 23 additions & 10 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down Expand Up @@ -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": {
Expand Down
4 changes: 2 additions & 2 deletions packages/next/build/babel/plugins/jsx-pragma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},

Expand Down
1 change: 0 additions & 1 deletion packages/next/build/entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ type Entrypoints = {
}

export function createEntrypoints(
dev: boolean,
pages: PagesMapping,
target: 'server' | 'serverless' | 'experimental-serverless-trace',
buildId: string,
Expand Down
1 change: 0 additions & 1 deletion packages/next/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/next/build/webpack/loaders/next-data-loader.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion packages/next/build/webpack/loaders/next-plugin-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion packages/next/build/webpack/plugins/next-esm-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
8 changes: 5 additions & 3 deletions packages/next/build/webpack/plugins/profiling-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default class WebpackConformancePlugin {
}

private buildStartedHandler = (
compilation: CompilationType.Compilation,
_compilation: CompilationType.Compilation,
callback: () => void
) => {
const buildStartedResults: IConformanceTestResult[] = this.tests.map(
Expand Down
2 changes: 1 addition & 1 deletion packages/next/client/dev/on-demand-entries-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion packages/next/client/next-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
3 changes: 1 addition & 2 deletions packages/next/next-server/lib/loadable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
Expand Down
4 changes: 2 additions & 2 deletions packages/next/next-server/server/next-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion packages/next/server/hot-reloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ export default class HotReloader {
this.config.pageExtensions
)
const entrypoints = createEntrypoints(
/* dev */ true,
pages,
'server',
this.buildId,
Expand Down
2 changes: 1 addition & 1 deletion packages/next/server/next-dev-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion packages/next/taskfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
[]
Expand Down
2 changes: 1 addition & 1 deletion packages/react-refresh-utils/ReactRefreshWebpackPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 0fc344e

Please sign in to comment.