Unverified Commit 6feaddf7 authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

Remove unused `eslint-disable` directives (#84797)

Co-authored-by: 's avatarHendrik Liebau <mail@hendrik-liebau.de>
parent 91e660d2
/* eslint-disable import/no-extraneous-dependencies */
import { execSync } from 'node:child_process'
import { join } from 'node:path'
import { rmSync } from 'node:fs'
......
......@@ -40,7 +40,6 @@ function minDistance(a, b) {
return previousRow[previousRow.length - 1]
}
/* eslint-disable eslint-plugin/require-meta-docs-url */
export default defineRule({
meta: {
docs: {
......
// eslint-disable-next-line import/no-extraneous-dependencies
// @ts-expect-error File exists
import asyncRetry from 'next/dist/compiled/async-retry'
......
// @ts-ignore
// eslint-disable-next-line import/no-extraneous-dependencies
let fontFromBuffer: any
try {
// eslint-disable-next-line @next/internal/typechecked-require -- Module created during build.
......
/* eslint-disable no-extend-native, no-sequences */
/* eslint-disable no-extend-native */
// Contains polyfills for methods missing after browser version(s):
// Edge 16, Firefox 60, Chrome 61, Safari 10.1
......
......@@ -5,8 +5,6 @@ import type { NextBabelLoaderOptions } from './babel/loader/types'
function getReactCompiler() {
try {
// It's in peerDependencies, so it should be available
// eslint-disable-next-line import/no-extraneous-dependencies
return require.resolve('babel-plugin-react-compiler')
} catch {
throw new Error(
......
/* eslint-disable @typescript-eslint/no-use-before-define */
import path from 'path'
import { pathToFileURL } from 'url'
import { arch, platform } from 'os'
......
......@@ -205,9 +205,7 @@ function getBaseSWCOptions({
},
// Disable css-in-js libs (without client-only integration) transform on server layer for server components
...(!isReactServerLayer && {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
emotion: getEmotionOptions(compilerOptions?.emotion, development),
// eslint-disable-next-line @typescript-eslint/no-use-before-define
styledComponents: getStyledComponentsOptions(
compilerOptions?.styledComponents,
development
......
......@@ -32,7 +32,6 @@ function getModulesOptions(rawOptions: any, loaderContext: any) {
localIdentName: '[hash:base64]',
localIdentContext: loaderContext.rootContext,
localIdentHashPrefix: '',
// eslint-disable-next-line no-undefined
localIdentRegExp: undefined,
namedExport: false,
exportLocalsConvention: 'asIs',
......@@ -268,7 +267,6 @@ export default async function loader(
const { ast } = meta
if (ast && ast.type === 'postcss') {
// eslint-disable-next-line no-param-reassign
content = ast.root
loaderSpan.setAttribute('astUsed', 'true')
}
......
......@@ -15,12 +15,10 @@ const plugin = (options: any = {}) => {
const imports = new Map()
const tasks = []
// eslint-disable-next-line guard-for-in
for (const url in icssImports) {
const tokens = icssImports[url]
if (Object.keys(tokens).length === 0) {
// eslint-disable-next-line no-continue
continue
}
......@@ -48,7 +46,6 @@ const plugin = (options: any = {}) => {
return
}
// eslint-disable-next-line consistent-return
return { url: resolvedUrl, prefix, tokens }
}
......@@ -61,7 +58,6 @@ const plugin = (options: any = {}) => {
const item = results[index]
if (!item) {
// eslint-disable-next-line no-continue
continue
}
......
......@@ -122,7 +122,6 @@ function parseNode(atRule: any, key: any) {
media = valueParser.stringify(mediaNodes).trim().toLowerCase()
}
// eslint-disable-next-line consistent-return
return { atRule, prefix, url, media, isRequestable }
}
......@@ -188,13 +187,11 @@ const plugin = (options: any = {}) => {
atRule.remove()
// eslint-disable-next-line consistent-return
return { url: resolvedUrl, media, prefix, isRequestable }
}
atRule.remove()
// eslint-disable-next-line consistent-return
return { url, media, prefix, isRequestable }
})
)
......@@ -205,7 +202,6 @@ const plugin = (options: any = {}) => {
const resolvedAtRule = resolvedAtRules[index]
if (!resolvedAtRule) {
// eslint-disable-next-line no-continue
continue
}
......@@ -214,7 +210,6 @@ const plugin = (options: any = {}) => {
if (!isRequestable) {
options.api.push({ url, media, index })
// eslint-disable-next-line no-continue
continue
}
......
......@@ -26,13 +26,11 @@ function getWebpackIgnoreCommentValue(index: any, nodes: any, inBetween?: any) {
let prevValueNode = nodes[index - 1]
if (!prevValueNode) {
// eslint-disable-next-line consistent-return
return
}
if (prevValueNode.type === 'space') {
if (!nodes[index - 2]) {
// eslint-disable-next-line consistent-return
return
}
......@@ -40,7 +38,6 @@ function getWebpackIgnoreCommentValue(index: any, nodes: any, inBetween?: any) {
}
if (prevValueNode.type !== 'comment') {
// eslint-disable-next-line consistent-return
return
}
......@@ -139,7 +136,6 @@ function parseDeclaration(
needIgnore
) {
if (needIgnore) {
// eslint-disable-next-line no-undefined
needIgnore = undefined
}
......@@ -155,7 +151,6 @@ function parseDeclaration(
if (
!shouldHandleURL(url, declaration, result, isSupportDataURLInNewURL)
) {
// eslint-disable-next-line consistent-return
return false
}
......@@ -176,7 +171,6 @@ function parseDeclaration(
needQuotes: false,
})
// eslint-disable-next-line consistent-return
return false
} else if (isImageSetFunc.test(valueNode.value)) {
for (const [innerIndex, nNode] of valueNode.nodes.entries()) {
......@@ -190,11 +184,9 @@ function parseDeclaration(
needIgnore
) {
if (needIgnore) {
// eslint-disable-next-line no-undefined
needIgnore = undefined
}
// eslint-disable-next-line no-continue
continue
}
......@@ -209,7 +201,6 @@ function parseDeclaration(
if (
!shouldHandleURL(url, declaration, result, isSupportDataURLInNewURL)
) {
// eslint-disable-next-line consistent-return
return false
}
......@@ -237,11 +228,9 @@ function parseDeclaration(
needIgnore
) {
if (needIgnore) {
// eslint-disable-next-line no-undefined
needIgnore = undefined
}
// eslint-disable-next-line no-continue
continue
}
......@@ -251,7 +240,6 @@ function parseDeclaration(
if (
!shouldHandleURL(url, declaration, result, isSupportDataURLInNewURL)
) {
// eslint-disable-next-line consistent-return
return false
}
......@@ -275,12 +263,10 @@ function parseDeclaration(
}
// Do not traverse inside `image-set`
// eslint-disable-next-line consistent-return
return false
}
})
// eslint-disable-next-line consistent-return
return parsedURLs
}
......@@ -319,13 +305,11 @@ const plugin = (options: any = {}) => {
const needKeep = await options.filter(url)
if (!needKeep) {
// eslint-disable-next-line consistent-return
return
}
}
if (isDataUrl(url)) {
// eslint-disable-next-line consistent-return
return parsedDeclaration
}
......@@ -343,7 +327,6 @@ const plugin = (options: any = {}) => {
)
if (!needToResolveURL) {
// eslint-disable-next-line consistent-return
return { ...parsedDeclaration, url: request, hash }
}
......@@ -353,11 +336,9 @@ const plugin = (options: any = {}) => {
])
if (!resolvedUrl) {
// eslint-disable-next-line consistent-return
return
}
// eslint-disable-next-line consistent-return
return { ...parsedDeclaration, url: resolvedUrl, hash }
})
)
......@@ -375,7 +356,6 @@ const plugin = (options: any = {}) => {
const item = resolvedDeclarations[index]
if (!item) {
// eslint-disable-next-line no-continue
continue
}
......@@ -426,11 +406,8 @@ const plugin = (options: any = {}) => {
})
}
// eslint-disable-next-line no-param-reassign
item.node.type = 'word'
// eslint-disable-next-line no-param-reassign
item.node.value = replacementName
// eslint-disable-next-line no-param-reassign
item.declaration.value = item.parsed.toString()
}
},
......
......@@ -3,13 +3,11 @@
Author Tobias Koppers @sokra
*/
// css base code, injected by the css-loader
// eslint-disable-next-line func-names
module.exports = function (useSourceMap: any) {
var list: any[] = [] // return the list of modules as css string
list.toString = function toString() {
return this.map(function (item) {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
var content = cssWithMappingToString(item, useSourceMap)
if (item[2]) {
......@@ -19,12 +17,10 @@ module.exports = function (useSourceMap: any) {
return content
}).join('')
} // import a list of modules into the list
// eslint-disable-next-line func-names
// @ts-expect-error TODO: fix type
list.i = function (modules: any, mediaQuery: any, dedupe: any) {
if (typeof modules === 'string') {
// eslint-disable-next-line no-param-reassign
modules = [[null, modules, '']]
}
......@@ -32,7 +28,6 @@ module.exports = function (useSourceMap: any) {
if (dedupe) {
for (var i = 0; i < this.length; i++) {
// eslint-disable-next-line prefer-destructuring
var id = this[i][0]
if (id != null) {
......@@ -45,7 +40,6 @@ module.exports = function (useSourceMap: any) {
var item: any = [].concat(modules[_i])
if (dedupe && alreadyImportedModules[item[0]]) {
// eslint-disable-next-line no-continue
continue
}
......@@ -65,7 +59,7 @@ module.exports = function (useSourceMap: any) {
}
function cssWithMappingToString(item: any, useSourceMap: any) {
var content = item[1] || '' // eslint-disable-next-line prefer-destructuring
var content = item[1] || ''
var cssMapping = item[3]
......@@ -74,7 +68,6 @@ function cssWithMappingToString(item: any, useSourceMap: any) {
}
if (useSourceMap && typeof btoa === 'function') {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
var sourceMapping = toComment(cssMapping)
var sourceURLs = cssMapping.sources.map(function (source: string) {
return '/*# sourceURL='
......@@ -88,7 +81,6 @@ function cssWithMappingToString(item: any, useSourceMap: any) {
} // Adapted from convert-source-map (MIT)
function toComment(sourceMap: any) {
// eslint-disable-next-line no-undef
var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))))
var data =
'sourceMappingURL=data:application/json;charset=utf-8;base64,'.concat(
......
module.exports = function (url: any, options: any) {
if (!options) {
// eslint-disable-next-line no-param-reassign
options = {}
} // eslint-disable-next-line no-underscore-dangle, no-param-reassign
}
url = url && url.__esModule ? url.default : url
......@@ -11,12 +10,10 @@ module.exports = function (url: any, options: any) {
} // If url is already wrapped in quotes, remove them
if (/^['"].*['"]$/.test(url)) {
// eslint-disable-next-line no-param-reassign
url = url.slice(1, -1)
}
if (options.hash) {
// eslint-disable-next-line no-param-reassign
url += options.hash
} // Should url be wrapped?
// See https://drafts.csswg.org/css-values-3/#urls
......
......@@ -24,7 +24,6 @@ function unescape(str: string) {
return str.replace(unescapeRegExp, (_, escaped, escapedWhitespace) => {
const high = (`0x${escaped}` as any) - 0x10000
/* eslint-disable line-comment-position */
// NaN means non-codepoint
// Workaround erroneous numeric interpretation of +"0x"
// eslint-disable-next-line no-self-compare
......@@ -34,9 +33,7 @@ function unescape(str: string) {
? // BMP codepoint
String.fromCharCode(high + 0x10000)
: // Supplemental Plane codepoint (surrogate pair)
// eslint-disable-next-line no-bitwise
String.fromCharCode((high >> 10) | 0xd800, (high & 0x3ff) | 0xdc00)
/* eslint-enable line-comment-position */
})
}
......@@ -63,7 +60,6 @@ function normalizeUrl(url: string, isStringValue: boolean) {
normalizedUrl = unescape(normalizedUrl)
// eslint-disable-next-line @typescript-eslint/no-use-before-define
if (isDataUrl(url)) {
return fixedEncodeURIComponent(normalizedUrl)
}
......
......@@ -36,7 +36,6 @@ module.exports = (url: any, options: any) => {
if (typeof options.attributes.nonce === 'undefined') {
const nonce =
// eslint-disable-next-line no-undef
typeof __webpack_nonce__ !== 'undefined' ? __webpack_nonce__ : null
if (nonce) {
......
......@@ -86,7 +86,6 @@ function modulesToDom(list: any, options: any) {
} else {
stylesInDom.push({
identifier: identifier,
// eslint-disable-next-line @typescript-eslint/no-use-before-define
updater: addStyle(obj, options),
references: 1,
})
......@@ -104,7 +103,6 @@ function insertStyleElement(options: any) {
if (typeof attributes.nonce === 'undefined') {
const nonce =
// eslint-disable-next-line no-undef
typeof __webpack_nonce__ !== 'undefined' ? __webpack_nonce__ : null
if (nonce) {
......
......@@ -7,7 +7,6 @@ function isEqualLocals(a: any, b: any, isNamedExport: any) {
for (p in a) {
if (isNamedExport && p === 'default') {
// eslint-disable-next-line no-continue
continue
}
......@@ -18,7 +17,6 @@ function isEqualLocals(a: any, b: any, isNamedExport: any) {
for (p in b) {
if (isNamedExport && p === 'default') {
// eslint-disable-next-line no-continue
continue
}
......
......@@ -112,7 +112,6 @@ export default async function loader(
}
}
// eslint-disable-next-line no-undefined
let map = result.map ? result.map.toJSON() : undefined
if (map && useSourceMap) {
......
......@@ -60,13 +60,10 @@ function normalizeSourceMapAfterPostcss(map: any, resourceContext: string) {
// result.map.file is an optional property that provides the output filename.
// Since we don't know the final filename in the webpack build chain yet, it makes no sense to have it.
// eslint-disable-next-line no-param-reassign
delete newMap.file
// eslint-disable-next-line no-param-reassign
newMap.sourceRoot = ''
// eslint-disable-next-line no-param-reassign
newMap.sources = newMap.sources.map((source: string) => {
if (source.startsWith('<')) {
return source
......
......@@ -65,13 +65,10 @@ export default async function resolveUrlLoader(
inputSourceMap: sourceMap,
sourceMapConsumer: sourceMapConsumer,
})
// eslint-disable-next-line @typescript-eslint/no-use-before-define
.catch(onFailure)
// eslint-disable-next-line @typescript-eslint/no-use-before-define
.then(onSuccess)
function onFailure(error: Error) {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
callback(encodeError('CSS error', error))
}
......
// TODO: Remove use of `any` type. Fix no-use-before-define violations.
/* eslint-disable @typescript-eslint/no-use-before-define */
// TODO: Remove use of `any` type.
/*
The MIT License (MIT)
......
......@@ -38,7 +38,6 @@ export default function process(
postcssPlugin.postcss = true
// prepend file protocol to all sources to avoid problems with source map
// eslint-disable-next-line @typescript-eslint/no-use-before-define
return postcss([postcssPlugin])
.process(sourceContent, {
from: prepend(sourceFile),
......@@ -61,7 +60,6 @@ export default function process(
return {
postcssPlugin: 'postcss-resolve-url',
Once: function (root: any) {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
root.walkDecls(eachDeclaration)
},
}
......
......@@ -66,9 +66,7 @@ function valueProcessor(filename: any, options: any) {
const split = unescaped.split(/([?#])/g),
uri = split[0],
absolute =
// eslint-disable-next-line @typescript-eslint/no-use-before-define
(testIsRelative(uri) && join(uri, candidate)) ||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
(testIsAbsolute(uri) && join(uri)),
query = options.keepQuery ? split.slice(1).join('') : ''
......
......@@ -75,11 +75,9 @@ export class MinifyPlugin {
assetsList
.filter((name) => {
if (
!ModuleFilenameHelpers.matchObject.bind(
// eslint-disable-next-line no-undefined
undefined,
{ test: /\.[cm]?js(\?.*)?$/i }
)(name)
!ModuleFilenameHelpers.matchObject.bind(undefined, {
test: /\.[cm]?js(\?.*)?$/i,
})(name)
) {
return false
}
......@@ -123,7 +121,6 @@ export class MinifyPlugin {
let initializedWorker: any
// eslint-disable-next-line consistent-return
const getWorker = () => {
return {
minify: async (options: {
......@@ -274,7 +271,6 @@ export class MinifyPlugin {
.tap(
'minify-webpack-plugin',
(minimized: any, { green, formatFlag }: any) =>
// eslint-disable-next-line no-undefined
minimized ? green(formatFlag('minimized')) : undefined
)
})
......
/* eslint-disable import/no-extraneous-dependencies */
const loaderUtils = require('loader-utils')
loaderUtils.getOptions = function (context) {
......
......@@ -3,10 +3,8 @@ exports.__esModule = true
exports.default = undefined
if (process.env.NEXT_RSPACK) {
// eslint-disable-next-line
Object.assign(exports, getRspackCore())
Object.assign(exports, {
// eslint-disable-next-line import/no-extraneous-dependencies
StringXor: require('./bundle5')().StringXor,
})
} else if (process.env.NEXT_PRIVATE_LOCAL_WEBPACK) {
......@@ -40,7 +38,6 @@ if (process.env.NEXT_RSPACK) {
function getRspackCore() {
try {
// eslint-disable-next-line import/no-extraneous-dependencies
return require('next-rspack/rspack-core')
} catch (e) {
if (e instanceof Error && 'code' in e && e.code === 'MODULE_NOT_FOUND') {
......
......@@ -403,7 +403,6 @@ export default function LinkComponent(
}
} else {
// TypeScript trick for type-guarding:
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const _: never = key
}
})
......@@ -480,7 +479,6 @@ export default function LinkComponent(
}
} else {
// TypeScript trick for type-guarding:
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const _: never = key
}
})
......
......@@ -10,29 +10,21 @@ declare const __webpack_require__: any
// I am keeping the process check explicit so this can be statically optimized
if (process.env.NEXT_DEPLOYMENT_ID) {
const suffix = getDeploymentIdQueryOrEmptyString()
// eslint-disable-next-line no-undef
const getChunkScriptFilename = __webpack_require__.u
// eslint-disable-next-line no-undef
__webpack_require__.u = (...args: any[]) =>
// We encode the chunk filename because our static server matches against and encoded
// filename path.
encodeURIPath(getChunkScriptFilename(...args)) + suffix
// eslint-disable-next-line no-undef
const getChunkCssFilename = __webpack_require__.k
// eslint-disable-next-line no-undef
__webpack_require__.k = (...args: any[]) =>
getChunkCssFilename(...args) + suffix
// eslint-disable-next-line no-undef
const getMiniCssFilename = __webpack_require__.miniCssF
// eslint-disable-next-line no-undef
__webpack_require__.miniCssF = (...args: any[]) =>
getMiniCssFilename(...args) + suffix
} else {
// eslint-disable-next-line no-undef
const getChunkScriptFilename = __webpack_require__.u
// eslint-disable-next-line no-undef
__webpack_require__.u = (...args: any[]) =>
// We encode the chunk filename because our static server matches against and encoded
// filename path.
......
......@@ -180,7 +180,6 @@ function Router({
}, [canonicalUrl])
if (process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line react-hooks/rules-of-hooks
const { cache, prefetchCache, tree } = state
// This hook is in a conditional but that is ok because `process.env.NODE_ENV` never changes
......
......@@ -26,7 +26,6 @@ export function forbidden(): never {
)
}
// eslint-disable-next-line no-throw-literal
const error = new Error(DIGEST) as HTTPAccessFallbackError
;(error as HTTPAccessFallbackError).digest = DIGEST
throw error
......
......@@ -21,7 +21,6 @@ import {
const DIGEST = `${HTTP_ERROR_FALLBACK_ERROR_CODE};404`
export function notFound(): never {
// eslint-disable-next-line no-throw-literal
const error = new Error(DIGEST) as HTTPAccessFallbackError
;(error as HTTPAccessFallbackError).digest = DIGEST
......
......@@ -27,7 +27,6 @@ export function unauthorized(): never {
)
}
// eslint-disable-next-line no-throw-literal
const error = new Error(DIGEST) as HTTPAccessFallbackError
;(error as HTTPAccessFallbackError).digest = DIGEST
throw error
......
// TODO: Remove use of `any` type. Fix no-use-before-define violations.
/* eslint-disable @typescript-eslint/no-use-before-define */
// TODO: Remove use of `any` type.
/**
* MIT License
*
......
......@@ -209,7 +209,7 @@ export async function initialize(opts: { devClient?: any } = {}): Promise<{
const prefix: string = initialData.assetPrefix || ''
// With dynamic assetPrefix it's no longer possible to set assetPrefix at the build time
// So, this is how we do it in the client side at runtime
;(self as any).__next_set_public_path__(`${prefix}/_next/`) //eslint-disable-line
;(self as any).__next_set_public_path__(`${prefix}/_next/`)
asPath = getURL()
......@@ -303,8 +303,6 @@ function AppContainer({
return (
<Container
fn={(error) =>
// TODO: Fix disabled eslint rule
// eslint-disable-next-line @typescript-eslint/no-use-before-define
renderError({ App: CachedApp, err: error }).catch((err) =>
console.error('Error rendering page: ', err)
)
......@@ -364,8 +362,6 @@ function renderError(renderErrorProps: RenderErrorProps): Promise<any> {
// We need to render an empty <App> so that the `<ReactDevOverlay>` can
// render itself.
// TODO: Fix disabled eslint rule
// eslint-disable-next-line @typescript-eslint/no-use-before-define
return doRender({
App: () => null,
props: {},
......@@ -420,8 +416,6 @@ function renderError(renderErrorProps: RenderErrorProps): Promise<any> {
? renderErrorProps.props
: loadGetInitialProps(App, appCtx)
).then((initProps) =>
// TODO: Fix disabled eslint rule
// eslint-disable-next-line @typescript-eslint/no-use-before-define
doRender({
...renderErrorProps,
err,
......
......@@ -363,7 +363,6 @@ const Link = React.forwardRef<HTMLAnchorElement, LinkPropsReal>(
}
} else {
// TypeScript trick for type-guarding:
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const _: never = key
}
})
......@@ -446,7 +445,6 @@ const Link = React.forwardRef<HTMLAnchorElement, LinkPropsReal>(
}
} else {
// TypeScript trick for type-guarding:
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const _: never = key
}
})
......
// eslint-disable-next-line @typescript-eslint/no-unused-vars
declare const __webpack_require__: any
// eslint-disable-next-line @typescript-eslint/no-unused-vars
declare let __webpack_public_path__: string
import { getDeploymentIdQueryOrEmptyString } from '../build/deployment-id'
......@@ -9,30 +7,23 @@ import { getDeploymentIdQueryOrEmptyString } from '../build/deployment-id'
// I am keeping the process check explicit so this can be statically optimized
if (process.env.NEXT_DEPLOYMENT_ID) {
const suffix = getDeploymentIdQueryOrEmptyString()
// eslint-disable-next-line no-undef
const getChunkScriptFilename = __webpack_require__.u
// eslint-disable-next-line no-undef
__webpack_require__.u = (...args: any[]) =>
// We enode the chunk filename because our static server matches against and encoded
// filename path.
getChunkScriptFilename(...args) + suffix
// eslint-disable-next-line no-undef
const getChunkCssFilename = __webpack_require__.k
// eslint-disable-next-line no-undef
__webpack_require__.k = (...args: any[]) =>
getChunkCssFilename(...args) + suffix
// eslint-disable-next-line no-undef
const getMiniCssFilename = __webpack_require__.miniCssF
// eslint-disable-next-line no-undef
__webpack_require__.miniCssF = (...args: any[]) =>
getMiniCssFilename(...args) + suffix
}
// Ignore the module ID transform in client.
;(self as any).__next_set_public_path__ = (path: string) => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
__webpack_public_path__ = path
}
......
......@@ -3,10 +3,8 @@ exports.__esModule = true
exports.default = undefined
if (process.env.NEXT_RSPACK) {
// eslint-disable-next-line
Object.assign(exports, getRspackCore())
Object.assign(exports, {
// eslint-disable-next-line import/no-extraneous-dependencies
StringXor: require('./bundle5')().StringXor,
})
} else if (process.env.NEXT_PRIVATE_LOCAL_WEBPACK) {
......@@ -40,7 +38,6 @@ if (process.env.NEXT_RSPACK) {
function getRspackCore() {
try {
// eslint-disable-next-line import/no-extraneous-dependencies
return require('next-rspack/rspack-core')
} catch (e) {
if (e instanceof Error && 'code' in e && e.code === 'MODULE_NOT_FOUND') {
......
// eslint-disable-next-line import/no-extraneous-dependencies
import * as base from '@playwright/test'
import type { NextFixture } from './next-fixture'
import type { NextOptions, NextOptionsConfig } from './next-options'
......@@ -9,7 +8,6 @@ import { defaultPlaywrightConfig } from './default-config'
export { defaultPlaywrightConfig }
// eslint-disable-next-line import/no-extraneous-dependencies
export * from '@playwright/test'
// Export this second so it overrides the one from `@playwright/test`
......
......@@ -7,7 +7,6 @@ import { Emitter } from 'strict-event-emitter'
// eslint-disable-next-line import/no-extraneous-dependencies
export * from 'msw'
// eslint-disable-next-line import/no-extraneous-dependencies
export * from '@playwright/test'
export type { NextFixture }
export { defineConfig }
......
import type { TestInfo } from '@playwright/test'
// eslint-disable-next-line import/no-extraneous-dependencies
import { test } from '@playwright/test'
export interface StepProps {
......
......@@ -262,7 +262,6 @@ export async function writeConfigurationDefaults(
)
}
} else {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const _: never = check
}
}
......
import type { LRUCache } from '../server/lib/lru-cache'
/* eslint-disable no-redeclare */
export function withPromiseCache<K, V>(
cache: LRUCache<Promise<V>>,
fn: (value: K) => Promise<V>
......
......@@ -130,7 +130,6 @@ export const ResizeProvider = ({ value, children }: ResizeProviderProps) => {
})
useLayoutEffect(() => {
// eslint-disable-next-line react-hooks/rules-of-hooks -- eprh bug
fireInitialConstrainDimensions()
}, [])
......
......@@ -145,7 +145,6 @@ export const DevtoolMenu = ({
useLayoutEffect(() => {
menuRef.current?.focus() // allows keydown to be captured
// eslint-disable-next-line react-hooks/rules-of-hooks -- eprh bug
fireInitialSelectMenuItem()
}, [])
......
......@@ -10,7 +10,6 @@ export {
// eslint-disable-next-line import/no-extraneous-dependencies
export { prerender } from 'react-server-dom-webpack/static'
// eslint-disable-next-line import/no-extraneous-dependencies
export { captureOwnerStack } from 'react'
export { default as LayoutRouter } from '../../client/components/layout-router'
......
......@@ -193,7 +193,6 @@ interface EntryType {
}
// Shadowing check in ESLint does not account for enum
// eslint-disable-next-line no-shadow
export const enum EntryTypes {
ENTRY,
CHILD_ENTRY,
......
......@@ -542,7 +542,6 @@ export function hasEntrypointForKey(
)
default: {
// validation that we covered all cases, this should never run.
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const _: never = type
return false
}
......
......@@ -305,7 +305,6 @@ export async function initialize(opts: {
await initResult?.requestHandler(req, res)
} catch (err) {
if (err instanceof NoFallbackError) {
// eslint-disable-next-line
await handleRequest(handleIndex + 1)
return
}
......
......@@ -6,7 +6,6 @@
**/
// eslint typescript has a bug with TS enums
/* eslint-disable no-shadow */
enum BaseServerSpan {
handleRequest = 'BaseServer.handleRequest',
......
......@@ -471,7 +471,6 @@ export function patchErrorInspectNodeJS(
errorConstructor.prepareStackTrace = prepareUnsourcemappedStackTrace
// @ts-expect-error -- TODO upstream types
// eslint-disable-next-line no-extend-native -- We're not extending but overriding.
errorConstructor.prototype[inspectSymbol] = function (
depth: number,
inspectOptions: util.InspectOptions,
......@@ -512,7 +511,6 @@ export function patchErrorInspectEdgeLite(
errorConstructor.prepareStackTrace = prepareUnsourcemappedStackTrace
// @ts-expect-error -- TODO upstream types
// eslint-disable-next-line no-extend-native -- We're not extending but overriding.
errorConstructor.prototype[inspectSymbol] = function ({
format,
}: {
......
/* eslint-disable no-redeclare */
import type { IncomingMessage } from 'http'
import type { ParsedUrlQuery } from 'querystring'
import type { UrlWithParsedQuery } from 'url'
......
// source: https://github.com/sindresorhus/fnv1a
// FNV_PRIMES and FNV_OFFSETS from
// http://www.isthe.com/chongo/tech/comp/fnv/index.html#FNV-param
/* eslint-disable @typescript-eslint/no-loss-of-precision */
const FNV_PRIMES = {
32: BigInt(16_777_619),
......
......@@ -74,7 +74,6 @@ function createLoadableComponent(loadFn: any, options: any) {
let subscription: any = null
function init() {
if (!subscription) {
// eslint-disable-next-line @typescript-eslint/no-use-before-define
const sub = new LoadableSubscription(loadFn, opts)
subscription = {
getCurrentValue: sub.getCurrentValue.bind(sub),
......
// tslint:disable:no-console
import type { ComponentType } from 'react'
import type { DomainLocale } from '../../../server/config'
import type { MittEmitter } from '../mitt'
......@@ -423,7 +422,6 @@ const manualScrollRestoration =
!!(function () {
try {
let v = '__next'
// eslint-disable-next-line no-sequences
return (sessionStorage.setItem(v, v), sessionStorage.removeItem(v), true)
} catch (n) {}
})()
......
......@@ -17,7 +17,6 @@ const RECORD_SPAN_THRESHOLD_MS = parseInt(
)
// eslint typescript has a bug with TS enums
/* eslint-disable no-shadow */
export enum SpanStatus {
Started = 'started',
Stopped = 'stopped',
......
// eslint-disable-next-line import/no-extraneous-dependencies
const findUp = require('find-up')
// eslint-disable-next-line import/no-extraneous-dependencies
const ncc = require('@vercel/ncc')
const { existsSync, readFileSync } = require('fs')
const { basename, dirname, extname, join, resolve } = require('path')
......
......@@ -5,11 +5,9 @@ const MODERN_BROWSERSLIST_TARGET = require('./src/shared/lib/modern-browserslist
const path = require('path')
// eslint-disable-next-line import/no-extraneous-dependencies
const transform = require('@swc/core').transform
module.exports = function (task) {
// eslint-disable-next-line require-yield
task.plugin(
'swc',
{},
......
......@@ -26,7 +26,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
const path = require('path')
// eslint-disable-next-line import/no-extraneous-dependencies
const Watchpack = require('watchpack')
const toArr = (val) => (Array.isArray(val) ? val : val == null ? [] : [val])
......
This diff is collapsed.
......@@ -211,7 +211,6 @@ const nextBuildWorkflow =
throw e
} finally {
// This must run in order
// eslint-disable-next-line no-await-in-loop
for (const task of cleanupTasks.reverse()) await task()
await measureTime('shutdown')
}
......@@ -353,7 +352,6 @@ const nextDevWorkflow =
await writeFile(path, content, 'utf8')
})
let currentContent = content
/* eslint-disable no-await-in-loop */
for (let hmrAttempt = 0; hmrAttempt < 10; hmrAttempt++) {
if (hmrAttempt > 0) {
await new Promise((resolve) => {
......@@ -467,7 +465,6 @@ const nextDevWorkflow =
if (!success) break
}
/* eslint-enable no-await-in-loop */
}
if (turbopack) {
......@@ -532,7 +529,6 @@ const nextDevWorkflow =
await shell.reportMemUsage('mem usage after open page with cache')
} finally {
// This must run in order
// eslint-disable-next-line no-await-in-loop
for (const task of cleanupTasks.reverse()) await task()
await measureTime('shutdown')
}
......@@ -587,12 +583,10 @@ async function retry(fn) {
let lastError
for (let i = 100; i < 2000; i += 100) {
try {
// eslint-disable-next-line no-await-in-loop
await fn()
return
} catch (e) {
lastError = e
// eslint-disable-next-line no-await-in-loop
await new Promise((resolve) => {
setTimeout(resolve, i)
})
......
/* eslint-disable jest/no-standalone-expect -- rule does not understand testGateWebpack */
import { nextTestSetup } from 'e2e-utils'
import {
assertHasRedbox,
......
......@@ -27,7 +27,6 @@ import {
import { Tab, RadioGroup, Transition } from '@headlessui/react'
export function Comp() {
// eslint-disable-next-line no-undef
globalThis.__noop__ = createLucideIcon
return (
<>
......
......@@ -129,7 +129,6 @@ export function runErrorRecoveryHmrTest(nextConfig: {
await next.browser(basePath + '/does-not-exist')
await retry(() => {
// eslint-disable-next-line jest/no-standalone-expect
expect(next.cliOutput).toMatch(/getInitialProps called/)
})
......@@ -141,7 +140,6 @@ export function runErrorRecoveryHmrTest(nextConfig: {
const logOccurrences =
next.cliOutput.slice(outputIndex).split('getInitialProps called')
.length - 1
// eslint-disable-next-line jest/no-standalone-expect
expect(logOccurrences).toBe(0)
} finally {
await next.deleteFile(errorPage)
......
/* eslint-disable */
import React from 'react'
export default () => <>My component!</>
/* eslint-disable jest/no-standalone-expect */
import { nextTestSetup } from 'e2e-utils'
import { createRequestTracker } from 'e2e-utils/request-tracker'
import { retry } from 'next-test-utils'
......
/* eslint-disable jest/no-standalone-expect */
import { FileRef, nextTestSetup } from 'e2e-utils'
import { check } from 'next-test-utils'
import { join } from 'path'
......
/* eslint-disable jest/no-standalone-expect */
import { nextTestSetup } from 'e2e-utils'
import { retry } from 'next-test-utils'
......
/* eslint-disable jest/no-standalone-expect */
import { FileRef, nextTestSetup } from 'e2e-utils'
import {
assertHasRedbox,
......
......@@ -155,13 +155,11 @@ describe('app dir - external dependency', () => {
})
it('should not apply swc optimizer transform for external packages in browser layer in web worker', async () => {
const browser = await next.browser('/browser')
// eslint-disable-next-line jest/no-standalone-expect
expect(await browser.elementByCss('#worker-state').text()).toBe('default')
await browser.elementByCss('button').click()
await retry(async () => {
// eslint-disable-next-line jest/no-standalone-expect
expect(await browser.elementByCss('#worker-state').text()).toBe(
'worker.js:browser-module/other'
)
......
......@@ -21,7 +21,6 @@ describe('app dir - proxy without pages dir', () => {
},
})
// eslint-disable-next-line jest/no-identical-title
it('Updates headers', async () => {
const html = await next.render('/headers')
......
......@@ -9,7 +9,6 @@ function log(outBadge: string, errBadge: string) {
'two'
)
console.log(
// eslint-disable-next-line no-useless-concat
`${outBadge} /console-after-abort/client: This is a console page. Don't match the codeframe.`
)
console.warn(`${errBadge} /console-after-abort/client: not a template`, {
......
......@@ -8,7 +8,6 @@ async function cachedConsoleCalls(outBadge: string, errBadge: string) {
'two'
)
console.log(
// eslint-disable-next-line no-useless-concat
`${outBadge} /console-after-abort/server: This is a console page` +
". Don't match the codeframe."
)
......@@ -51,7 +50,6 @@ export default async function ConsolePage() {
'two'
)
console.log(
// eslint-disable-next-line no-useless-concat
`${outBadge} /console-after-abort/server: This is a console page` +
". Don't match the codeframe."
)
......
......@@ -3,7 +3,6 @@ async function cachedConsoleCalls(outBadge: string, errBadge: string) {
console.info(`${outBadge} /console: template(one: %s, two: %s)`, 'one', 'two')
await 1
console.log(
// eslint-disable-next-line no-useless-concat
`${outBadge} /console: This is a console page` +
". Don't match the codeframe."
)
......@@ -32,7 +31,6 @@ export default async function ConsolePage() {
console.info(`${outBadge} /console: template(one: %s, two: %s)`, 'one', 'two')
await 1
console.log(
// eslint-disable-next-line no-useless-concat
`${outBadge} /console: This is a console page` +
". Don't match the codeframe."
)
......
......@@ -9,7 +9,6 @@ function log(outBadge: string, errBadge: string) {
'two'
)
console.log(
// eslint-disable-next-line no-useless-concat
`${outBadge} /console-after-abort/client: This is a console page. Don't match the codeframe.`
)
console.warn(`${errBadge} /console-after-abort/client: not a template`, {
......
......@@ -8,7 +8,6 @@ async function cachedConsoleCalls(outBadge: string, errBadge: string) {
'two'
)
console.log(
// eslint-disable-next-line no-useless-concat
`${outBadge} /console-after-abort/server: This is a console page` +
". Don't match the codeframe."
)
......@@ -51,7 +50,6 @@ export default async function ConsolePage() {
'two'
)
console.log(
// eslint-disable-next-line no-useless-concat
`${outBadge} /console-after-abort/server: This is a console page` +
". Don't match the codeframe."
)
......
......@@ -3,7 +3,6 @@ async function cachedConsoleCalls(outBadge: string, errBadge: string) {
console.info(`${outBadge} /console: template(one: %s, two: %s)`, 'one', 'two')
await 1
console.log(
// eslint-disable-next-line no-useless-concat
`${outBadge} /console: This is a console page` +
". Don't match the codeframe."
)
......@@ -32,7 +31,6 @@ export default async function ConsolePage() {
console.info(`${outBadge} /console: template(one: %s, two: %s)`, 'one', 'two')
await 1
console.log(
// eslint-disable-next-line no-useless-concat
`${outBadge} /console: This is a console page` +
". Don't match the codeframe."
)
......
......@@ -35,7 +35,6 @@ describe('cache-components', () => {
await assertNoRedbox(browser)
}
})
/* eslint-enable jest/no-standalone-expect */
it('should prerender pages with inline server actions', async () => {
let $ = await next.render$('/server-action-inline', {})
......
/* eslint-disable jest/no-standalone-expect */
import { nextTestSetup } from 'e2e-utils'
import cheerio from 'cheerio'
......
......@@ -446,7 +446,6 @@ describe('app dir - navigation', () => {
.elementByCss('button')
.click()
.waitForElementByCss('#result-page')
// eslint-disable-next-line jest/no-standalone-expect
expect(await browser.elementByCss('#result-page').text()).toBe(
'Result Page'
)
......
import { cliLog } from './log'
export function injectRequestContext() {
// eslint-disable-next-line no-undef
const _globalThis = globalThis
/** @type {import('next/dist/server/after/builtin-request-context').BuiltinRequestContext} */
......
/* eslint-disable @typescript-eslint/no-explicit-any */
declare module '*.svg' {
const content: any
export const ReactComponent: any
......
//@ts-check
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { composePlugins, withNx } = require('@nx/next')
/**
......
/* eslint-disable jest/no-standalone-expect */
import * as path from 'path'
import { nextTestSetup } from 'e2e-utils'
import stripAnsi from 'strip-ansi'
......
/* eslint-disable jest/no-standalone-expect */
import * as path from 'path'
import { nextTestSetup } from 'e2e-utils'
import stripAnsi from 'strip-ansi'
......
/* eslint-disable jest/valid-expect-in-promise */
import { createNext } from 'e2e-utils'
import { NextInstance } from 'e2e-utils'
import { fetchViaHTTP } from 'next-test-utils'
......
......@@ -114,7 +114,6 @@ describe('persistent-caching', () => {
}
}
/* eslint-disable jest/no-standalone-expect */
const POTENTIAL_CHANGES = {
'RSC change': {
checkInitial: makeTextCheck('/', 'hello world'),
......@@ -191,7 +190,6 @@ describe('persistent-caching', () => {
},
},
}
/* eslint-enable jest/no-standalone-expect */
const KEYS = Object.keys(POTENTIAL_CHANGES)
for (let bitset = 1; bitset < 1 << KEYS.length; bitset++) {
......
/* eslint-env jest */
/* eslint-disable jest/no-standalone-expect */
import { join } from 'path'
import webdriver from 'next-webdriver'
import { fetchViaHTTP } from 'next-test-utils'
......
/* eslint-disable jest/no-identical-title */
import { createNext, FileRef } from 'e2e-utils'
import { NextInstance } from 'e2e-utils'
import { check, fetchViaHTTP } from 'next-test-utils'
......
......@@ -5,7 +5,6 @@ import { NextResponse } from 'next/server'
class MyResponse extends Response {}
export async function middleware(request, ev) {
// eslint-disable-next-line no-undef
const { readable, writable } = new TransformStream()
const url = request.nextUrl
const writer = writable.getWriter()
......
......@@ -76,7 +76,6 @@ MyDocument.getInitialProps = async (ctx) => {
<style
data-emotion={`${style.key} ${style.ids.join(' ')}`}
key={style.key}
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{ __html: style.css }}
/>
))
......
......@@ -412,7 +412,6 @@ describe('Prerender', () => {
await goFromAnotherToHome()
// Client-side SSG data caching test
// eslint-disable-next-line no-lone-blocks
{
// Let revalidation period lapse
await waitFor(2000)
......
......@@ -19,6 +19,5 @@ export default function Page() {
if (typeof window !== 'undefined') {
window.pathnames.push(window.location.pathname)
}
// eslint-disable-next-line
return <p>{useRouter().asPath}</p>
}
......@@ -446,7 +446,6 @@ describe('Valid CSS Module Usage from within node_modules', () => {
await killApp(app)
})
// eslint-disable-next-line jest/no-identical-title
it(`should've prerendered with relevant data`, async () => {
const content = await renderViaHTTP(appPort, '/')
const $ = cheerio.load(content)
......@@ -457,7 +456,6 @@ describe('Valid CSS Module Usage from within node_modules', () => {
)
})
// eslint-disable-next-line jest/no-identical-title
it(`should've emitted a single CSS file`, async () => {
const content = await renderViaHTTP(appPort, '/')
const $ = cheerio.load(content)
......
......@@ -56,7 +56,6 @@ describe('Invalid Global CSS', () => {
await remove(join(appDir, '.next'))
})
// eslint-disable-next-line jest/no-identical-title
it('should fail to build', async () => {
const { code, stderr } = await nextBuild(appDir, [], {
stderr: true,
......@@ -128,7 +127,6 @@ describe('Invalid Global CSS with Custom App', () => {
await remove(join(appDir, '.next'))
})
// eslint-disable-next-line jest/no-identical-title
it('should fail to build', async () => {
const { code, stderr } = await nextBuild(appDir, [], {
stderr: true,
......@@ -158,7 +156,6 @@ describe('Valid and Invalid Global CSS with Custom App', () => {
await remove(join(appDir, '.next'))
})
// eslint-disable-next-line jest/no-identical-title
it('should fail to build', async () => {
const { code, stderr } = await nextBuild(appDir, [], {
stderr: true,
......
/* eslint-disable no-unused-expressions, no-undef */
let renderCount = 0
export default function Error() {
......
/* eslint-disable no-unused-expressions, no-unused-vars */
import React from 'react'
import Link from 'next/link'
......
......@@ -492,7 +492,6 @@ describe('Edge runtime configurable guards', () => {
'production mode',
() => {
// This checks the unstable_allowDynamic configuration which is not supported in Turbopack.
// eslint-disable-next-line jest/no-identical-title
;(process.env.IS_TURBOPACK_TEST ? it.skip : it)(
'build and does not warn at runtime',
async () => {
......
/* eslint-disable jest/no-identical-title */
/* eslint-env jest */
import { remove } from 'fs-extra'
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment