Skip to content

Commit 4274647

Browse files
authored
update ESLint to v9 (Vencord#859)
1 parent 24fbf35 commit 4274647

File tree

4 files changed

+439
-245
lines changed

4 files changed

+439
-245
lines changed

.eslintrc.json

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

eslint.config.mjs

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
/*
2+
* SPDX-License-Identifier: GPL-3.0
3+
* Vesktop, a desktop app aiming to give you a snappier Discord Experience
4+
* Copyright (c) 2023 Vendicated and Vencord contributors
5+
*/
6+
7+
//@ts-check
8+
9+
import stylistic from "@stylistic/eslint-plugin";
10+
import pathAlias from "eslint-plugin-path-alias";
11+
import header from "eslint-plugin-simple-header";
12+
import importSort from "eslint-plugin-simple-import-sort";
13+
import unusedImports from "eslint-plugin-unused-imports";
14+
import tseslint from "typescript-eslint";
15+
import prettier from "eslint-plugin-prettier";
16+
17+
export default tseslint.config(
18+
{ ignores: ["dist"] },
19+
20+
{
21+
files: ["src/**/*.{tsx,ts,mts,mjs,js,jsx}"],
22+
plugins: {
23+
header,
24+
stylistic,
25+
importSort,
26+
unusedImports,
27+
pathAlias,
28+
prettier
29+
},
30+
settings: {
31+
"import/resolver": {
32+
alias: {
33+
map: []
34+
}
35+
}
36+
},
37+
languageOptions: {
38+
parser: tseslint.parser,
39+
parserOptions: {
40+
project: true,
41+
tsconfigRootDir: import.meta.dirname
42+
}
43+
},
44+
rules: {
45+
"header/header": [
46+
"error",
47+
{
48+
files: ["scripts/header.txt"]
49+
}
50+
],
51+
52+
// ESLint Rules
53+
54+
yoda: "error",
55+
eqeqeq: ["error", "always", { null: "ignore" }],
56+
"prefer-destructuring": [
57+
"error",
58+
{
59+
VariableDeclarator: { array: false, object: true },
60+
AssignmentExpression: { array: false, object: false }
61+
}
62+
],
63+
"operator-assignment": ["error", "always"],
64+
"no-useless-computed-key": "error",
65+
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
66+
"no-invalid-regexp": "error",
67+
"no-constant-condition": ["error", { checkLoops: false }],
68+
"no-duplicate-imports": "error",
69+
"dot-notation": "error",
70+
"no-useless-escape": "error",
71+
"no-fallthrough": "error",
72+
"for-direction": "error",
73+
"no-async-promise-executor": "error",
74+
"no-cond-assign": "error",
75+
"no-dupe-else-if": "error",
76+
"no-duplicate-case": "error",
77+
"no-irregular-whitespace": "error",
78+
"no-loss-of-precision": "error",
79+
"no-misleading-character-class": "error",
80+
"no-prototype-builtins": "error",
81+
"no-regex-spaces": "error",
82+
"no-shadow-restricted-names": "error",
83+
"no-unexpected-multiline": "error",
84+
"no-unsafe-optional-chaining": "error",
85+
"no-useless-backreference": "error",
86+
"use-isnan": "error",
87+
"prefer-const": "error",
88+
"prefer-spread": "error",
89+
90+
// Styling Rules
91+
"stylistic/spaced-comment": ["error", "always", { markers: ["!"] }],
92+
"stylistic/no-extra-semi": "error",
93+
94+
// Plugin Rules
95+
"importSort/imports": "error",
96+
"importSort/exports": "error",
97+
"unusedImports/no-unused-imports": "error",
98+
"pathAlias/no-relative": "error",
99+
"prettier/prettier": "error"
100+
}
101+
}
102+
);

package.json

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"build:dev": "pnpm build --dev",
1414
"package": "pnpm build && electron-builder",
1515
"package:dir": "pnpm build && electron-builder --dir",
16-
"lint": "eslint . --ext .js,.jsx,.ts,.tsx,.mts,.mjs",
16+
"lint": "eslint",
1717
"lint:fix": "pnpm lint --fix",
1818
"start": "pnpm build && electron .",
1919
"start:dev": "pnpm build:dev && electron .",
@@ -32,28 +32,27 @@
3232
},
3333
"devDependencies": {
3434
"@fal-works/esbuild-plugin-global-externals": "^2.1.2",
35+
"@stylistic/eslint-plugin": "^2.8.0",
3536
"@types/node": "^20.14.11",
3637
"@types/react": "^18.3.3",
37-
"@typescript-eslint/eslint-plugin": "^7.17.0",
38-
"@typescript-eslint/parser": "^7.17.0",
3938
"@vencord/types": "^1.8.4",
4039
"dotenv": "^16.4.5",
4140
"electron": "^31.2.1",
4241
"electron-builder": "^25.0.1",
4342
"esbuild": "^0.20.2",
44-
"eslint": "^8.57.0",
45-
"eslint-config-prettier": "^9.1.0",
43+
"eslint": "^9.10.0",
4644
"eslint-import-resolver-alias": "^1.1.2",
47-
"eslint-plugin-license-header": "^0.6.1",
4845
"eslint-plugin-path-alias": "^1.1.0",
4946
"eslint-plugin-prettier": "^5.2.1",
47+
"eslint-plugin-simple-header": "^1.2.1",
5048
"eslint-plugin-simple-import-sort": "^12.1.1",
5149
"eslint-plugin-unused-imports": "^3.2.0",
5250
"prettier": "^3.3.3",
5351
"source-map-support": "^0.5.21",
5452
"tsx": "^4.16.2",
5553
"type-fest": "^4.23.0",
5654
"typescript": "^5.5.4",
55+
"typescript-eslint": "^8.5.0",
5756
"xml-formatter": "^3.6.3"
5857
},
5958
"packageManager": "[email protected]",
@@ -181,9 +180,9 @@
181180
"provider": "github"
182181
},
183182
"rpm": {
184-
"fpm": [
183+
"fpm": [
185184
"--rpm-rpmbuild-define=_build_id_links none"
186-
]
185+
]
187186
}
188187
},
189188
"pnpm": {
@@ -192,4 +191,3 @@
192191
}
193192
}
194193
}
195-

0 commit comments

Comments
 (0)