Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support ESLint v9 #9002

Merged
merged 30 commits into from May 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
3cfccd8
feat: support ESLint 9
JoshuaKGoldberg Apr 26, 2024
6f4fdd7
Fix some eslint-plugin tests
JoshuaKGoldberg Apr 26, 2024
7c3a185
Re-add v8 and remove unnecessary peerDependencies
JoshuaKGoldberg Apr 28, 2024
eae61eb
Fix no-unused-vars test rule
JoshuaKGoldberg Apr 28, 2024
0cd79cb
Merge branch 'v8' into eslint-9
JoshuaKGoldberg Apr 29, 2024
4aeed8a
Merge branch 'v8' into eslint-9
JoshuaKGoldberg Apr 29, 2024
13f3964
Updated snapshots
JoshuaKGoldberg Apr 29, 2024
0948bf2
put back tmp@0.2.1
JoshuaKGoldberg Apr 30, 2024
8bcb0e2
Fixed linting by disabling plugins temporarily
JoshuaKGoldberg Apr 30, 2024
e9b8908
Update two more integration snapshots for no-unused-vars
JoshuaKGoldberg Apr 30, 2024
1fc6fa2
Ugh, missing "
JoshuaKGoldberg Apr 30, 2024
e053179
Remove legacy rule function form
JoshuaKGoldberg May 7, 2024
b9f681f
Merge branch 'v8'
JoshuaKGoldberg May 7, 2024
6b6e249
Fix legacy-config test to actually use legacy config
JoshuaKGoldberg May 8, 2024
bc6d611
Revert "Remove legacy rule function form"
JoshuaKGoldberg May 8, 2024
0451e84
Update ESLint 8/9 RuleCreateFunction comments
JoshuaKGoldberg May 8, 2024
129eb65
Start reverting the local dev changes
JoshuaKGoldberg May 9, 2024
88024e2
Some more reverts
JoshuaKGoldberg May 9, 2024
1cae50d
oopsies comment level
JoshuaKGoldberg May 9, 2024
2bb898a
yarn test -u the integration tests
JoshuaKGoldberg May 9, 2024
8d893a4
Merge branch 'v8' into eslint-9
JoshuaKGoldberg May 9, 2024
53193dd
regenerate yarn.lock
JoshuaKGoldberg May 9, 2024
ed41f48
yarn dedupe, and undo some eslint.config changes
JoshuaKGoldberg May 9, 2024
0594a7a
Remove extra node:
JoshuaKGoldberg May 9, 2024
5b4c85f
Finally revert nodeType changes
JoshuaKGoldberg May 9, 2024
175c292
one more deprecation fix
JoshuaKGoldberg May 9, 2024
9a7d27f
Update eslint-plugin schemas snapshot
JoshuaKGoldberg May 9, 2024
4a79978
Annoying tmp version update
JoshuaKGoldberg May 9, 2024
72d19bd
Add eslint_v9_tests
JoshuaKGoldberg May 9, 2024
ee1d91c
Fix yarn.lock
JoshuaKGoldberg May 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions package.json
JoshuaKGoldberg marked this conversation as resolved.
Show resolved Hide resolved
Expand Up @@ -62,7 +62,7 @@
"@babel/eslint-parser": "^7.24.1",
"@babel/parser": "^7.24.4",
"@babel/types": "^7.24.0",
"@eslint/eslintrc": "^2.1.4",
"@eslint/eslintrc": "^3.0.2",
"@eslint/js": "^8.57.0",
"@nx/eslint": "18.2.3",
"@nx/jest": "18.2.3",
Expand All @@ -87,7 +87,7 @@
"cross-fetch": "^4.0.0",
"cspell": "^8.6.1",
"downlevel-dts": ">=0.11.0",
"eslint": "8.57.0",
"eslint": "9.1.1",
"eslint-plugin-deprecation": "^2.0.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-eslint-plugin": "^5.5.0",
Expand Down Expand Up @@ -124,6 +124,8 @@
"yargs": "17.7.2"
},
"resolutions": {
"@eslint/eslintrc": "^3.0.2",
"@eslint/js": "9.1.1",
"@jest/create-cache-key-function": "^29",
"@jest/reporters": "^29",
"@jest/test-result": "^29",
Expand All @@ -133,7 +135,7 @@
"@types/estree": "link:./tools/dummypkg",
"@types/node": "^20.0.0",
"@types/react": "^18.2.14",
"eslint": "8.57.0",
"eslint": "9.1.1",
"eslint-visitor-keys": "^3.4.1",
"jest-config": "^29",
"jest-resolve": "^29",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/eslint-plugin/package.json
Expand Up @@ -103,7 +103,7 @@
},
"peerDependencies": {
"@typescript-eslint/parser": "^7.0.0",
"eslint": "^8.57.0"
"eslint": "^9.0.0"
JoshuaKGoldberg marked this conversation as resolved.
Show resolved Hide resolved
},
"peerDependenciesMeta": {
"typescript": {
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin/tests/docs.test.ts
Expand Up @@ -100,7 +100,7 @@ function renderLintResults(code: string, errors: Linter.LintMessage[]): string {
return output.join('\n').trim() + '\n';
}

const linter = new Linter();
const linter = new Linter({ configType: 'eslintrc' });
linter.defineParser('@typescript-eslint/parser', tseslintParser);

const eslintOutputSnapshotFolder = path.resolve(
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin/tests/rules/array-type.test.ts
Expand Up @@ -1924,7 +1924,7 @@ interface FooInterface {
// -- eslint rule tester is not working with multi-pass
// https://github.com/eslint/eslint/issues/11187
describe('array-type (nested)', () => {
const linter = new TSESLint.Linter();
const linter = new TSESLint.Linter({ configType: 'eslintrc' });
linter.defineRule('array-type', rule);
linter.defineParser('@typescript-eslint/parser', parser);

Expand Down
Expand Up @@ -17,17 +17,25 @@ const ruleTester = new RuleTester({
},
});

ruleTester.defineRule('use-every-a', context => {
/**
* Mark a variable as used
*/
function useA(node: TSESTree.Node): void {
context.sourceCode.markVariableAsUsed('a', node);
}
return {
VariableDeclaration: useA,
ReturnStatement: useA,
};
ruleTester.defineRule('use-every-a', {
JoshuaKGoldberg marked this conversation as resolved.
Show resolved Hide resolved
create: context => {
/**
* Mark a variable as used
*/
function useA(node: TSESTree.Node): void {
context.sourceCode.markVariableAsUsed('a', node);
}
return {
VariableDeclaration: useA,
ReturnStatement: useA,
};
},
defaultOptions: [],
meta: {
messages: {},
type: 'problem',
schema: [],
},
});

/**
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/integration-tests/fixtures/eslint-v8/package.json
@@ -1,5 +1,5 @@
{
"devDependencies": {
"eslint": "8.57.0"
"eslint": "9.0.0"
JoshuaKGoldberg marked this conversation as resolved.
Show resolved Hide resolved
}
}
2 changes: 1 addition & 1 deletion packages/parser/package.json
Expand Up @@ -49,7 +49,7 @@
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"peerDependencies": {
"eslint": "^8.57.0"
"eslint": "^9.0.0"
JoshuaKGoldberg marked this conversation as resolved.
Show resolved Hide resolved
},
"dependencies": {
"@typescript-eslint/scope-manager": "7.7.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/rule-tester/package.json
Expand Up @@ -56,7 +56,7 @@
},
"peerDependencies": {
"@eslint/eslintrc": ">=2",
"eslint": "^8.57.0"
"eslint": "^9.0.0"
JoshuaKGoldberg marked this conversation as resolved.
Show resolved Hide resolved
},
"devDependencies": {
"@types/lodash.merge": "4.6.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/rule-tester/src/RuleTester.ts
Expand Up @@ -76,7 +76,7 @@ let defaultConfig = deepMerge(
export class RuleTester extends TestFramework {
readonly #testerConfig: TesterConfigWithDefaults;
readonly #rules: Record<string, AnyRuleCreateFunction | AnyRuleModule> = {};
readonly #linter: Linter = new Linter();
readonly #linter: Linter = new Linter({ configType: 'eslintrc' });

/**
* Creates a new instance of RuleTester.
Expand Down
2 changes: 1 addition & 1 deletion packages/type-utils/package.json
Expand Up @@ -61,7 +61,7 @@
"typescript": "*"
},
"peerDependencies": {
"eslint": "^8.57.0"
"eslint": "^9.0.0"
JoshuaKGoldberg marked this conversation as resolved.
Show resolved Hide resolved
},
"peerDependenciesMeta": {
"typescript": {
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript-eslint/package.json
Expand Up @@ -52,7 +52,7 @@
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"peerDependencies": {
"eslint": "^8.57.0"
"eslint": "^9.0.0"
JoshuaKGoldberg marked this conversation as resolved.
Show resolved Hide resolved
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "7.7.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/package.json
Expand Up @@ -76,7 +76,7 @@
"semver": "^7.6.0"
},
"peerDependencies": {
"eslint": "^8.57.0"
"eslint": "^9.0.0"
JoshuaKGoldberg marked this conversation as resolved.
Show resolved Hide resolved
},
"devDependencies": {
"@typescript-eslint/parser": "7.7.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/website-eslint/src/index.js
Expand Up @@ -24,7 +24,7 @@ exports.astConverter = astConverter;
exports.esquery = esquery;

exports.createLinter = function () {
const linter = new Linter();
const linter = new Linter({ configType: 'eslintrc' });
for (const name in plugin.rules) {
linter.defineRule(`@typescript-eslint/${name}`, plugin.rules[name]);
}
Expand Down
4 changes: 4 additions & 0 deletions packages/website-eslint/types/eslint.d.ts
Expand Up @@ -9,7 +9,11 @@ it just uses `any` for the import - marking it as an untyped export. So adding t
cannot use VSCode's cache ever - stubbing it out permanently.
*/
declare module 'eslint' {
export interface LinterOptions {
configType?: 'eslintrc';
}
export class Linter {
constructor(options: LinterOptions);
defineRule(name: string, rule: unknown): void;
}
}