Skip to content

Commit 19349a5

Browse files
committed
chore: update to eslint 9
1 parent 5839336 commit 19349a5

File tree

7 files changed

+2561
-1339
lines changed

7 files changed

+2561
-1339
lines changed

.eslintrc.yml

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

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424

2525
- uses: pnpm/action-setup@v4
2626
with:
27-
version: 9
27+
version: 10
2828

2929
- name: Install Node.js dependencies
3030
run: pnpm install

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
- uses: pnpm/action-setup@v4
2525
with:
26-
version: 9
26+
version: 10
2727

2828
- name: Install Node.js dependencies
2929
run: pnpm install

eslint.config.mjs

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
import eslint from "@eslint/js";
2+
import reactPlugin from "eslint-plugin-react";
3+
import globals from "globals";
4+
import tseslint from "typescript-eslint";
5+
6+
export default tseslint.config(
7+
eslint.configs.recommended,
8+
tseslint.configs.strictTypeChecked,
9+
tseslint.configs.stylisticTypeChecked,
10+
reactPlugin.configs.flat.recommended,
11+
reactPlugin.configs.flat["jsx-runtime"],
12+
{
13+
name: "base",
14+
settings: {
15+
react: {
16+
version: "18.3",
17+
},
18+
},
19+
languageOptions: {
20+
ecmaVersion: 2022,
21+
globals: {
22+
...globals.browser,
23+
...globals.node,
24+
},
25+
parserOptions: {
26+
projectService: true,
27+
tsconfigRootDir: import.meta.dirname,
28+
},
29+
},
30+
rules: {
31+
// - eslint rules
32+
// Possible Problems
33+
"array-callback-return": "error",
34+
"no-duplicate-imports": "warn",
35+
"no-self-compare": "error",
36+
"no-unmodified-loop-condition": "error",
37+
"no-unneeded-ternary": ["warn", { defaultAssignment: false }],
38+
"valid-typeof": ["error", { requireStringLiterals: true }],
39+
40+
// Suggestions
41+
"accessor-pairs": "warn",
42+
"block-scoped-var": "error",
43+
eqeqeq: ["error", "always", { null: "ignore" }],
44+
"no-empty": ["error", { allowEmptyCatch: true }],
45+
"no-eval": "error",
46+
"no-extend-native": "error",
47+
"no-extra-bind": "warn",
48+
"no-implicit-coercion": "error",
49+
"no-label-var": "error",
50+
"no-lone-blocks": "warn",
51+
"no-lonely-if": "warn",
52+
"no-multi-assign": "error",
53+
"no-new": "warn",
54+
"no-new-func": "error",
55+
"no-new-wrappers": "error",
56+
"no-throw-literal": "error",
57+
"no-undef-init": "error",
58+
"no-useless-call": "warn",
59+
"no-useless-computed-key": "warn",
60+
"no-useless-concat": "warn",
61+
"no-useless-rename": "warn",
62+
"no-useless-return": "warn",
63+
radix: "error",
64+
"object-shorthand": "warn",
65+
"operator-assignment": "warn",
66+
"prefer-regex-literals": "warn",
67+
"prefer-rest-params": "error",
68+
"prefer-spread": "error",
69+
"prefer-template": "warn",
70+
"sort-imports": ["warn", { ignoreDeclarationSort: true }],
71+
"symbol-description": "error",
72+
yoda: ["warn", "never", { exceptRange: true }],
73+
74+
// - typescript-eslint rules
75+
"no-unused-vars": "off",
76+
"@typescript-eslint/array-type": ["warn", { default: "array-simple" }],
77+
"@typescript-eslint/default-param-last": "error",
78+
"@typescript-eslint/dot-notation": ["warn", { allowKeywords: true }],
79+
"@typescript-eslint/explicit-function-return-type": [
80+
"error",
81+
{
82+
allowExpressions: true,
83+
allowConciseArrowFunctionExpressionsStartingWithVoid: true,
84+
},
85+
],
86+
"@typescript-eslint/explicit-member-accessibility": ["warn", { accessibility: "explicit" }],
87+
"@typescript-eslint/naming-convention": [
88+
"warn",
89+
{
90+
selector: "default",
91+
format: ["camelCase", "PascalCase", "UPPER_CASE"],
92+
leadingUnderscore: "allow",
93+
trailingUnderscore: "allow",
94+
filter: {
95+
regex: "^[a-zA-Z_$][a-zA-Z0-9_$]*$",
96+
match: true,
97+
},
98+
},
99+
],
100+
"@typescript-eslint/no-array-constructor": "error",
101+
"@typescript-eslint/no-confusing-void-expression": ["warn", { ignoreArrowShorthand: true }],
102+
"@typescript-eslint/no-floating-promises": ["error", { ignoreIIFE: true }],
103+
"@typescript-eslint/no-misused-promises": ["error", { checksVoidReturn: false }],
104+
"@typescript-eslint/no-unnecessary-condition": [
105+
"warn",
106+
{ allowConstantLoopConditions: false },
107+
],
108+
"@typescript-eslint/no-unused-vars": [
109+
"error",
110+
{
111+
vars: "all",
112+
varsIgnorePattern: "^_",
113+
args: "all",
114+
argsIgnorePattern: "^_",
115+
ignoreRestSiblings: true,
116+
caughtErrors: "all",
117+
caughtErrorsIgnorePattern: "^_",
118+
},
119+
],
120+
"@typescript-eslint/no-use-before-define": [
121+
"error",
122+
{
123+
functions: false,
124+
classes: false,
125+
variables: true,
126+
allowNamedExports: true,
127+
},
128+
],
129+
"@typescript-eslint/no-useless-constructor": "warn",
130+
"@typescript-eslint/prefer-destructuring": [
131+
"warn",
132+
{
133+
VariableDeclarator: { array: false, object: true },
134+
AssignmentExpression: { array: false, object: false },
135+
},
136+
{ enforceForRenamedProperties: false },
137+
],
138+
139+
"@typescript-eslint/no-invalid-void-type": "off",
140+
"@typescript-eslint/no-namespace": "off",
141+
"@typescript-eslint/no-non-null-assertion": "off",
142+
"@typescript-eslint/no-redundant-type-constituents": "off",
143+
"@typescript-eslint/no-require-imports": "off",
144+
"@typescript-eslint/no-unnecessary-type-parameters": "off",
145+
"@typescript-eslint/no-unsafe-assignment": "off",
146+
"@typescript-eslint/no-unsafe-call": "off",
147+
"@typescript-eslint/no-unsafe-member-access": "off",
148+
"@typescript-eslint/no-unsafe-return": "off",
149+
"@typescript-eslint/prefer-nullish-coalescing": "off",
150+
"@typescript-eslint/restrict-template-expressions": "off",
151+
152+
// - eslint-plugin-react rules
153+
"react/display-name": "off",
154+
"react/prop-types": "off",
155+
},
156+
},
157+
);

package.json

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
"name": "plugin-template",
33
"version": "1.0.0",
44
"description": "A plugin template",
5+
"license": "ISC",
56
"engines": {
67
"node": ">=20.0.0",
7-
"pnpm": ">=9.0.0"
8+
"pnpm": ">=10.0.0"
89
},
10+
"author": "",
911
"scripts": {
1012
"build": "replugged build plugin",
1113
"watch": "replugged build plugin --watch",
@@ -19,18 +21,15 @@
1921
"lint": "pnpm run prettier:check && pnpm run eslint:check && pnpm run check",
2022
"lint:fix": "pnpm run prettier:fix && pnpm run eslint:fix"
2123
},
22-
"keywords": [],
23-
"author": "",
24-
"license": "ISC",
2524
"devDependencies": {
26-
"@types/node": "^20.14.10",
27-
"@typescript-eslint/eslint-plugin": "^7.15.0",
28-
"@typescript-eslint/parser": "^7.15.0",
29-
"eslint": "^8.57.0",
30-
"eslint-config-dmitmel": "github:dmitmel/eslint-config-dmitmel",
31-
"eslint-plugin-node": "^11.1.0",
32-
"prettier": "^3.3.2",
33-
"replugged": "^4.8.1",
34-
"typescript": "^5.4.5"
25+
"@eslint/js": "^9.23.0",
26+
"@types/node": "^20.17.25",
27+
"eslint": "^9.23.0",
28+
"eslint-plugin-react": "^7.37.4",
29+
"globals": "^16.0.0",
30+
"prettier": "^3.5.3",
31+
"replugged": "^4.8.4",
32+
"typescript": "~5.8.2",
33+
"typescript-eslint": "^8.27.0"
3534
}
3635
}

0 commit comments

Comments
 (0)