Skip to content

Commit 286101a

Browse files
committed
Upgrade eslint to the latest version
1 parent 079c629 commit 286101a

File tree

15 files changed

+885
-545
lines changed

15 files changed

+885
-545
lines changed

.eslintrc.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@
2727
"extends": ["plugin:jest/recommended"],
2828
"rules": {
2929
"jest/expect-expect": "off",
30-
"jest/no-disabled-tests": "off"
30+
"jest/no-disabled-tests": "off",
31+
"jest/no-conditional-expect": "off",
32+
"jest/valid-title": "off",
33+
"jest/no-interpolation-in-snapshots": "off"
3134
}
3235
},
3336
{ "files": ["**/__tests__/**"], "env": { "jest": true } },

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
"@types/http-proxy": "1.17.3",
5050
"@types/jest": "24.0.13",
5151
"@types/string-hash": "1.1.1",
52-
"@typescript-eslint/eslint-plugin": "2.17.0",
53-
"@typescript-eslint/parser": "2.17.0",
52+
"@typescript-eslint/eslint-plugin": "4.22.0",
53+
"@typescript-eslint/parser": "4.22.0",
5454
"@zeit/next-css": "1.0.2-canary.2",
5555
"@zeit/next-sass": "1.0.2-canary.2",
5656
"@zeit/next-typescript": "1.1.2-canary.0",
@@ -71,11 +71,11 @@
7171
"cross-env": "6.0.3",
7272
"cross-spawn": "6.0.5",
7373
"escape-string-regexp": "2.0.0",
74-
"eslint": "6.8.0",
75-
"eslint-plugin-import": "2.20.2",
76-
"eslint-plugin-jest": "23.13.1",
77-
"eslint-plugin-react": "7.19.0",
78-
"eslint-plugin-react-hooks": "2.3.0",
74+
"eslint": "7.24.0",
75+
"eslint-plugin-import": "2.22.1",
76+
"eslint-plugin-jest": "24.3.5",
77+
"eslint-plugin-react": "7.23.2",
78+
"eslint-plugin-react-hooks": "4.2.0",
7979
"execa": "2.0.3",
8080
"express": "4.17.0",
8181
"faunadb": "2.6.1",
@@ -87,7 +87,6 @@
8787
"image-size": "0.9.3",
8888
"is-animated": "2.0.0",
8989
"isomorphic-unfetch": "3.0.0",
90-
"jest-cli": "27.0.0-next.5",
9190
"ky": "0.19.1",
9291
"ky-universal": "0.6.0",
9392
"lerna": "4.0.0",
@@ -129,7 +128,8 @@
129128
"wait-port": "0.2.2",
130129
"web-streams-polyfill": "2.1.1",
131130
"webpack-bundle-analyzer": "4.3.0",
132-
"worker-loader": "3.0.7"
131+
"worker-loader": "3.0.7",
132+
"jest": "27.0.0-next.8"
133133
},
134134
"resolutions": {
135135
"browserslist": "4.16.1",

packages/next/build/output/index.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@ export function startedDevelopmentServer(appUrl: string, bindAddr: string) {
1212
let previousClient: import('webpack').Compiler | null = null
1313
let previousServer: import('webpack').Compiler | null = null
1414

15-
type CompilerDiagnosticsWithFile = {
16-
errors: { file: string | undefined; message: string }[] | null
17-
warnings: { file: string | undefined; message: string }[] | null
18-
}
19-
2015
type CompilerDiagnostics = {
2116
errors: string[] | null
2217
warnings: string[] | null
@@ -44,6 +39,8 @@ type BuildStatusStore = {
4439
amp: AmpPageStatus
4540
}
4641

42+
// eslint typescript has a bug with TS enums
43+
/* eslint-disable no-shadow */
4744
enum WebpackStatusPhase {
4845
COMPILING = 1,
4946
COMPILED_WITH_ERRORS = 2,

packages/next/build/webpack-config.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,10 @@ export default async function getBaseWebpackConfig(
596596
async function handleExternals(
597597
context: string,
598598
request: string,
599-
getResolve: () => (context: string, request: string) => Promise<string>
599+
getResolve: () => (
600+
resolveContext: string,
601+
resolveRequest: string
602+
) => Promise<string>
600603
) {
601604
if (request === 'next') {
602605
return `commonjs ${request}`
@@ -763,8 +766,8 @@ export default async function getBaseWebpackConfig(
763766
context: string
764767
request: string
765768
getResolve: () => (
766-
context: string,
767-
request: string
769+
resolveContext: string,
770+
resolveRequest: string
768771
) => Promise<string>
769772
}) => handleExternals(context, request, getResolve)
770773
: (

packages/next/build/webpack/plugins/webpack-conformance-plugin/TestInterface.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ export interface IConformanceAnomaly {
66
stack_trace?: string
77
}
88

9+
// eslint typescript has a bug with TS enums
10+
/* eslint-disable no-shadow */
911
export enum IConformanceTestStatus {
1012
SUCCESS,
1113
FAILED,

packages/next/build/webpack/plugins/webpack-conformance-plugin/checks/granular-chunks-conformance.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* @eslint-disable no-redeclare */
12
import chalk from 'chalk'
23
import {
34
CONFORMANCE_ERROR_PREFIX,
@@ -10,11 +11,6 @@ import {
1011
} from '../TestInterface'
1112
import { deepEqual } from '../utils/utils'
1213

13-
export interface GranularChunksConformanceCheck
14-
extends IWebpackConformanceTest {
15-
granularChunksConfig: any
16-
}
17-
1814
function getWarningMessage(modifiedProp: string) {
1915
return (
2016
`${CONFORMANCE_WARNING_PREFIX}: The splitChunks config has been carefully ` +
@@ -33,7 +29,9 @@ function getErrorMessage(message: string) {
3329
)
3430
}
3531

36-
export class GranularChunksConformanceCheck {
32+
/* @eslint-disable-next-line no-redeclare */
33+
export class GranularChunksConformanceCheck implements IWebpackConformanceTest {
34+
granularChunksConfig: any
3735
constructor(granularChunksConfig: any) {
3836
this.granularChunksConfig = granularChunksConfig
3937
}

packages/next/lib/recursive-copy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export async function recursiveCopy(
1414
}: {
1515
concurrency?: number
1616
overwrite?: boolean
17-
filter?(path: string): boolean
17+
filter?(filePath: string): boolean
1818
} = {}
1919
): Promise<void> {
2020
const cwdPath = process.cwd()

packages/next/lib/typescript/diagnosticFormatter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { codeFrameColumns } from 'next/dist/compiled/babel/code-frame'
22
import chalk from 'chalk'
33
import path from 'path'
44

5+
// eslint typescript has a bug with TS enums
6+
/* eslint-disable no-shadow */
57
export enum DiagnosticCategory {
68
Warning = 0,
79
Error = 1,

packages/next/next-server/lib/post-process.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type renderOptions = {
1414
getFontDefinition?: (url: string) => string
1515
}
1616

17-
type postProcessData = {
17+
type PostProcessData = {
1818
preloads: {
1919
images: Array<string>
2020
}
@@ -23,12 +23,12 @@ type postProcessData = {
2323
interface PostProcessMiddleware {
2424
inspect: (
2525
originalDom: HTMLElement,
26-
data: postProcessData,
26+
data: PostProcessData,
2727
options: renderOptions
2828
) => void
2929
mutate: (
3030
markup: string,
31-
data: postProcessData,
31+
data: PostProcessData,
3232
options: renderOptions
3333
) => Promise<string>
3434
}
@@ -58,7 +58,7 @@ async function processHTML(
5858
if (!middlewareRegistry[0]) {
5959
return html
6060
}
61-
const postProcessData: postProcessData = {
61+
const postProcessData: PostProcessData = {
6262
preloads: {
6363
images: [],
6464
},
@@ -92,7 +92,7 @@ class FontOptimizerMiddleware implements PostProcessMiddleware {
9292
fontDefinitions: (string | undefined)[][] = []
9393
inspect(
9494
originalDom: HTMLElement,
95-
_data: postProcessData,
95+
_data: PostProcessData,
9696
options: renderOptions
9797
) {
9898
if (!options.getFontDefinition) {
@@ -121,7 +121,7 @@ class FontOptimizerMiddleware implements PostProcessMiddleware {
121121
}
122122
mutate = async (
123123
markup: string,
124-
_data: postProcessData,
124+
_data: PostProcessData,
125125
options: renderOptions
126126
) => {
127127
let result = markup
@@ -157,7 +157,7 @@ class FontOptimizerMiddleware implements PostProcessMiddleware {
157157
}
158158

159159
class ImageOptimizerMiddleware implements PostProcessMiddleware {
160-
inspect(originalDom: HTMLElement, _data: postProcessData) {
160+
inspect(originalDom: HTMLElement, _data: PostProcessData) {
161161
const imgElements = originalDom.querySelectorAll('img')
162162
let eligibleImages: Array<HTMLElement> = []
163163
for (let i = 0; i < imgElements.length; i++) {
@@ -178,7 +178,7 @@ class ImageOptimizerMiddleware implements PostProcessMiddleware {
178178
}
179179
}
180180
}
181-
mutate = async (markup: string, _data: postProcessData) => {
181+
mutate = async (markup: string, _data: PostProcessData) => {
182182
let result = markup
183183
let imagePreloadTags = _data.preloads.images
184184
.filter((imgHref) => !preloadTagAlreadyExists(markup, imgHref))

packages/next/next-server/lib/router/router.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* global __NEXT_DATA__ */
21
// tslint:disable:no-console
32
import { ParsedUrlQuery } from 'querystring'
43
import { ComponentType } from 'react'
@@ -554,7 +553,7 @@ export default class Router implements BaseRouter {
554553
pageLoader: any
555554
Component: ComponentType
556555
App: AppComponent
557-
wrapApp: (App: AppComponent) => any
556+
wrapApp: (WrapAppComponent: AppComponent) => any
558557
err?: Error
559558
isFallback: boolean
560559
locale?: string

0 commit comments

Comments
 (0)