Skip to content

Commit a314e4f

Browse files
Copilotota-meshiCopilot
authored
feat: add ESLint 10 support (#1472)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ota-meshi <16508807+ota-meshi@users.noreply.github.com> Co-authored-by: yosuke ota <otameshiyo23@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 5ce66e8 commit a314e4f

8 files changed

Lines changed: 55 additions & 121 deletions

File tree

.changeset/lazy-wasps-collect.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"eslint-plugin-svelte": minor
3+
---
4+
5+
feat: add support for ESLint v10

.github/workflows/NodeCI.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,17 @@ jobs:
5858
strategy:
5959
matrix:
6060
os: [ubuntu-latest, windows-latest]
61-
eslint: [8, 9]
62-
node: [18.x, 20.x, 22.x, latest]
61+
eslint: [8, 9, 10]
62+
node: [20.x, 22.x, latest]
63+
include:
64+
# ESLint v9 and Node.js 18.x
65+
- os: ubuntu-latest
66+
eslint: 9
67+
node: 18.x
68+
# ESLint v8 and Node.js 18.x
69+
- os: ubuntu-latest
70+
eslint: 8
71+
node: 18.x
6372
steps:
6473
- name: Checkout
6574
uses: actions/checkout@v6

packages/eslint-plugin-svelte/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"version:ci": "env-cmd -e version-ci -- pnpm run update && changeset version"
5252
},
5353
"peerDependencies": {
54-
"eslint": "^8.57.1 || ^9.0.0",
54+
"eslint": "^8.57.1 || ^9.0.0 || ^10.0.0",
5555
"svelte": "^3.37.0 || ^4.0.0 || ^5.0.0"
5656
},
5757
"peerDependenciesMeta": {

packages/eslint-plugin-svelte/src/main.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,21 @@ import prettier from './configs/flat/prettier.js';
77
import all from './configs/flat/all.js';
88
import * as processor from './processor/index.js';
99
import * as metaModule from './meta.js';
10-
import type { Rule } from 'eslint';
10+
import type { Linter, Rule } from 'eslint';
1111

12+
/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion -- ts(2742) Error */
1213
export const configs = {
13-
base,
14-
recommended,
15-
prettier,
16-
all,
14+
base: base as Linter.Config[],
15+
recommended: recommended as Linter.Config[],
16+
prettier: prettier as Linter.Config[],
17+
all: all as Linter.Config[],
1718
// For backward compatibility
18-
'flat/base': base,
19-
'flat/recommended': recommended,
20-
'flat/prettier': prettier,
21-
'flat/all': all
19+
'flat/base': base as Linter.Config[],
20+
'flat/recommended': recommended as Linter.Config[],
21+
'flat/prettier': prettier as Linter.Config[],
22+
'flat/all': all as Linter.Config[]
2223
};
24+
/* eslint-enable @typescript-eslint/no-unnecessary-type-assertion -- ts(2742) Error */
2325

2426
export const rules = ruleList.reduce(
2527
(obj, r) => {

packages/eslint-plugin-svelte/src/rule-types.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
import type { Linter } from 'eslint'
88

99
declare module 'eslint' {
10-
namespace Linter {
11-
interface RulesRecord extends RuleOptions {}
12-
}
10+
interface RulesConfig extends RuleOptions {}
1311
}
1412

13+
/* eslint-disable */
14+
/* prettier-ignore */
15+
1516
export interface RuleOptions {
1617
/**
1718
* disallow conditionals where the type is always truthy or always falsy

packages/eslint-plugin-svelte/tools/update-rule-types.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,25 @@ void main();
66
async function main() {
77
const { pluginsToRulesDTS } = await import('eslint-typegen/core');
88

9-
// @ts-expect-error - types are a bit strict here
10-
const ruleTypes = await pluginsToRulesDTS({ svelte: plugin });
9+
const ruleTypes = await pluginsToRulesDTS(
10+
{ svelte: plugin },
11+
{ includeAugmentation: false, includeTypeImports: false }
12+
);
1113

1214
void fs.writeFileSync(
1315
new URL('../src/rule-types.ts', import.meta.url),
1416
`// IMPORTANT!
1517
// This file has been automatically generated,
1618
// in order to update its content execute "pnpm run update"
1719
20+
/* eslint-disable */
21+
/* prettier-ignore */
22+
import type { Linter } from 'eslint'
23+
24+
declare module 'eslint' {
25+
interface RulesConfig extends RuleOptions {}
26+
}
27+
1828
${ruleTypes}`
1929
);
2030
}

pnpm-lock.yaml

Lines changed: 10 additions & 104 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ minimumReleaseAgeExclude:
1919
- typescript-eslint-parser-for-extra-files
2020
- vite
2121
- zimmerframe
22+
- eslint
2223

2324
packages:
2425
- 'packages/*'

0 commit comments

Comments
 (0)