Skip to content

Commit 4af20bc

Browse files
committed
Update eslint
1 parent 1325d78 commit 4af20bc

File tree

6 files changed

+313
-306
lines changed

6 files changed

+313
-306
lines changed

.eslintrc.json

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

.ncurc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
2+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
23
target: (dependencyName, [{ semver, version, operator, major, minor, patch, release, build }]) => {
3-
if (dependencyName === "eslint") return "minor";
44
if (dependencyName === "@types/node") return "minor";
55
if (major === "0") return "minor";
66
return "latest";

eslint.config.mjs

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
// @ts-check
2+
import eslint from "@eslint/js";
3+
import eslintPlguinSimpleImportSort from "eslint-plugin-simple-import-sort";
4+
import eslintPluginUnicorn from "eslint-plugin-unicorn";
5+
import globals from "globals";
6+
import tseslint from "typescript-eslint";
7+
8+
export default tseslint.config(
9+
{
10+
files: ["**/*.{ts,tsx,cts,mts,js,cjs,mjs}"],
11+
},
12+
{
13+
ignores: [
14+
"**/dist/**",
15+
"**/node_modules/**",
16+
"bin/**",
17+
"coverage/**",
18+
],
19+
},
20+
eslint.configs.recommended,
21+
...tseslint.configs.recommendedTypeChecked,
22+
...tseslint.configs.stylistic,
23+
eslintPluginUnicorn.configs["flat/recommended"],
24+
{
25+
languageOptions: {
26+
parserOptions: {
27+
warnOnUnsupportedTypeScriptVersion: false,
28+
ecmaVersion: "latest",
29+
sourceType: "module",
30+
project: true,
31+
},
32+
globals: globals.node,
33+
},
34+
plugins: {
35+
"simple-import-sort": eslintPlguinSimpleImportSort,
36+
},
37+
},
38+
{
39+
"rules": {
40+
"eqeqeq": "error",
41+
"no-constant-condition": "off",
42+
"no-inner-declarations": "off",
43+
"no-undef": "off",
44+
"no-unused-vars": "off",
45+
"no-empty": "off",
46+
"simple-import-sort/imports": "error",
47+
"simple-import-sort/exports": "error",
48+
"@typescript-eslint/no-import-type-side-effects": "error",
49+
// In theory good, but less good when declaring a new interface and
50+
// stopping to think about its contents.
51+
"@typescript-eslint/no-empty-interface": "off",
52+
"@typescript-eslint/no-namespace": "off",
53+
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }],
54+
"@typescript-eslint/no-use-before-define": "off",
55+
"@typescript-eslint/no-explicit-any": "off",
56+
"@typescript-eslint/no-unsafe-argument": "off",
57+
"@typescript-eslint/no-unsafe-assignment": "off",
58+
"@typescript-eslint/no-unsafe-call": "off",
59+
"@typescript-eslint/no-unsafe-member-access": "off",
60+
"@typescript-eslint/no-unsafe-return": "off",
61+
"@typescript-eslint/no-empty-object-type": "off",
62+
"@typescript-eslint/require-await": "off",
63+
"@typescript-eslint/restrict-template-expressions": "off",
64+
"@typescript-eslint/naming-convention": [
65+
"error",
66+
{
67+
"selector": [
68+
"classProperty",
69+
"typeProperty",
70+
"parameterProperty",
71+
"classMethod",
72+
"typeMethod",
73+
"accessor",
74+
],
75+
"modifiers": ["private"],
76+
"leadingUnderscore": "require",
77+
"format": ["camelCase"],
78+
"filter": {
79+
"regex": "^(test_| )",
80+
"match": false,
81+
},
82+
},
83+
{
84+
"selector": [
85+
"classProperty",
86+
"typeProperty",
87+
"parameterProperty",
88+
"classMethod",
89+
"typeMethod",
90+
"accessor",
91+
],
92+
"modifiers": ["protected"],
93+
"leadingUnderscore": "allow",
94+
"format": ["camelCase"],
95+
"filter": {
96+
"regex": "^(test_| )",
97+
"match": false,
98+
},
99+
},
100+
{
101+
"selector": [
102+
"classProperty",
103+
"typeProperty",
104+
"parameterProperty",
105+
"classMethod",
106+
"typeMethod",
107+
"accessor",
108+
],
109+
"modifiers": ["public"],
110+
"leadingUnderscore": "forbid",
111+
"format": ["camelCase"],
112+
"filter": {
113+
"regex": "^(test_| )",
114+
"match": false,
115+
},
116+
},
117+
],
118+
"unicorn/catch-error-name": "off",
119+
"unicorn/filename-case": "off",
120+
"unicorn/no-array-callback-reference": "off",
121+
"unicorn/no-await-expression-member": "off",
122+
"unicorn/no-useless-undefined": "off",
123+
"unicorn/prefer-top-level-await": "off", // Reenable once Node 12 is dropped.
124+
"unicorn/prevent-abbreviations": "off",
125+
"unicorn/switch-case-braces": "off",
126+
"unicorn/prefer-string-replace-all": "off", // Bad suggestion for old targets
127+
},
128+
},
129+
{
130+
files: [
131+
".ncurc.cjs",
132+
"eslint.config.mjs",
133+
],
134+
extends: [tseslint.configs.disableTypeChecked],
135+
},
136+
);

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@
2626
"@types/adm-zip": "^0.5.7",
2727
"@types/node": "^18.19.67",
2828
"@types/semver": "^7.5.8",
29-
"@typescript-eslint/eslint-plugin": "^8.17.0",
30-
"@typescript-eslint/parser": "^8.17.0",
3129
"dprint": "^0.47.6",
32-
"eslint": "^8.57.1",
30+
"eslint": "^9.16.0",
3331
"eslint-plugin-simple-import-sort": "^12.1.1",
3432
"eslint-plugin-unicorn": "^56.0.1",
33+
"globals": "^15.13.0",
3534
"rimraf": "^6.0.1",
36-
"typescript": "^5.7.2"
35+
"typescript": "^5.7.2",
36+
"typescript-eslint": "^8.17.0"
3737
},
3838
"scripts": {
3939
"build": "tsc",

0 commit comments

Comments
 (0)