Skip to content

Commit 86990ea

Browse files
castastropheclaude
andcommitted
fix(eslint): migrate to flat config for ESLint v10 compatibility
- Replace .eslintrc (legacy format, unsupported in v10) with eslint.config.js - Add @eslint/js and globals as devDependencies for flat config - Fix unused catch binding in index.js (no-unused-vars now surfaces cleanly) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6189f75 commit 86990ea

7 files changed

Lines changed: 209 additions & 217 deletions

File tree

.eslintrc

Lines changed: 0 additions & 100 deletions
This file was deleted.

.github/workflows/testing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ jobs:
133133
reporter: github-pr-review
134134
filter_mode: diff_context
135135
# eslint_flags: "components/*/stories/*.js"
136-
eslint_flags: "--config ${{ github.workspace }}/.eslintrc ${{ steps.changed-files.outputs.eslint_added_files }} ${{ steps.changed-files.outputs.eslint_modified_files }}"
136+
eslint_flags: "--config ${{ github.workspace }}/eslint.config.js ${{ steps.changed-files.outputs.eslint_added_files }} ${{ steps.changed-files.outputs.eslint_modified_files }}"
137137

138138
- name: Run markdownlint on documentation
139139
uses: reviewdog/action-markdownlint@v0.26.2

.yarnrc.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1+
approvedGitRepositories:
2+
- "**"
3+
4+
enableScripts: true
5+
16
nodeLinker: node-modules

eslint.config.js

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
import js from "@eslint/js";
2+
import globals from "globals";
3+
import jsoncPlugin from "eslint-plugin-jsonc";
4+
import * as jsoncParser from "jsonc-eslint-parser";
5+
6+
export default [
7+
js.configs.recommended,
8+
{
9+
languageOptions: {
10+
ecmaVersion: 2022,
11+
sourceType: "module",
12+
globals: {
13+
...globals.node,
14+
},
15+
},
16+
rules: {
17+
"brace-style": ["warn", "stroustrup", { allowSingleLine: true }],
18+
"func-call-spacing": ["warn", "never"],
19+
indent: ["warn", "tab", { ignoredNodes: ["TemplateLiteral *"], SwitchCase: 1 }],
20+
"linebreak-style": ["warn", "unix"],
21+
"no-console": ["warn", { allow: ["warn", "error"] }],
22+
quotes: ["warn", "double"],
23+
semi: ["warn", "always"],
24+
"space-before-blocks": ["warn", "always"],
25+
},
26+
},
27+
{
28+
files: ["**/*.json"],
29+
plugins: { jsonc: jsoncPlugin },
30+
languageOptions: { parser: jsoncParser },
31+
rules: {
32+
...jsoncPlugin.configs["recommended-with-jsonc"].rules,
33+
},
34+
},
35+
{
36+
files: ["package.json"],
37+
rules: {
38+
"jsonc/sort-keys": [
39+
"warn",
40+
{
41+
pathPattern: "^$",
42+
order: [
43+
"$schema",
44+
"private",
45+
"name",
46+
"version",
47+
"description",
48+
"license",
49+
"author",
50+
"maintainers",
51+
"contributors",
52+
"homepage",
53+
"repository",
54+
"bugs",
55+
"type",
56+
"exports",
57+
"main",
58+
"module",
59+
"browser",
60+
"man",
61+
"preferGlobal",
62+
"bin",
63+
"files",
64+
"directories",
65+
"scripts",
66+
"config",
67+
"sideEffects",
68+
"types",
69+
"typings",
70+
"workspaces",
71+
"resolutions",
72+
"dependencies",
73+
"bundleDependencies",
74+
"bundledDependencies",
75+
"peerDependencies",
76+
"peerDependenciesMeta",
77+
"optionalDependencies",
78+
"devDependencies",
79+
"keywords",
80+
"engines",
81+
"engineStrict",
82+
"os",
83+
"cpu",
84+
"publishConfig",
85+
],
86+
},
87+
{
88+
pathPattern: "^repository$",
89+
order: ["type", "url", "directory"],
90+
},
91+
{
92+
pathPattern: "^spectrum$",
93+
order: { type: "asc" },
94+
},
95+
{
96+
pathPattern: "^exports$",
97+
order: ["."],
98+
},
99+
{
100+
pathPattern: ".*",
101+
order: { type: "asc" },
102+
},
103+
],
104+
},
105+
},
106+
];

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export default async function (
7474
try {
7575
base64 = Buffer.from(sourcemap)?.toString("base64");
7676
}
77-
catch (e) {
77+
catch {
7878
/* empty */
7979
}
8080

package.json

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,29 @@
3333
"yargs": "^18.0.0"
3434
},
3535
"devDependencies": {
36-
"@commitlint/cli": "^20.3.0",
37-
"@commitlint/config-conventional": "^20.3.0",
36+
"@commitlint/cli": "^20.5.0",
37+
"@commitlint/config-conventional": "^20.5.0",
38+
"@eslint/js": "^10.0.1",
3839
"@semantic-release/changelog": "^6.0.3",
3940
"@semantic-release/commit-analyzer": "^13.0.1",
4041
"@semantic-release/git": "^10.0.1",
41-
"@semantic-release/github": "^12.0.2",
42-
"@semantic-release/npm": "^13.1.3",
42+
"@semantic-release/github": "^12.0.6",
43+
"@semantic-release/npm": "^13.1.5",
4344
"@semantic-release/release-notes-generator": "^14.1.0",
4445
"ava": "^7.0.0",
4546
"c8": "^11.0.0",
46-
"eslint": "^10.0.0",
47-
"eslint-plugin-jsonc": "^2.21.0",
47+
"eslint": "^10.2.1",
48+
"eslint-plugin-jsonc": "^3.1.2",
49+
"globals": "^16.5.0",
4850
"husky": "^9.1.7",
49-
"jsonc-eslint-parser": "^3.0.0",
50-
"lint-staged": "^16.2.7",
51+
"jsonc-eslint-parser": "^3.1.0",
52+
"lint-staged": "^16.4.0",
5153
"markdownlint": "^0.40.0",
5254
"markdownlint-cli": "^0.48.0",
5355
"mock-fs": "^5.5.0",
54-
"prettier": "^3.7.4",
56+
"prettier": "^3.8.3",
5557
"prettier-package-json": "^2.8.0",
56-
"semantic-release": "^25.0.2"
58+
"semantic-release": "^25.0.3"
5759
},
5860
"keywords": [
5961
"cli",
@@ -93,5 +95,5 @@
9395
"prettier-package-json --write"
9496
]
9597
},
96-
"packageManager": "yarn@4.13.0"
98+
"packageManager": "yarn@4.14.1"
9799
}

0 commit comments

Comments
 (0)