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

chore: use eslint 9 internally#9119

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
JoshuaKGoldberg merged 39 commits intotypescript-eslint:v8fromabrahamguo:eslint-9
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
39 commits
Select commitHold shift + click to select a range
482dea2
eslint 9
abrahamguoMay 18, 2024
3623435
add compat
abrahamguoMay 21, 2024
2bbb91a
add fixup
abrahamguoMay 21, 2024
b3dab19
fixup react
abrahamguoMay 22, 2024
fa3d79f
add more fixups
abrahamguoMay 22, 2024
ad65eaf
add issue comment
abrahamguoMay 22, 2024
06bc0d0
lint and empty types
abrahamguoMay 22, 2024
148304f
fix types
abrahamguoMay 22, 2024
f665a25
remove eslint9 ci test
abrahamguoMay 22, 2024
3d2844a
rename
abrahamguoMay 22, 2024
e05c917
update no-restricted-imports snapshot
abrahamguoMay 22, 2024
7772628
update build script
abrahamguoMay 22, 2024
1906460
change quote style
abrahamguoMay 22, 2024
535574b
revert renaming
abrahamguoMay 23, 2024
d916841
Merge branch 'v8' of https://github.com/typescript-eslint/typescript-…
abrahamguoMay 25, 2024
d41caf5
begin migrating config files
abrahamguoMay 26, 2024
2d45bb6
Merge branch 'v8' of https://github.com/typescript-eslint/typescript-…
abrahamguoJun 3, 2024
9cfe5cd
migrate markdown to v9
abrahamguoJun 3, 2024
f63ff71
migrate recommended-does-not-require-program
abrahamguoJun 3, 2024
44879bf
Merge branch 'main' of github.com:abrahamguo/typescript-eslint into e…
abrahamguoJun 3, 2024
c148a63
migrate eslint.config.js
abrahamguoJun 4, 2024
82e0b2d
Merge branch 'v8' of https://github.com/typescript-eslint/typescript-…
abrahamguoJun 4, 2024
14f95ad
migrate vue-sfc, except for TS errors
abrahamguoJun 4, 2024
d1a0722
Merge branch 'v8' of https://github.com/typescript-eslint/typescript-…
abrahamguoJun 6, 2024
061d0c3
remove flatconfig boolean
abrahamguoJun 6, 2024
34206ff
remove config file option
abrahamguoJun 6, 2024
0319a55
remove deprecated rules
abrahamguoJun 6, 2024
0f47c86
Merge branch 'v8' of https://github.com/typescript-eslint/typescript-…
abrahamguoJun 13, 2024
e09b293
correct issue
abrahamguoJun 13, 2024
123e9bb
Merge branch 'v8' of https://github.com/typescript-eslint/typescript-…
abrahamguoJun 27, 2024
fd2973f
revert style change
abrahamguoJun 27, 2024
b08cbd9
add clarifying comment
abrahamguoJun 27, 2024
2e08c7f
Merge branch 'v8' of https://github.com/typescript-eslint/typescript-…
abrahamguoJul 1, 2024
472487b
Merge branch 'v8' of https://github.com/typescript-eslint/typescript-…
abrahamguoJul 1, 2024
3720bd4
remove unnecessary suppression
abrahamguoJul 1, 2024
bc22423
remove unnecessary suppression
abrahamguoJul 1, 2024
6cd00f5
Merge branch 'v8' of https://github.com/typescript-eslint/typescript-…
abrahamguoJul 1, 2024
d01d7d6
remove unused suppression
abrahamguoJul 1, 2024
5ffa053
Merge branch 'v8' of https://github.com/typescript-eslint/typescript-…
abrahamguoJul 1, 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: 0 additions & 19 deletions.github/workflows/ci.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -134,25 +134,6 @@ 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
18 changes: 12 additions & 6 deletionseslint.config.mjs
View file
Open in desktop
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

ESLint 9 displays unused lint suppressions aswarnings, not errors, so there were 3 unused lint suppressions that were displayed in the pipeline but did not block it. I've removed all of those, and provided an explanation for each one.

Hmmm, turns out oureslint.config.mjs doesn't havelinterOptions: { reportUnusedDisableDirectives: 'error' }. Maybe this is a good chance to turn it on?


This seems a bit suspicious to me though: this option has not been enabled for this repository until now. Maybe there are some considerations in favor of leaving this option disabled?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Just want to clarify that it was the upgrade from ESLint 8 to ESLint 9 that caused it to begin reporting unnecessary lint suppressions.
I feel like it makes sense to keep it at the default value, or change the level fromwarning toerror, but I'm open to further discussion.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yeah I'd +1 switching toerror as a followup. Great find!

abrahamguo reacted with thumbs up emoji
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,7 @@

import url from 'node:url';

import { fixupConfigRules, fixupPluginRules } from '@eslint/compat';
import { FlatCompat } from '@eslint/eslintrc';
import eslint from '@eslint/js';
import tseslintInternalPlugin from '@typescript-eslint/eslint-plugin-internal';
Expand DownExpand Up@@ -29,15 +30,20 @@ export default tseslint.config(
plugins: {
['@typescript-eslint']: tseslint.plugin,
['@typescript-eslint/internal']: tseslintInternalPlugin,
['deprecation']: deprecationPlugin,
// https://github.com/gund/eslint-plugin-deprecation/issues/78
// https://github.com/typescript-eslint/typescript-eslint/issues/8988
['deprecation']: fixupPluginRules(deprecationPlugin),
['eslint-comments']: eslintCommentsPlugin,
['eslint-plugin']: eslintPluginPlugin,
['import']: importPlugin,
// https://github.com/import-js/eslint-plugin-import/issues/2948
['import']: fixupPluginRules(importPlugin),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

we might want to consider switching toeslint-plugin-import-x?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'd be in support of this as a separate followup yeah.

['jest']: jestPlugin,
['jsdoc']: jsdocPlugin,
['jsx-a11y']: jsxA11yPlugin,
['react-hooks']: reactHooksPlugin,
['react']: reactPlugin,
// https://github.com/facebook/react/issues/28313
['react-hooks']: fixupPluginRules(reactHooksPlugin),
// https://github.com/jsx-eslint/eslint-plugin-react/issues/3699
['react']: fixupPluginRules(reactPlugin),
['simple-import-sort']: simpleImportSortPlugin,
['unicorn']: unicornPlugin,
},
Expand DownExpand Up@@ -512,8 +518,8 @@ export default tseslint.config(
files: ['packages/website/**/*.{ts,tsx,mts,cts,js,jsx}'],
extends: [
...compat.config(jsxA11yPlugin.configs.recommended),
...compat.config(reactPlugin.configs.recommended),
...compat.config(reactHooksPlugin.configs.recommended),
...fixupConfigRules(compat.config(reactPlugin.configs.recommended)),
...fixupConfigRules(compat.config(reactHooksPlugin.configs.recommended)),
Comment on lines +521 to +522
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

it's so weird that we need to fixup the plugin both here and in the plugin def.
seems like quite the flaw in the design of the compat tooling tbh

Copy link
ContributorAuthor

@abrahamguoabrahamguoJun 27, 2024
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

@bradzacher that's actually not true.

This can be removedif you are OK with me editing the section at the top of this file labeledregistering all the plugins up-front, and removing any plugin for which we use a shared config (for example,reactPlugin andreactHooksPlugin).
Shared configs automatically register their corresponding plugin, so it is unnecessary to manually register the plugin.

The flip side, of course, would be if you felt that it's important to preserve a complete up-front list of all plugins used in any part of the config.

If we choose to keep the complete up-front list of plugins, then the reason why we have to use the compat utilities twice, is because the plugins are defined twice (again, redundantly so), and we need to make sure that inboth places that each plugin is registered, it is the fixed-up version.

],
rules: {
'@typescript-eslint/internal/prefer-ast-types-enum': 'off',
Expand Down
5 changes: 3 additions & 2 deletionspackage.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,6 +60,7 @@
"@babel/eslint-parser": "^7.24.1",
"@babel/parser": "^7.24.4",
"@babel/types": "^7.24.0",
"@eslint/compat": "^1.0.1",
"@eslint/eslintrc": "^2.1.4",
"@eslint/js": "^8.57.0",
"@jest/types": "29.6.3",
Expand All@@ -85,7 +86,7 @@
"cross-fetch": "^4.0.0",
"cspell": "^8.6.1",
"downlevel-dts": ">=0.11.0",
"eslint": "8.57.0",
"eslint": "^9.3.0",
"eslint-plugin-deprecation": "^2.0.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-eslint-plugin": "^5.5.0",
Expand DownExpand Up@@ -129,7 +130,7 @@
"@types/estree": "link:./tools/dummypkg",
"@types/node": "^20.0.0",
"@types/react": "^18.2.14",
"eslint": "8.57.0",
"eslint": "^9",
"eslint-visitor-keys": "^3.4.1",
"jest-config": "^29",
"jest-resolve": "^29",
Expand Down
1 change: 0 additions & 1 deletionpackages/eslint-plugin/rules.d.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -74,5 +74,4 @@ export type TypeScriptESLintRules = Record<
>;

declare const rules: TypeScriptESLintRules;
// eslint-disable-next-line import/no-default-export
export default rules;
1 change: 0 additions & 1 deletionpackages/eslint-plugin/src/rules/prefer-regexp-exec.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/prefer-literal-enum-member */
import type { TSESTree } from '@typescript-eslint/utils';
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
import * as tsutils from 'ts-api-utils';
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -229,10 +229,6 @@ const RawBaseCases = (operator: '&&' | '||') =>
] as const;

export const identity: MutateFn = c => c;
/*
eslint-disable-next-line eslint-plugin/prefer-message-ids, eslint-plugin/prefer-object-rule, eslint-plugin/require-meta-type, eslint-plugin/require-meta-schema --
TODO - bug in hte rules - https://github.com/eslint-community/eslint-plugin-eslint-plugin/issues/455
*/
export const BaseCases: BaseCaseCreator = ({
operator,
mutateCode = identity,
Expand Down
View file
Open in desktop

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

30 changes: 0 additions & 30 deletionspackages/integration-tests/fixtures/markdown/.eslintrc.js
View file
Open in desktop

This file was deleted.

15 changes: 15 additions & 0 deletionspackages/integration-tests/fixtures/markdown/eslint.config.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
import markdown from 'eslint-plugin-markdown';
import tseslint from 'typescript-eslint';

export default tseslint.config(
tseslint.configs.base,
// this will also ensure that eslint will force lint the markdown files
{ plugins: { markdown }, files: ['**/*.md'], processor: 'markdown/markdown' },
{
files: ['**/*.md/*.{js,ts,jsx,tsx,javascript,node}'],
rules: {
'@typescript-eslint/no-explicit-any': 'error',
'no-console': 'error',
},
},
);
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
{
"type": "module",
"devDependencies": {
"eslint-plugin-markdown": "latest"
}
Expand Down
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

// This integration test exists to make sure that the recommended config does
// not require a program to be specified to ensure a fast and simple initial
// setup. Users can add on one of our other configs if they want to opt in to
// more expensive checks.
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
],
plugins: ['@typescript-eslint'],
};
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
);
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
{
"type": "module",
"devDependencies": {}
}
21 changes: 0 additions & 21 deletionspackages/integration-tests/fixtures/vue-jsx/.eslintrc.js
View file
Open in desktop

This file was deleted.

13 changes: 13 additions & 0 deletionspackages/integration-tests/fixtures/vue-jsx/eslint.config.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
import tseslint from 'typescript-eslint';
import pluginVue from 'eslint-plugin-vue';

export default tseslint.config(
tseslint.configs.base,
...pluginVue.configs['flat/essential'],
{
languageOptions: {
parserOptions: { ecmaFeatures: { jsx: true }, parser: tseslint.parser },
},
rules: { '@typescript-eslint/no-explicit-any': 'error' },
},
);
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
{
"type": "module",
"devDependencies": {
"vue-eslint-parser": "latest",
"eslint-plugin-vue": "latest",
Expand Down
21 changes: 0 additions & 21 deletionspackages/integration-tests/fixtures/vue-sfc/.eslintrc.js
View file
Open in desktop

This file was deleted.

20 changes: 20 additions & 0 deletionspackages/integration-tests/fixtures/vue-sfc/eslint.config.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
import pluginVue from 'eslint-plugin-vue';
import tseslint from 'typescript-eslint';

export default tseslint.config(
tseslint.configs.base,
...pluginVue.configs['flat/essential'],
{
languageOptions: {
parserOptions: {
parser: tseslint.parser,
project: '/usr/linked/tsconfig.json',
},
},
rules: {
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'semi-spacing': 'error',
},
},
);
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
{
"type": "module",
"devDependencies": {
"vue-eslint-parser": "latest",
"eslint-plugin-vue": "latest",
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,16 +24,7 @@ exports[`recommended-does-not-require-program eslint should work successfully 1`
"output": "const foo: unknown = true;
",
"suppressedMessages": [],
"usedDeprecatedRules": [
{
"replacedBy": [],
"ruleId": "no-extra-semi",
},
{
"replacedBy": [],
"ruleId": "no-mixed-spaces-and-tabs",
},
],
"usedDeprecatedRules": [],
"warningCount": 0,
},
]
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,4 +25,4 @@ for (const additionalFlags of [
},
);
}
eslintIntegrationTest(__filename, 'eslint.config.js', true);
eslintIntegrationTest(__filename, 'eslint.config.js');
3 changes: 0 additions & 3 deletionspackages/integration-tests/tools/integration-test-base.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -128,7 +128,6 @@ function integrationTest(
export function eslintIntegrationTest(
testFilename: string,
filesGlob: string,
flatConfig = false,
): void {
integrationTest('eslint', testFilename, async testFolder => {
// lint, outputting to a JSON file
Expand All@@ -143,8 +142,6 @@ export function eslintIntegrationTest(
'json',
'--output-file',
outFile,
'--config',
flatConfig ? './eslint.config.js' : './.eslintrc.js',
'--fix-dry-run',
filesGlob,
],
Expand Down
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp