Skip to content

Commit d97959a

Browse files
authored
Merge pull request #37 from AFASSoftware/eslint
Eslint v9 upgrade
2 parents 683ea61 + f291677 commit d97959a

10 files changed

+368
-416
lines changed

.eslintignore

-11
This file was deleted.

.eslintrc.js

-75
This file was deleted.

eslint.config.mjs

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
// @ts-check
2+
3+
import eslint from "@eslint/js";
4+
import tsEslint from "typescript-eslint";
5+
import unusedImports from "eslint-plugin-unused-imports";
6+
7+
export default tsEslint.config(
8+
{
9+
ignores: [
10+
"build/",
11+
"dist/",
12+
".vscode/",
13+
"node_modules/",
14+
"templates/",
15+
"public/",
16+
".circleci/",
17+
],
18+
},
19+
{
20+
files: ["src/**/*.ts", "test/**/*.ts"],
21+
extends: [
22+
eslint.configs.recommended,
23+
...tsEslint.configs.recommendedTypeChecked,
24+
],
25+
plugins: {
26+
"unused-imports": unusedImports,
27+
},
28+
rules: {
29+
// Additional rules:
30+
...{
31+
eqeqeq: "error",
32+
"no-console": "error",
33+
"prefer-template": "error",
34+
"@typescript-eslint/no-shadow": "error",
35+
"no-unreachable": "error",
36+
"unused-imports/no-unused-imports": "warn",
37+
},
38+
39+
// Additional config for rules:
40+
...{
41+
"@typescript-eslint/explicit-module-boundary-types": [
42+
"error",
43+
{ allowArgumentsExplicitlyTypedAsAny: true },
44+
],
45+
"@typescript-eslint/no-unused-vars": [
46+
"warn",
47+
{ args: "none", caughtErrors: "none" },
48+
],
49+
},
50+
51+
// Disabled rules:
52+
...{
53+
"prefer-const": "off",
54+
"no-shadow": "off", // Replaced with "@typescript-eslint/no-shadow".
55+
"no-unused-vars": "off", // Replaced with "@typescript-eslint/no-unused-vars".
56+
"@typescript-eslint/no-non-null-assertion": "off",
57+
"@typescript-eslint/no-explicit-any": "off",
58+
"@typescript-eslint/no-unsafe-member-access": "off",
59+
"@typescript-eslint/unbound-method": "off",
60+
"@typescript-eslint/ban-ts-comment": "off",
61+
"@typescript-eslint/no-unsafe-argument": "off",
62+
"@typescript-eslint/no-empty-object-type": "off",
63+
},
64+
65+
// Rules to be enabled:
66+
...{
67+
"@typescript-eslint/ban-types": "off",
68+
"@typescript-eslint/no-unsafe-assignment": "off",
69+
"@typescript-eslint/no-unsafe-return": "off",
70+
"@typescript-eslint/no-unsafe-call": "off",
71+
"@typescript-eslint/restrict-template-expressions": "off",
72+
"@typescript-eslint/no-non-null-asserted-optional-chain": "off",
73+
},
74+
75+
// Rules to be discussed:
76+
...{
77+
"prefer-spread": "off",
78+
"no-async-promise-executor": "off",
79+
"no-case-declarations": "off",
80+
"no-fallthrough": "off",
81+
"no-inner-declarations": "off",
82+
"@typescript-eslint/require-await": "off",
83+
"@typescript-eslint/prefer-regexp-exec": "off",
84+
},
85+
},
86+
languageOptions: {
87+
parserOptions: {
88+
projectService: true,
89+
tsconfigRootDir: import.meta.dirname,
90+
warnOnUnsupportedTypeScriptVersion: false,
91+
},
92+
},
93+
},
94+
{
95+
files: ["test/**/*.ts"],
96+
rules: {
97+
"@typescript-eslint/no-unused-expressions": "off",
98+
},
99+
}
100+
);

package.json

+6-7
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"clean": "ts-node --transpile-only src/index clean",
2020
"coverage-show": "open-cli build/coverage/index.html",
2121
"ci": "ts-node --transpile-only src/index ci --no-format",
22-
"lint": "eslint . --ext .ts"
22+
"lint": "eslint"
2323
},
2424
"author": "[email protected]",
2525
"license": "MIT",
@@ -82,17 +82,16 @@
8282
"parser": "typescript"
8383
},
8484
"dependencies": {
85+
"@eslint/js": "9.10.0",
8586
"@types/chai": "4.3.19",
87+
"@types/eslint__js": "8.42.3",
8688
"@types/mocha": "10.0.8",
87-
"@typescript-eslint/eslint-plugin": "7.16.1",
88-
"@typescript-eslint/parser": "7.16.1",
8989
"async": "3.2.6",
9090
"chai": "4.4.1",
9191
"chokidar": "3.6.0",
92-
"eslint": "8.57.0",
92+
"eslint": "9.10.0",
9393
"eslint-config-prettier": "9.1.0",
94-
"eslint-plugin-es": "4.1.0",
95-
"eslint-plugin-unused-imports": "3.2.0",
94+
"eslint-plugin-unused-imports": "4.1.4",
9695
"glob": "8.1.0",
9796
"handlebars": "4.7.8",
9897
"husky": "9.1.6",
@@ -110,12 +109,12 @@
110109
"tslib": "2.7.0",
111110
"tsutils": "3.21.0",
112111
"typescript": "5.6.2",
112+
"typescript-eslint": "8.6.0",
113113
"ws": "7.5.2",
114114
"yargs": "15.4.1"
115115
},
116116
"devDependencies": {
117117
"@types/async": "3.2.24",
118-
"@types/eslint": "8.56.10",
119118
"@types/glob": "7.2.0",
120119
"@types/inquirer": "6.5.0",
121120
"@types/node": "22.5.5",

0 commit comments

Comments
 (0)