Skip to content

Commit 83b7a26

Browse files
authored
Upgrades Eslint to v9 (#6694)
## What's the problem this PR addresses? We're still relying on ESLint 8, which isn't supported anymore. Fixes #6687, #6689 Supercedes #6693 ## How did you fix it? This PR upgrades ESLint to its latest version, switching to the stylistic rules when needed. No rules were removed. ## Checklist <!--- Don't worry if you miss something, chores are automatically tested. --> <!--- This checklist exists to help you remember doing the chores when you submit a PR. --> <!--- Put an `x` in all the boxes that apply. --> - [x] I have read the [Contributing Guide](https://yarnpkg.com/advanced/contributing). <!-- See https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released for more details. --> <!-- Check with `yarn version check` and fix with `yarn version check -i` --> - [x] I have set the packages that need to be released for my changes to be effective. <!-- The "Testing chores" workflow validates that your PR follows our guidelines. --> <!-- If it doesn't pass, click on it to see details as to what your PR might be missing. --> - [x] I will check that all automated PR checks pass before the PR gets reviewed.
1 parent d01f16b commit 83b7a26

File tree

268 files changed

+2053
-1614
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

268 files changed

+2053
-1614
lines changed

.pnp.cjs

+930-718
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

.yarn/versions/80c87cf1.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
releases:
2+
"@yarnpkg/eslint-config": major
3+
4+
declined:
5+
- "@yarnpkg/plugin-constraints"
6+
- "@yarnpkg/plugin-essentials"
7+
- "@yarnpkg/plugin-git"
8+
- "@yarnpkg/plugin-github"
9+
- "@yarnpkg/plugin-interactive-tools"
10+
- "@yarnpkg/plugin-nm"
11+
- "@yarnpkg/plugin-npm"
12+
- "@yarnpkg/plugin-npm-cli"
13+
- "@yarnpkg/plugin-patch"
14+
- "@yarnpkg/plugin-pnp"
15+
- "@yarnpkg/plugin-stage"
16+
- "@yarnpkg/plugin-typescript"
17+
- "@yarnpkg/plugin-version"
18+
- "@yarnpkg/plugin-workspace-tools"
19+
- vscode-zipfs
20+
- "@yarnpkg/core"
21+
- "@yarnpkg/extensions"
22+
- "@yarnpkg/fslib"
23+
- "@yarnpkg/libui"
24+
- "@yarnpkg/libzip"
25+
- "@yarnpkg/nm"
26+
- "@yarnpkg/parsers"
27+
- "@yarnpkg/pnp"
28+
- "@yarnpkg/pnpify"
29+
- "@yarnpkg/sdks"
30+
- "@yarnpkg/shell"

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"@yarnpkg/sdks": "workspace:^",
2121
"clipanion": "^4.0.0-rc.2",
2222
"esbuild": "npm:esbuild-wasm@^0.23.0",
23-
"eslint": "^8.57.0",
23+
"eslint": "^9.20.1",
2424
"jest": "^29.2.1",
2525
"pirates": "^4.0.5",
2626
"tslib": "^2.4.0",

packages/acceptance-tests/pkg-tests-core/sources/utils/fs.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export const readSyml = async (source: PortablePath): Promise<any> => {
7272

7373
try {
7474
return parseSyml(fileContent);
75-
} catch (error) {
75+
} catch {
7676
throw new Error(`Invalid syml file (${source})`);
7777
}
7878
};

packages/acceptance-tests/pkg-tests-core/sources/utils/makeTemporaryMonorepoEnv.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const mtme = (
2626

2727
if (typeof fn !== `function`) {
2828
throw new Error(
29-
// eslint-disable-next-line
29+
3030
`Invalid test function (got ${typeof fn}) - you probably put the closing parenthesis of the "makeTemporaryEnv" utility at the wrong place`,
3131
);
3232
}

packages/acceptance-tests/pkg-tests-core/sources/utils/tests.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ const packageServerUrls: {
319319
https: Promise<string> | null;
320320
} = {http: null, https: null};
321321

322-
export const startPackageServer = ({type}: { type: keyof typeof packageServerUrls } = {type: `http`}): Promise<string> => {
322+
export const startPackageServer = ({type}: {type: keyof typeof packageServerUrls} = {type: `http`}): Promise<string> => {
323323
const serverUrl = packageServerUrls[type];
324324
if (serverUrl !== null)
325325
return serverUrl;
@@ -474,7 +474,7 @@ export const startPackageServer = ({type}: { type: keyof typeof packageServerUrl
474474
let body;
475475
try {
476476
body = JSON.parse(rawData);
477-
} catch (e) {
477+
} catch {
478478
return processError(response, 401, `Unauthorized`);
479479
}
480480

@@ -507,7 +507,7 @@ export const startPackageServer = ({type}: { type: keyof typeof packageServerUrl
507507
let body;
508508
try {
509509
body = JSON.parse(rawData);
510-
} catch (e) {
510+
} catch {
511511
return processError(response, 401, `Invalid`);
512512
}
513513

@@ -537,7 +537,7 @@ export const startPackageServer = ({type}: { type: keyof typeof packageServerUrl
537537
let body;
538538
try {
539539
body = JSON.parse(rawData);
540-
} catch (e) {
540+
} catch {
541541
return processError(response, 401, `Invalid`);
542542
}
543543

@@ -774,7 +774,6 @@ export const generatePkgDriver = ({
774774

775775
if (typeof fn !== `function`) {
776776
throw new Error(
777-
// eslint-disable-next-line
778777
`Invalid test function (got ${typeof fn}) - you probably put the closing parenthesis of the "makeTemporaryEnv" utility at the wrong place`,
779778
);
780779
}
@@ -919,7 +918,7 @@ export const getHttpsCertificates = async () => {
919918
if (httpsCertificates)
920919
return httpsCertificates;
921920

922-
const createCSR = promisify<pem.CSRCreationOptions, { csr: string, clientKey: string }>(pem.createCSR);
921+
const createCSR = promisify<pem.CSRCreationOptions, {csr: string, clientKey: string}>(pem.createCSR);
923922
const createCertificate = promisify<pem.CertificateCreationOptions, pem.CertificateCreationResult>(pem.createCertificate);
924923

925924
const {csr, clientKey} = await createCSR({commonName: `yarn`});

packages/acceptance-tests/pkg-tests-specs/sources/basic.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ describe(`Basic tests`, () => {
144144

145145
await expect(
146146
source(
147-
// eslint-disable-next-line
147+
148148
`require('dep-loop-entry') === require('dep-loop-entry').dependencies['dep-loop-exit'].dependencies['dep-loop-entry']`,
149149
),
150150
);

packages/acceptance-tests/pkg-tests-specs/sources/commands/config.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function cleanupJsonOutput(output: string, path: PortablePath, homePath: Portabl
6969
let outputObject;
7070
try {
7171
outputObject = JSON.parse(output);
72-
} catch (e) {
72+
} catch {
7373
return cleanupPlainOutput(output, path, homePath);
7474
}
7575

packages/acceptance-tests/pkg-tests-specs/sources/exports.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export type Assertions = {
2323
fail?: Array<[/*request: */string, {message: string, code: string, pnpCode?: string}]>;
2424
};
2525

26-
export function makeTemporaryExportsEnv(testPackageName: string, manifest: Omit<Manifest, 'name'>, files: Array<string>, {pass, fail}: Assertions) {
26+
export function makeTemporaryExportsEnv(testPackageName: string, manifest: Omit<Manifest, `name`>, files: Array<string>, {pass, fail}: Assertions) {
2727
return makeTemporaryEnv({
2828
dependencies: {
2929
[testPackageName]: `file:./${testPackageName}`,

packages/acceptance-tests/pkg-tests-specs/sources/features/editorSdks.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,14 @@ describe(`Features`, () => {
168168
seq: 1,
169169
type: `request`,
170170
command: `typeDefinition`,
171-
arguments: {file: ourUtilityFile, line: 7, offset: 9},
171+
arguments: {file: ourUtilityFile, line: 5, offset: 9},
172172
});
173173

174174
await runAndWait(yarnpkgCli, {
175175
seq: 2,
176176
type: `request`,
177177
command: `typeDefinition`,
178-
arguments: {file: ourUtilityFile, line: 6, offset: 9},
178+
arguments: {file: ourUtilityFile, line: 4, offset: 9},
179179
});
180180
} finally {
181181
child.stdin.end();

packages/acceptance-tests/pkg-tests-specs/sources/features/editorSdks.utility.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable */
2-
31
// This file MUST NOT CHANGE. We're using it for the VSCode / TS integration
42
// tests, which require to reference symbols by their offset.
53

packages/docusaurus/config/docusaurus/plugins/cli-docs.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const loader = jiti(__filename, {
1818
requireCache: false,
1919
});
2020

21-
const binaries: Array<{ name: string, getCli: () => Promise<Cli<BaseContext>>, watch: Array<string> }> = [
21+
const binaries: Array<{name: string, getCli: () => Promise<Cli<BaseContext>>, watch: Array<string>}> = [
2222
{
2323
name: `@yarnpkg/cli`,
2424
getCli: async () => {

packages/docusaurus/config/remark/commandLineHighlight.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ const makeCommandLine = (line: string, cli: YarnCli) => {
133133
const makeCommandOrRawLine = (line: string, cli: YarnCli) => {
134134
try {
135135
return makeCommandLine(line, cli);
136-
} catch (err: any) {
136+
} catch {
137137
console.log(`Failed to parse "${line}"`);
138138
return makeRawLine(line);
139139
}

packages/docusaurus/docusaurus.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ async function typedocPluginConfig(): Promise<Partial<DocusaurusPluginTypeDocApi
9696
};
9797
}
9898

99-
async function getPreviousVersions(): Promise<Array<{ label: string, href: string }>> {
99+
async function getPreviousVersions(): Promise<Array<{label: string, href: string}>> {
100100
const [npmResponse, repoResponse] = await Promise.all([
101101
// eslint-disable-next-line no-restricted-globals
102102
fetch(`https://registry.npmjs.org/yarn`, {headers: {accept: `application/vnd.npm.install-v1+json`}})

packages/docusaurus/src/lib/npmTools.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export type PackageListingError =
6161

6262
export type WithErrors<T, TError extends {type: string}> =
6363
| (T & {error?: null})
64-
| { error: TError };
64+
| {error: TError};
6565

6666
export type PackageInfoQuery = ReturnType<typeof usePackageInfo>;
6767
export type ReleaseInfoQuery = ReturnType<typeof useReleaseInfo>;

packages/docusaurus/src/theme/DocRoot/Layout/index.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-undef */
21
import {useLocation} from '@docusaurus/router';
32
import {useDocsSidebar} from '@docusaurus/theme-common/internal';
43
import BackToTopButton from '@theme/BackToTopButton';

packages/eslint-config/package.json

+9-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@
88
"./react": "./react.js"
99
},
1010
"dependencies": {
11-
"@typescript-eslint/eslint-plugin": "^7.8.0",
12-
"@typescript-eslint/parser": "^7.8.0",
11+
"@stylistic/eslint-plugin": "^3.1.0",
12+
"@stylistic/eslint-plugin-jsx": "^3.1.0",
13+
"@typescript-eslint/eslint-plugin": "^8.24.0",
14+
"@typescript-eslint/parser": "^8.24.0",
1315
"eslint-plugin-arca": "^0.16.0",
14-
"eslint-plugin-react": "^7.34.1",
15-
"globals": "^15.1.0"
16+
"eslint-plugin-react": "^7.37.4",
17+
"globals": "^15.15.0",
18+
"tslib": "^2.4.0"
1619
},
1720
"peerDependencies": {
1821
"eslint": "*",
@@ -32,7 +35,8 @@
3235
"node": ">=18.12.0"
3336
},
3437
"devDependencies": {
35-
"eslint": "^8.57.0"
38+
"eslint": "^9.20.1",
39+
"typescript": "^5.5.2"
3640
},
3741
"stableVersion": "2.1.0"
3842
}

packages/eslint-config/rules/style.js

+37-33
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import typescriptEslint from '@typescript-eslint/eslint-plugin';
2-
import arcaEslint from 'eslint-plugin-arca';
1+
import stylisticJsxEslint from '@stylistic/eslint-plugin-jsx';
2+
import stylisticEslint from '@stylistic/eslint-plugin';
3+
import typescriptEslint from '@typescript-eslint/eslint-plugin';
4+
import arcaEslint from 'eslint-plugin-arca';
35

46
// eslint-disable-next-line arca/no-default-export
57
export default [
@@ -9,29 +11,31 @@ export default [
911
plugins: {
1012
[`arca`]: arcaEslint,
1113
[`@typescript-eslint`]: typescriptEslint,
14+
[`@stylistic`]: stylisticEslint,
15+
[`@stylistic-jsx`]: stylisticJsxEslint,
1216
},
1317

1418
rules: {
1519
'@typescript-eslint/array-type': [`error`, {
1620
default: `generic`,
1721
}],
1822

19-
'@typescript-eslint/brace-style': 2,
23+
'@stylistic/brace-style': 2,
2024

21-
'@typescript-eslint/comma-dangle': [`error`, `always-multiline`],
25+
'@stylistic/comma-dangle': [`error`, `always-multiline`],
2226

23-
'@typescript-eslint/keyword-spacing': 2,
27+
'@stylistic/keyword-spacing': 2,
2428

25-
'@typescript-eslint/comma-spacing': 2,
29+
'@stylistic/comma-spacing': 2,
2630

27-
'@typescript-eslint/func-call-spacing': 2,
31+
'@stylistic/func-call-spacing': 2,
2832

29-
'@typescript-eslint/indent': [`error`, 2, {
33+
'@stylistic/indent': [`error`, 2, {
3034
SwitchCase: 1,
3135
ignoredNodes: [`TSTypeParameterInstantiation`],
3236
}],
3337

34-
'@typescript-eslint/member-delimiter-style': [`error`, {
38+
'@stylistic/member-delimiter-style': [`error`, {
3539
multiline: {
3640
delimiter: `semi`,
3741
requireLast: true,
@@ -53,13 +57,13 @@ export default [
5357
},
5458
}],
5559

56-
'@typescript-eslint/quotes': [`error`, `backtick`],
60+
'@stylistic/quotes': [`error`, `backtick`],
5761

58-
'@typescript-eslint/semi': 2,
62+
'@stylistic/semi': 2,
5963

60-
'@typescript-eslint/space-infix-ops': 2,
64+
'@stylistic/space-infix-ops': 2,
6165

62-
'@typescript-eslint/type-annotation-spacing': 2,
66+
'@stylistic/type-annotation-spacing': 2,
6367

6468
'arca/import-quotes': 2,
6569

@@ -77,50 +81,50 @@ export default [
7781
enableOnelinerSections: true,
7882
}],
7983

80-
'array-bracket-spacing': 2,
84+
'@stylistic/array-bracket-spacing': 2,
8185

82-
'arrow-parens': [`error`, `as-needed`],
86+
'@stylistic/arrow-parens': [`error`, `as-needed`],
8387

84-
'arrow-spacing': 2,
88+
'@stylistic/arrow-spacing': 2,
8589

86-
'computed-property-spacing': 2,
90+
'@stylistic/computed-property-spacing': 2,
8791

88-
'eol-last': [`error`, `always`],
92+
'@stylistic/eol-last': [`error`, `always`],
8993

90-
'generator-star-spacing': [`error`, {
94+
'@stylistic/generator-star-spacing': [`error`, {
9195
before: true,
9296
after: true,
9397
}],
9498

95-
'jsx-quotes': 2,
99+
'@stylistic/jsx-quotes': 2,
96100

97-
'key-spacing': 2,
101+
'@stylistic/key-spacing': 2,
98102

99-
'no-extra-semi': 2,
103+
'@stylistic/no-extra-semi': 2,
100104

101105
'no-irregular-whitespace': 2,
102106

103-
'no-mixed-spaces-and-tabs': 2,
107+
'@stylistic/no-mixed-spaces-and-tabs': 2,
104108

105-
'no-multiple-empty-lines': [`error`, {max: 2, maxBOF: 0, maxEOF: 0}],
109+
'@stylistic/no-multiple-empty-lines': [`error`, {max: 2, maxBOF: 0, maxEOF: 0}],
106110

107-
'no-tabs': 2,
111+
'@stylistic/no-tabs': 2,
108112

109-
'no-trailing-spaces': 2,
113+
'@stylistic/no-trailing-spaces': 2,
110114

111-
'object-curly-spacing': 2,
115+
'@stylistic/object-curly-spacing': 2,
112116

113-
'padded-blocks': [`error`, `never`],
117+
'@stylistic/padded-blocks': [`error`, `never`],
114118

115-
'quote-props': [`error`, `as-needed`],
119+
'@stylistic/quote-props': [`error`, `as-needed`],
116120

117-
'rest-spread-spacing': 2,
121+
'@stylistic/rest-spread-spacing': 2,
118122

119-
'space-before-blocks': 2,
123+
'@stylistic/space-before-blocks': 2,
120124

121-
'space-in-parens': 2,
125+
'@stylistic/space-in-parens': 2,
122126

123-
'template-curly-spacing': 2,
127+
'@stylistic/template-curly-spacing': 2,
124128
},
125129
},
126130
];

packages/plugin-compat/extra/resolve/normalize-options.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module.exports = function (_, opts) {
3737
let manifestPath;
3838
try {
3939
manifestPath = api.resolveToUnqualified(`${parts[1]}/package.json`, basedir, {considerBuiltins: false});
40-
} catch (err) {
40+
} catch {
4141
return null;
4242
}
4343

packages/plugin-constraints/sources/tauModule.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import getPath from 'lodash/get';
66
import pl from 'tau-prolog';
77
import vm from 'vm';
88

9-
// eslint-disable-next-line @typescript-eslint/naming-convention
9+
1010
const {is_atom: isAtom, is_variable: isVariable, is_instantiated_list: isInstantiatedList} = pl.type;
1111

1212
function prependGoals(thread: pl.type.Thread, point: pl.type.State, goals: Array<pl.type.Term<number, string>>): void {

packages/plugin-essentials/sources/commands/info.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ export default class InfoCommand extends BaseCommand {
229229
const fetcher = configuration.makeFetcher();
230230
const fetcherOptions: FetchOptions = {project, fetcher, cache, checksums: project.storedChecksums, report: new ThrowReport(), cacheOptions: {skipIntegrityCheck: true}};
231231

232-
const builtinInfoBuilders: Array<Exclude<Hooks['fetchPackageInfo'], undefined>> = [
232+
const builtinInfoBuilders: Array<Exclude<Hooks[`fetchPackageInfo`], undefined>> = [
233233
// Manifest fields
234234
async (pkg, extra, registerData) => {
235235
if (!extra.has(`manifest`))

0 commit comments

Comments
 (0)