Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: support ESLint v9#9002

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions.github/workflows/ci.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -134,6 +134,25 @@ jobs:
run: yarn stylelint
working-directory: packages/website

eslint_v9_tests:
name: Run tests on ESLint v9
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install
uses: ./.github/actions/prepare-install
with:
node-version: ${{ env.PRIMARY_NODE_VERSION }}
- name: Build
uses: ./.github/actions/prepare-build
- run: yarn add eslint@9
- name: Run tests
run: yarn test
env:
CI: true

integration_tests:
name: Run integration tests on primary Node.js version
needs: [build]
Expand Down

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

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

View file
Open in desktop

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

2 changes: 1 addition & 1 deletionpackages/eslint-plugin/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -103,7 +103,7 @@
},
"peerDependencies": {
"@typescript-eslint/parser": "^7.0.0",
"eslint": "^8.57.0"
"eslint": "^8.57.0 || ^9.0.0"
},
"peerDependenciesMeta": {
"typescript": {
Expand Down
2 changes: 1 addition & 1 deletionpackages/eslint-plugin/tests/docs.test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
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 deletionpackages/eslint-plugin/tests/rules/array-type.test.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
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
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,17 +16,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', {
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
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,9 +20,17 @@ const withMetaParserOptions = {
};

// this is used to ensure that the caching the utility does does not impact the results done by no-unused-vars
ruleTester.defineRule('collect-unused-vars', context => {
collectUnusedVariables(context);
return {};
ruleTester.defineRule('collect-unused-vars', {
create(context) {
collectUnusedVariables(context);
return {};
},
defaultOptions: [],
meta: {
messages: {},
type: 'problem',
schema: [],
},
});

ruleTester.run('no-unused-vars', rule, {
Expand Down
2 changes: 1 addition & 1 deletionpackages/parser/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -49,7 +49,7 @@
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"peerDependencies": {
"eslint": "^8.57.0"
"eslint": "^8.57.0 || ^9.0.0"
},
"dependencies": {
"@typescript-eslint/scope-manager": "7.8.0",
Expand Down
2 changes: 1 addition & 1 deletionpackages/rule-tester/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -56,7 +56,7 @@
},
"peerDependencies": {
"@eslint/eslintrc": ">=2",
"eslint": "^8.57.0"
"eslint": "^8.57.0 || ^9.0.0"
},
"devDependencies": {
"@types/lodash.merge": "4.6.9",
Expand Down
2 changes: 1 addition & 1 deletionpackages/rule-tester/src/RuleTester.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
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
3 changes: 0 additions & 3 deletionspackages/type-utils/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,9 +60,6 @@
"rimraf": "*",
"typescript": "*"
},
"peerDependencies": {
"eslint": "^8.57.0"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
Expand Down
3 changes: 0 additions & 3 deletionspackages/typescript-eslint/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -51,9 +51,6 @@
"test": "jest --coverage --passWithNoTests",
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"peerDependencies": {
"eslint": "^8.57.0"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "7.8.0",
"@typescript-eslint/parser": "7.8.0",
Expand Down
2 changes: 1 addition & 1 deletionpackages/utils/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -76,7 +76,7 @@
"semver": "^7.6.0"
},
"peerDependencies": {
"eslint": "^8.57.0"
"eslint": "^8.57.0 || ^9.0.0"
},
"devDependencies": {
"@typescript-eslint/parser": "7.8.0",
Expand Down
2 changes: 1 addition & 1 deletionpackages/utils/src/ts-eslint/Linter.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -276,7 +276,7 @@ namespace Linter {
parserOptions?: ParserOptions;
}

// TODO - RuleCreateFunctionisno longersupported inESLintv9
// TODO -removeRuleCreateFunctiononce weno longersupportESLint8
export type LegacyPluginRules = Record<
string,
AnyRuleCreateFunction | AnyRuleModule
Expand Down
2 changes: 1 addition & 1 deletionpackages/utils/src/ts-eslint/Rule.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -676,7 +676,7 @@ export type AnyRuleModuleWithMetaDocs = RuleModuleWithMetaDocs<
* @see {@link LooseParserModule}, {@link LooseProcessorModule}
*/
export type LooseRuleDefinition =
// TODO -ESLint v9 will removesupportfor RuleCreateFunction
// TODO -remove RuleCreateFunction once we no longersupportESLint 8
| LooseRuleCreateFunction
| {
meta?: object | undefined;
Expand Down
2 changes: 1 addition & 1 deletionpackages/website-eslint/src/index.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
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 deletionspackages/website-eslint/types/eslint.d.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
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;
}
}
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp