Skip to content

Commit 2fe9900

Browse files
authored
Upgrade ESLint to v9 with flat config format (#322)
Migrate from ESLint 8 to ESLint 9, which requires converting the legacy .eslintrc.json configuration to the new flat config format (eslint.config.js). Changes: - Update eslint to ^9.17.0 - Add @eslint/js, @eslint/compat, and globals packages - Create eslint.config.js with flat config format - Remove .eslintrc.json and .eslintignore (now handled in config) - Update lint scripts to remove deprecated --ext flag - Fix unused catch binding warnings using ES2019+ optional catch binding
1 parent e3bc432 commit 2fe9900

File tree

7 files changed

+361
-381
lines changed

7 files changed

+361
-381
lines changed

.eslintignore

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

.eslintrc.json

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

eslint.config.js

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
const js = require("@eslint/js");
2+
const globals = require("globals");
3+
const { fixupPluginRules } = require("@eslint/compat");
4+
const jqueryPlugin = require("eslint-plugin-jquery");
5+
6+
module.exports = [
7+
// Ignore patterns
8+
{
9+
ignores: [
10+
"node_modules/**",
11+
"build/**",
12+
"test-results/**",
13+
"logos/**",
14+
"translations/**",
15+
"src/styles/**",
16+
"src/images/**",
17+
"src/_locales/**",
18+
"src/sound/**"
19+
]
20+
},
21+
22+
// Base configuration for all JS files
23+
{
24+
files: ["**/*.js"],
25+
...js.configs.recommended,
26+
plugins: {
27+
jquery: fixupPluginRules(jqueryPlugin)
28+
},
29+
languageOptions: {
30+
ecmaVersion: 2021,
31+
sourceType: "script",
32+
globals: {
33+
...globals.browser,
34+
...globals.es2021,
35+
browser: "readonly",
36+
chrome: "readonly",
37+
$: "readonly",
38+
jQuery: "readonly",
39+
Mustache: "readonly",
40+
DOMPurify: "readonly",
41+
timeago: "readonly",
42+
importScripts: "readonly"
43+
}
44+
},
45+
rules: {
46+
indent: ["error", 4, { SwitchCase: 1 }],
47+
quotes: ["error", "double", { avoidEscape: true }],
48+
semi: ["error", "always"],
49+
curly: ["error", "all"],
50+
"no-console": "off",
51+
"no-unused-vars": ["warn", { args: "none" }],
52+
"no-var": "off",
53+
"no-empty": ["warn", { allowEmptyCatch: false }],
54+
"jquery/no-ready": "warn"
55+
}
56+
},
57+
58+
// Background script overrides
59+
{
60+
files: ["src/scripts/background.js"],
61+
languageOptions: {
62+
globals: {
63+
appGlobal: "readonly",
64+
getFeeds: "readonly",
65+
getSavedFeeds: "readonly",
66+
markAsRead: "readonly",
67+
toggleSavedFeed: "readonly",
68+
openFeedlyTab: "readonly",
69+
resetCounter: "readonly",
70+
getAccessToken: "readonly",
71+
readOptions: "readonly",
72+
initialize: "readonly"
73+
}
74+
}
75+
},
76+
77+
// Gruntfile configuration
78+
{
79+
files: ["Gruntfile.js"],
80+
languageOptions: {
81+
globals: {
82+
...globals.node
83+
}
84+
}
85+
},
86+
87+
// Core and options scripts
88+
{
89+
files: ["src/scripts/core.js", "src/scripts/options.js"],
90+
languageOptions: {
91+
globals: {
92+
FeedlyApiClient: "readonly"
93+
}
94+
}
95+
}
96+
];

0 commit comments

Comments
 (0)