@will-stone/eslint-config 25.2.0 → 26.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +160 -217
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import
|
|
1
|
+
import b from "typescript-eslint";
|
|
2
2
|
import g from "@typescript-eslint/parser";
|
|
3
|
-
import
|
|
3
|
+
import h from "confusing-browser-globals";
|
|
4
4
|
import c from "globals";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { globbySync as
|
|
5
|
+
import k from "eslint-config-flat-gitignore";
|
|
6
|
+
import q from "eslint-plugin-jsdoc";
|
|
7
|
+
import P from "eslint-plugin-n";
|
|
8
|
+
import O from "eslint-plugin-package-json";
|
|
9
|
+
import _ from "eslint-plugin-perfectionist";
|
|
10
|
+
import D from "@stylistic/eslint-plugin";
|
|
11
|
+
import w from "@typescript-eslint/eslint-plugin";
|
|
12
|
+
import C from "eslint-plugin-unicorn";
|
|
13
|
+
import { globbySync as N } from "globby";
|
|
14
14
|
import { readFileSync as L } from "node:fs";
|
|
15
|
-
import
|
|
16
|
-
const i = "?([cm])[jt]s?(x)", d = `**/*.${i}`,
|
|
15
|
+
import E from "debug";
|
|
16
|
+
const i = "?([cm])[jt]s?(x)", d = `**/*.${i}`, j = "**/*.?([cm])ts", x = "**/*.?([cm])tsx", S = [
|
|
17
17
|
`**/__tests__/**/*.${i}`,
|
|
18
18
|
`**/*.spec.${i}`,
|
|
19
19
|
`**/*.test.${i}`,
|
|
20
20
|
`**/*.bench.${i}`,
|
|
21
21
|
`**/*.benchmark.${i}`
|
|
22
|
-
],
|
|
22
|
+
], T = "**/*.astro", A = "**/*.astro/*.ts", B = "**/*.{jsx,tsx,astro}", I = [
|
|
23
23
|
"**/node_modules",
|
|
24
24
|
"**/dist",
|
|
25
25
|
"**/package-lock.json",
|
|
@@ -49,14 +49,14 @@ async function s(r) {
|
|
|
49
49
|
const e = await r;
|
|
50
50
|
return e.default || e;
|
|
51
51
|
}
|
|
52
|
-
async function
|
|
52
|
+
async function G(r) {
|
|
53
53
|
const [e, o] = await Promise.all([
|
|
54
54
|
s(import("eslint-plugin-astro")),
|
|
55
55
|
s(import("astro-eslint-parser"))
|
|
56
56
|
]);
|
|
57
57
|
return [
|
|
58
58
|
{
|
|
59
|
-
files: [
|
|
59
|
+
files: [T],
|
|
60
60
|
languageOptions: {
|
|
61
61
|
globals: e.environments.astro.globals,
|
|
62
62
|
parser: o,
|
|
@@ -134,7 +134,7 @@ async function B(r) {
|
|
|
134
134
|
}
|
|
135
135
|
];
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function K() {
|
|
138
138
|
return [
|
|
139
139
|
{
|
|
140
140
|
languageOptions: {
|
|
@@ -285,7 +285,7 @@ function G() {
|
|
|
285
285
|
"no-redeclare": "error",
|
|
286
286
|
"no-regex-spaces": "warn",
|
|
287
287
|
"no-restricted-exports": "off",
|
|
288
|
-
"no-restricted-globals": ["error", ...
|
|
288
|
+
"no-restricted-globals": ["error", ...h],
|
|
289
289
|
"no-restricted-imports": "off",
|
|
290
290
|
"no-restricted-properties": "off",
|
|
291
291
|
"no-restricted-syntax": "off",
|
|
@@ -387,14 +387,14 @@ function G() {
|
|
|
387
387
|
}
|
|
388
388
|
];
|
|
389
389
|
}
|
|
390
|
-
function
|
|
390
|
+
function $() {
|
|
391
391
|
return [
|
|
392
392
|
{
|
|
393
393
|
ignores: I,
|
|
394
394
|
name: "will-stone/ignores"
|
|
395
395
|
},
|
|
396
396
|
{
|
|
397
|
-
...
|
|
397
|
+
...k({
|
|
398
398
|
// Prevent throw if gitignore not found.
|
|
399
399
|
strict: !1
|
|
400
400
|
}),
|
|
@@ -402,12 +402,12 @@ function K() {
|
|
|
402
402
|
}
|
|
403
403
|
];
|
|
404
404
|
}
|
|
405
|
-
function
|
|
405
|
+
function R() {
|
|
406
406
|
return [
|
|
407
407
|
{
|
|
408
|
-
files: [
|
|
408
|
+
files: [j, x],
|
|
409
409
|
name: "will-stone/jsdoc",
|
|
410
|
-
plugins: { jsdoc:
|
|
410
|
+
plugins: { jsdoc: q },
|
|
411
411
|
rules: {
|
|
412
412
|
"jsdoc/check-access": "off",
|
|
413
413
|
"jsdoc/check-alignment": "warn",
|
|
@@ -496,7 +496,7 @@ function U() {
|
|
|
496
496
|
{
|
|
497
497
|
languageOptions: { globals: c.node },
|
|
498
498
|
name: "will-stone/node",
|
|
499
|
-
plugins: { n:
|
|
499
|
+
plugins: { n: P },
|
|
500
500
|
rules: {
|
|
501
501
|
"n/callback-return": "error",
|
|
502
502
|
"n/global-require": "error",
|
|
@@ -549,7 +549,7 @@ function U() {
|
|
|
549
549
|
function F() {
|
|
550
550
|
return [
|
|
551
551
|
{
|
|
552
|
-
...
|
|
552
|
+
...O.configs.recommended,
|
|
553
553
|
name: "will-stone/package.json",
|
|
554
554
|
rules: {
|
|
555
555
|
"package-json/bin-name-casing": "error",
|
|
@@ -644,12 +644,12 @@ const y = [
|
|
|
644
644
|
type: "natural"
|
|
645
645
|
}
|
|
646
646
|
];
|
|
647
|
-
function
|
|
647
|
+
function J() {
|
|
648
648
|
return [
|
|
649
649
|
{
|
|
650
650
|
name: "will-stone/perfectionist",
|
|
651
651
|
plugins: {
|
|
652
|
-
perfectionist:
|
|
652
|
+
perfectionist: _
|
|
653
653
|
},
|
|
654
654
|
rules: {
|
|
655
655
|
"perfectionist/sort-array-includes": "off",
|
|
@@ -678,7 +678,7 @@ function R() {
|
|
|
678
678
|
}
|
|
679
679
|
];
|
|
680
680
|
}
|
|
681
|
-
async function
|
|
681
|
+
async function z(r) {
|
|
682
682
|
const [e, o, t] = await Promise.all([
|
|
683
683
|
// @ts-expect-error -- no types
|
|
684
684
|
s(import("eslint-plugin-jsx-a11y")),
|
|
@@ -698,6 +698,7 @@ async function J(r) {
|
|
|
698
698
|
},
|
|
699
699
|
name: "will-stone/react",
|
|
700
700
|
plugins: {
|
|
701
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
701
702
|
"jsx-a11y": e,
|
|
702
703
|
react: o,
|
|
703
704
|
"react-hooks": t
|
|
@@ -952,12 +953,12 @@ async function J(r) {
|
|
|
952
953
|
}
|
|
953
954
|
];
|
|
954
955
|
}
|
|
955
|
-
function
|
|
956
|
+
function M() {
|
|
956
957
|
return [
|
|
957
958
|
{
|
|
958
959
|
name: "will-stone/style",
|
|
959
960
|
plugins: {
|
|
960
|
-
"@stylistic":
|
|
961
|
+
"@stylistic": D
|
|
961
962
|
},
|
|
962
963
|
rules: {
|
|
963
964
|
"@stylistic/array-bracket-newline": "off",
|
|
@@ -1062,16 +1063,13 @@ function z() {
|
|
|
1062
1063
|
}
|
|
1063
1064
|
];
|
|
1064
1065
|
}
|
|
1065
|
-
async function
|
|
1066
|
+
async function V({
|
|
1066
1067
|
options: { tailwind: r }
|
|
1067
1068
|
}) {
|
|
1068
|
-
const e =
|
|
1069
|
-
// @ts-expect-error -- no types
|
|
1070
|
-
import("eslint-plugin-tailwindcss")
|
|
1071
|
-
);
|
|
1069
|
+
const e = r === !1 || r === !0 ? {} : r, o = await s(import("eslint-plugin-tailwindcss"));
|
|
1072
1070
|
return [
|
|
1073
1071
|
{
|
|
1074
|
-
files: [
|
|
1072
|
+
files: [B],
|
|
1075
1073
|
name: "will-stone/tailwind",
|
|
1076
1074
|
plugins: { tailwindcss: o },
|
|
1077
1075
|
rules: {
|
|
@@ -1086,7 +1084,7 @@ async function M({
|
|
|
1086
1084
|
},
|
|
1087
1085
|
settings: {
|
|
1088
1086
|
tailwindcss: {
|
|
1089
|
-
config: e
|
|
1087
|
+
config: e?.config,
|
|
1090
1088
|
/**
|
|
1091
1089
|
* Default to no custom CSS files, due to performance issue with the
|
|
1092
1090
|
* plugin can be somewhat mitigated by setting this config to `[]` so
|
|
@@ -1094,16 +1092,21 @@ async function M({
|
|
|
1094
1092
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/issues/276
|
|
1095
1093
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/issues/174
|
|
1096
1094
|
*/
|
|
1097
|
-
cssFiles: e
|
|
1095
|
+
cssFiles: e?.cssFiles || []
|
|
1098
1096
|
}
|
|
1099
1097
|
}
|
|
1100
1098
|
}
|
|
1101
1099
|
];
|
|
1102
1100
|
}
|
|
1103
|
-
|
|
1101
|
+
const v = {};
|
|
1102
|
+
for (const r of w.configs["flat/all"])
|
|
1103
|
+
for (const [e, o] of Object.entries(r.rules || {}))
|
|
1104
|
+
!e.startsWith("@typescript") && // Deprecated rules.
|
|
1105
|
+
!["no-new-symbol", "no-return-await"].includes(e) && (v[e] = o);
|
|
1106
|
+
function X() {
|
|
1104
1107
|
return [
|
|
1105
1108
|
{
|
|
1106
|
-
files: [
|
|
1109
|
+
files: [A, j, x],
|
|
1107
1110
|
languageOptions: {
|
|
1108
1111
|
parser: g,
|
|
1109
1112
|
parserOptions: {
|
|
@@ -1112,159 +1115,17 @@ function V() {
|
|
|
1112
1115
|
},
|
|
1113
1116
|
name: "will-stone/typescript",
|
|
1114
1117
|
plugins: {
|
|
1115
|
-
"@typescript-eslint":
|
|
1118
|
+
"@typescript-eslint": w
|
|
1116
1119
|
},
|
|
1117
1120
|
rules: {
|
|
1118
|
-
|
|
1119
|
-
* Recommended to turn off these eslint built-in rules.
|
|
1120
|
-
* @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/src/configs/eslint-recommended.ts
|
|
1121
|
-
*/
|
|
1122
|
-
// ts(2335) & ts(2377)
|
|
1123
|
-
"constructor-super": "off",
|
|
1124
|
-
// ts(2378)
|
|
1125
|
-
"getter-return": "off",
|
|
1126
|
-
// ts(2588)
|
|
1127
|
-
"no-const-assign": "off",
|
|
1128
|
-
// ts(2300)
|
|
1129
|
-
"no-dupe-args": "off",
|
|
1130
|
-
// ts(2393) & ts(2300)
|
|
1131
|
-
"no-dupe-class-members": "off",
|
|
1132
|
-
// ts(1117)
|
|
1133
|
-
"no-dupe-keys": "off",
|
|
1134
|
-
// ts(2539)
|
|
1135
|
-
"no-func-assign": "off",
|
|
1136
|
-
// ts(2539) & ts(2540)
|
|
1137
|
-
"no-import-assign": "off",
|
|
1138
|
-
// ts(2349)
|
|
1139
|
-
"no-obj-calls": "off",
|
|
1140
|
-
// ts(2408)
|
|
1141
|
-
"no-setter-return": "off",
|
|
1142
|
-
// ts(2376)
|
|
1143
|
-
"no-this-before-super": "off",
|
|
1144
|
-
// ts(2304)
|
|
1145
|
-
"no-undef": "off",
|
|
1146
|
-
// ts(7027)
|
|
1147
|
-
"no-unreachable": "off",
|
|
1148
|
-
// ts(2365) & ts(2360) & ts(2358)
|
|
1149
|
-
"no-unsafe-negation": "off",
|
|
1150
|
-
// ts transpiles let/const to var, so no need for vars any more
|
|
1151
|
-
"no-var": "error",
|
|
1152
|
-
// ts provides better types with const
|
|
1153
|
-
"prefer-const": "warn",
|
|
1154
|
-
// ts provides better types with rest args over arguments
|
|
1155
|
-
"prefer-rest-params": "error",
|
|
1156
|
-
// ts transpiles spread to apply, so no need for manual apply
|
|
1157
|
-
"prefer-spread": "error",
|
|
1158
|
-
// ts(2367)
|
|
1159
|
-
"valid-typeof": "off",
|
|
1121
|
+
...v,
|
|
1160
1122
|
/**
|
|
1161
1123
|
* TS Recommended.
|
|
1162
1124
|
* @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/src/configs/recommended.ts
|
|
1163
1125
|
*/
|
|
1164
1126
|
"@typescript-eslint/adjacent-overload-signatures": "error",
|
|
1165
|
-
"@typescript-eslint/ban-ts-comment": "error",
|
|
1166
|
-
"@typescript-eslint/explicit-module-boundary-types": "warn",
|
|
1167
|
-
"@typescript-eslint/no-array-constructor": "error",
|
|
1168
|
-
"@typescript-eslint/no-empty-function": "error",
|
|
1169
|
-
"@typescript-eslint/no-empty-object-type": "error",
|
|
1170
|
-
"@typescript-eslint/no-explicit-any": "warn",
|
|
1171
|
-
"@typescript-eslint/no-inferrable-types": "error",
|
|
1172
|
-
"@typescript-eslint/no-misused-new": "error",
|
|
1173
|
-
"@typescript-eslint/no-namespace": "error",
|
|
1174
|
-
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
|
1175
|
-
"@typescript-eslint/no-non-null-assertion": "off",
|
|
1176
|
-
"@typescript-eslint/no-this-alias": "error",
|
|
1177
|
-
"@typescript-eslint/no-unsafe-function-type": "warn",
|
|
1178
|
-
"@typescript-eslint/no-wrapper-object-types": "error",
|
|
1179
|
-
"@typescript-eslint/prefer-as-const": "error",
|
|
1180
|
-
"@typescript-eslint/prefer-namespace-keyword": "error",
|
|
1181
|
-
"@typescript-eslint/triple-slash-reference": "error",
|
|
1182
|
-
"no-array-constructor": "off",
|
|
1183
|
-
"no-empty-function": "off",
|
|
1184
|
-
/**
|
|
1185
|
-
* These require type checking.
|
|
1186
|
-
*/
|
|
1187
|
-
"@typescript-eslint/await-thenable": "off",
|
|
1188
|
-
"@typescript-eslint/consistent-return": "off",
|
|
1189
|
-
"@typescript-eslint/consistent-type-exports": "warn",
|
|
1190
|
-
"@typescript-eslint/dot-notation": "off",
|
|
1191
|
-
"@typescript-eslint/naming-convention": "off",
|
|
1192
|
-
"@typescript-eslint/no-array-delete": "off",
|
|
1193
|
-
"@typescript-eslint/no-base-to-string": "off",
|
|
1194
|
-
"@typescript-eslint/no-confusing-void-expression": "off",
|
|
1195
|
-
"@typescript-eslint/no-deprecated": "off",
|
|
1196
|
-
"@typescript-eslint/no-duplicate-type-constituents": "off",
|
|
1197
|
-
"@typescript-eslint/no-floating-promises": "off",
|
|
1198
|
-
"@typescript-eslint/no-for-in-array": "off",
|
|
1199
|
-
"@typescript-eslint/no-implied-eval": "off",
|
|
1200
|
-
"@typescript-eslint/no-meaningless-void-operator": "warn",
|
|
1201
|
-
"@typescript-eslint/no-misused-promises": "off",
|
|
1202
|
-
"@typescript-eslint/no-misused-spread": "off",
|
|
1203
|
-
"@typescript-eslint/no-mixed-enums": "off",
|
|
1204
|
-
"@typescript-eslint/no-redundant-type-constituents": "off",
|
|
1205
|
-
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "off",
|
|
1206
|
-
"@typescript-eslint/no-unnecessary-condition": "off",
|
|
1207
|
-
"@typescript-eslint/no-unnecessary-qualifier": "off",
|
|
1208
|
-
"@typescript-eslint/no-unnecessary-template-expression": "error",
|
|
1209
|
-
"@typescript-eslint/no-unnecessary-type-arguments": "off",
|
|
1210
|
-
"@typescript-eslint/no-unnecessary-type-assertion": "off",
|
|
1211
|
-
"@typescript-eslint/no-unnecessary-type-conversion": "off",
|
|
1212
|
-
"@typescript-eslint/no-unnecessary-type-parameters": "error",
|
|
1213
|
-
"@typescript-eslint/no-unsafe-argument": "off",
|
|
1214
|
-
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
1215
|
-
"@typescript-eslint/no-unsafe-call": "off",
|
|
1216
|
-
"@typescript-eslint/no-unsafe-enum-comparison": "off",
|
|
1217
|
-
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
1218
|
-
"@typescript-eslint/no-unsafe-return": "off",
|
|
1219
|
-
"@typescript-eslint/no-unsafe-type-assertion": "off",
|
|
1220
|
-
"@typescript-eslint/no-unsafe-unary-minus": "off",
|
|
1221
|
-
"@typescript-eslint/no-useless-default-assignment": "off",
|
|
1222
|
-
"@typescript-eslint/non-nullable-type-assertion-style": "off",
|
|
1223
|
-
"@typescript-eslint/only-throw-error": "off",
|
|
1224
|
-
"@typescript-eslint/prefer-destructuring": "off",
|
|
1225
|
-
"@typescript-eslint/prefer-find": "off",
|
|
1226
|
-
"@typescript-eslint/prefer-includes": "off",
|
|
1227
|
-
"@typescript-eslint/prefer-nullish-coalescing": "off",
|
|
1228
|
-
"@typescript-eslint/prefer-optional-chain": "off",
|
|
1229
|
-
"@typescript-eslint/prefer-promise-reject-errors": "off",
|
|
1230
|
-
"@typescript-eslint/prefer-readonly": "off",
|
|
1231
|
-
"@typescript-eslint/prefer-readonly-parameter-types": "off",
|
|
1232
|
-
"@typescript-eslint/prefer-reduce-type-parameter": "off",
|
|
1233
|
-
"@typescript-eslint/prefer-regexp-exec": "off",
|
|
1234
|
-
"@typescript-eslint/prefer-return-this-type": "off",
|
|
1235
|
-
"@typescript-eslint/prefer-string-starts-ends-with": "off",
|
|
1236
|
-
"@typescript-eslint/promise-function-async": "off",
|
|
1237
|
-
"@typescript-eslint/related-getter-setter-pairs": "off",
|
|
1238
|
-
"@typescript-eslint/require-array-sort-compare": "off",
|
|
1239
|
-
"@typescript-eslint/require-await": "off",
|
|
1240
|
-
"@typescript-eslint/restrict-plus-operands": "off",
|
|
1241
|
-
"@typescript-eslint/restrict-template-expressions": "off",
|
|
1242
|
-
"@typescript-eslint/return-await": "off",
|
|
1243
|
-
"@typescript-eslint/strict-boolean-expressions": "off",
|
|
1244
|
-
"@typescript-eslint/strict-void-return": "off",
|
|
1245
|
-
"@typescript-eslint/switch-exhaustiveness-check": "off",
|
|
1246
|
-
"@typescript-eslint/unbound-method": "off",
|
|
1247
|
-
"@typescript-eslint/use-unknown-in-catch-callback-variable": "off",
|
|
1248
|
-
/**
|
|
1249
|
-
* Superseded by TS rules below.
|
|
1250
|
-
*/
|
|
1251
|
-
"class-methods-use-this": "off",
|
|
1252
|
-
"default-param-last": "off",
|
|
1253
|
-
"no-duplicate-imports": "off",
|
|
1254
|
-
"no-invalid-this": "off",
|
|
1255
|
-
"no-loop-func": "off",
|
|
1256
|
-
"no-redeclare": "off",
|
|
1257
|
-
"no-restricted-imports": "off",
|
|
1258
|
-
"no-shadow": "off",
|
|
1259
|
-
"no-unused-expressions": "off",
|
|
1260
|
-
"no-unused-private-class-members": "off",
|
|
1261
|
-
"no-unused-vars": "off",
|
|
1262
|
-
"no-use-before-define": "off",
|
|
1263
|
-
"no-useless-constructor": "off",
|
|
1264
|
-
/**
|
|
1265
|
-
* The rest.
|
|
1266
|
-
*/
|
|
1267
1127
|
"@typescript-eslint/array-type": ["warn", { default: "array" }],
|
|
1128
|
+
"@typescript-eslint/ban-ts-comment": "error",
|
|
1268
1129
|
"@typescript-eslint/ban-tslint-comment": "warn",
|
|
1269
1130
|
"@typescript-eslint/class-literal-property-style": "warn",
|
|
1270
1131
|
"@typescript-eslint/class-methods-use-this": "off",
|
|
@@ -1285,30 +1146,42 @@ function V() {
|
|
|
1285
1146
|
"warn",
|
|
1286
1147
|
{ accessibility: "no-public" }
|
|
1287
1148
|
],
|
|
1149
|
+
"@typescript-eslint/explicit-module-boundary-types": "warn",
|
|
1288
1150
|
"@typescript-eslint/init-declarations": "off",
|
|
1289
1151
|
"@typescript-eslint/max-params": "off",
|
|
1290
1152
|
"@typescript-eslint/member-ordering": "error",
|
|
1291
1153
|
"@typescript-eslint/method-signature-style": "warn",
|
|
1154
|
+
"@typescript-eslint/no-array-constructor": "error",
|
|
1292
1155
|
"@typescript-eslint/no-confusing-non-null-assertion": "warn",
|
|
1293
1156
|
"@typescript-eslint/no-dupe-class-members": "error",
|
|
1294
1157
|
"@typescript-eslint/no-duplicate-enum-values": "error",
|
|
1295
1158
|
"@typescript-eslint/no-dynamic-delete": "off",
|
|
1159
|
+
"@typescript-eslint/no-empty-function": "error",
|
|
1160
|
+
"@typescript-eslint/no-empty-object-type": "error",
|
|
1161
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
1296
1162
|
"@typescript-eslint/no-extra-non-null-assertion": "warn",
|
|
1297
1163
|
"@typescript-eslint/no-extraneous-class": "error",
|
|
1298
1164
|
"@typescript-eslint/no-import-type-side-effects": "warn",
|
|
1165
|
+
"@typescript-eslint/no-inferrable-types": "error",
|
|
1299
1166
|
"@typescript-eslint/no-invalid-this": "error",
|
|
1300
1167
|
"@typescript-eslint/no-invalid-void-type": "error",
|
|
1301
1168
|
"@typescript-eslint/no-loop-func": "error",
|
|
1302
1169
|
"@typescript-eslint/no-magic-numbers": "off",
|
|
1170
|
+
"@typescript-eslint/no-misused-new": "error",
|
|
1171
|
+
"@typescript-eslint/no-namespace": "error",
|
|
1303
1172
|
"@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
|
|
1173
|
+
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
|
1174
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
1304
1175
|
"@typescript-eslint/no-redeclare": "error",
|
|
1305
1176
|
"@typescript-eslint/no-require-imports": "error",
|
|
1306
1177
|
"@typescript-eslint/no-restricted-imports": "off",
|
|
1307
1178
|
"@typescript-eslint/no-restricted-types": "off",
|
|
1308
1179
|
"@typescript-eslint/no-shadow": ["error"],
|
|
1180
|
+
"@typescript-eslint/no-this-alias": "error",
|
|
1309
1181
|
"@typescript-eslint/no-unnecessary-parameter-property-assignment": "error",
|
|
1310
1182
|
"@typescript-eslint/no-unnecessary-type-constraint": "warn",
|
|
1311
1183
|
"@typescript-eslint/no-unsafe-declaration-merging": "error",
|
|
1184
|
+
"@typescript-eslint/no-unsafe-function-type": "warn",
|
|
1312
1185
|
"@typescript-eslint/no-unused-expressions": ["error"],
|
|
1313
1186
|
"@typescript-eslint/no-unused-private-class-members": "error",
|
|
1314
1187
|
"@typescript-eslint/no-unused-vars": [
|
|
@@ -1323,22 +1196,92 @@ function V() {
|
|
|
1323
1196
|
"@typescript-eslint/no-use-before-define": "error",
|
|
1324
1197
|
"@typescript-eslint/no-useless-constructor": "error",
|
|
1325
1198
|
"@typescript-eslint/no-useless-empty-export": "warn",
|
|
1199
|
+
"@typescript-eslint/no-wrapper-object-types": "error",
|
|
1326
1200
|
"@typescript-eslint/parameter-properties": "off",
|
|
1201
|
+
"@typescript-eslint/prefer-as-const": "error",
|
|
1327
1202
|
"@typescript-eslint/prefer-enum-initializers": "error",
|
|
1328
1203
|
// Unicorn does this better by providing a fixer
|
|
1329
1204
|
"@typescript-eslint/prefer-for-of": "off",
|
|
1330
1205
|
"@typescript-eslint/prefer-function-type": "warn",
|
|
1331
1206
|
"@typescript-eslint/prefer-literal-enum-member": "error",
|
|
1332
|
-
"@typescript-eslint/
|
|
1207
|
+
"@typescript-eslint/prefer-namespace-keyword": "error",
|
|
1208
|
+
"@typescript-eslint/triple-slash-reference": "error",
|
|
1209
|
+
"@typescript-eslint/unified-signatures": "error",
|
|
1210
|
+
/**
|
|
1211
|
+
* These require type checking.
|
|
1212
|
+
*/
|
|
1213
|
+
"@typescript-eslint/await-thenable": "error",
|
|
1214
|
+
"@typescript-eslint/consistent-return": "off",
|
|
1215
|
+
"@typescript-eslint/consistent-type-exports": "warn",
|
|
1216
|
+
"@typescript-eslint/dot-notation": "warn",
|
|
1217
|
+
"@typescript-eslint/naming-convention": "off",
|
|
1218
|
+
"@typescript-eslint/no-array-delete": "error",
|
|
1219
|
+
"@typescript-eslint/no-base-to-string": "error",
|
|
1220
|
+
"@typescript-eslint/no-confusing-void-expression": "warn",
|
|
1221
|
+
"@typescript-eslint/no-deprecated": "off",
|
|
1222
|
+
"@typescript-eslint/no-duplicate-type-constituents": "warn",
|
|
1223
|
+
"@typescript-eslint/no-floating-promises": "error",
|
|
1224
|
+
"@typescript-eslint/no-for-in-array": "error",
|
|
1225
|
+
"@typescript-eslint/no-implied-eval": "error",
|
|
1226
|
+
"@typescript-eslint/no-meaningless-void-operator": "warn",
|
|
1227
|
+
"@typescript-eslint/no-misused-promises": "off",
|
|
1228
|
+
"@typescript-eslint/no-misused-spread": "error",
|
|
1229
|
+
"@typescript-eslint/no-mixed-enums": "error",
|
|
1230
|
+
"@typescript-eslint/no-redundant-type-constituents": "error",
|
|
1231
|
+
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "warn",
|
|
1232
|
+
"@typescript-eslint/no-unnecessary-condition": "error",
|
|
1233
|
+
"@typescript-eslint/no-unnecessary-qualifier": "warn",
|
|
1234
|
+
"@typescript-eslint/no-unnecessary-template-expression": "error",
|
|
1235
|
+
"@typescript-eslint/no-unnecessary-type-arguments": "warn",
|
|
1236
|
+
"@typescript-eslint/no-unnecessary-type-assertion": "warn",
|
|
1237
|
+
"@typescript-eslint/no-unnecessary-type-conversion": "error",
|
|
1238
|
+
"@typescript-eslint/no-unnecessary-type-parameters": "error",
|
|
1239
|
+
"@typescript-eslint/no-unsafe-argument": "error",
|
|
1240
|
+
"@typescript-eslint/no-unsafe-assignment": "error",
|
|
1241
|
+
"@typescript-eslint/no-unsafe-call": "error",
|
|
1242
|
+
"@typescript-eslint/no-unsafe-enum-comparison": "error",
|
|
1243
|
+
"@typescript-eslint/no-unsafe-member-access": "error",
|
|
1244
|
+
"@typescript-eslint/no-unsafe-return": "error",
|
|
1245
|
+
// All assertions are unsafe and this makes it more difficult to cast.
|
|
1246
|
+
"@typescript-eslint/no-unsafe-type-assertion": "off",
|
|
1247
|
+
"@typescript-eslint/no-unsafe-unary-minus": "error",
|
|
1248
|
+
"@typescript-eslint/no-useless-default-assignment": "warn",
|
|
1249
|
+
"@typescript-eslint/non-nullable-type-assertion-style": "warn",
|
|
1250
|
+
"@typescript-eslint/only-throw-error": "error",
|
|
1251
|
+
"@typescript-eslint/prefer-destructuring": ["warn", { array: !1, object: !0 }],
|
|
1252
|
+
"@typescript-eslint/prefer-find": "error",
|
|
1253
|
+
"@typescript-eslint/prefer-includes": "warn",
|
|
1254
|
+
"@typescript-eslint/prefer-nullish-coalescing": "off",
|
|
1255
|
+
"@typescript-eslint/prefer-optional-chain": "warn",
|
|
1256
|
+
"@typescript-eslint/prefer-promise-reject-errors": "error",
|
|
1257
|
+
"@typescript-eslint/prefer-readonly": "warn",
|
|
1258
|
+
// Typing all args as readonly is tiresome.
|
|
1259
|
+
"@typescript-eslint/prefer-readonly-parameter-types": "off",
|
|
1260
|
+
"@typescript-eslint/prefer-reduce-type-parameter": "warn",
|
|
1261
|
+
"@typescript-eslint/prefer-regexp-exec": "off",
|
|
1262
|
+
"@typescript-eslint/prefer-return-this-type": "warn",
|
|
1263
|
+
"@typescript-eslint/prefer-string-starts-ends-with": "warn",
|
|
1264
|
+
"@typescript-eslint/promise-function-async": "warn",
|
|
1265
|
+
"@typescript-eslint/related-getter-setter-pairs": "error",
|
|
1266
|
+
"@typescript-eslint/require-array-sort-compare": "error",
|
|
1267
|
+
"@typescript-eslint/require-await": "error",
|
|
1268
|
+
"@typescript-eslint/restrict-plus-operands": "error",
|
|
1269
|
+
"@typescript-eslint/restrict-template-expressions": "error",
|
|
1270
|
+
"@typescript-eslint/return-await": "warn",
|
|
1271
|
+
"@typescript-eslint/strict-boolean-expressions": "error",
|
|
1272
|
+
"@typescript-eslint/strict-void-return": "error",
|
|
1273
|
+
"@typescript-eslint/switch-exhaustiveness-check": "error",
|
|
1274
|
+
"@typescript-eslint/unbound-method": "error",
|
|
1275
|
+
"@typescript-eslint/use-unknown-in-catch-callback-variable": "error"
|
|
1333
1276
|
}
|
|
1334
1277
|
}
|
|
1335
1278
|
];
|
|
1336
1279
|
}
|
|
1337
|
-
function
|
|
1280
|
+
function H() {
|
|
1338
1281
|
return [
|
|
1339
1282
|
{
|
|
1340
1283
|
name: "will-stone/unicorn",
|
|
1341
|
-
plugins: { unicorn:
|
|
1284
|
+
plugins: { unicorn: C },
|
|
1342
1285
|
rules: {
|
|
1343
1286
|
// This rule is superseded by the unicorn version below
|
|
1344
1287
|
"no-nested-ternary": "off",
|
|
@@ -1509,11 +1452,11 @@ function X() {
|
|
|
1509
1452
|
}
|
|
1510
1453
|
];
|
|
1511
1454
|
}
|
|
1512
|
-
async function
|
|
1455
|
+
async function W(r) {
|
|
1513
1456
|
const e = await s(import("@vitest/eslint-plugin"));
|
|
1514
1457
|
return [
|
|
1515
1458
|
{
|
|
1516
|
-
files:
|
|
1459
|
+
files: S,
|
|
1517
1460
|
name: "will-stone/vitest",
|
|
1518
1461
|
plugins: { vitest: e },
|
|
1519
1462
|
rules: {
|
|
@@ -1611,73 +1554,73 @@ async function H(r) {
|
|
|
1611
1554
|
}
|
|
1612
1555
|
];
|
|
1613
1556
|
}
|
|
1614
|
-
const
|
|
1615
|
-
{ config:
|
|
1616
|
-
{ config:
|
|
1617
|
-
{ config:
|
|
1557
|
+
const Q = [
|
|
1558
|
+
{ config: $, name: "Ignores" },
|
|
1559
|
+
{ config: K, name: "Base" },
|
|
1560
|
+
{ config: H, name: "Unicorn" },
|
|
1618
1561
|
{ config: U, name: "Node" },
|
|
1619
1562
|
{ config: F, name: "package.json" },
|
|
1620
|
-
{ config:
|
|
1621
|
-
{ config:
|
|
1622
|
-
{ config:
|
|
1623
|
-
{ config:
|
|
1563
|
+
{ config: R, name: "JSDoc" },
|
|
1564
|
+
{ config: M, name: "Style" },
|
|
1565
|
+
{ config: J, name: "Perfectionist" },
|
|
1566
|
+
{ config: X, name: "Typescript" }
|
|
1624
1567
|
], m = [
|
|
1625
1568
|
{
|
|
1626
|
-
config:
|
|
1569
|
+
config: G,
|
|
1627
1570
|
dep: "astro",
|
|
1628
1571
|
name: "Astro.js",
|
|
1629
1572
|
optionName: "astro"
|
|
1630
1573
|
},
|
|
1631
1574
|
{
|
|
1632
|
-
config:
|
|
1575
|
+
config: z,
|
|
1633
1576
|
dep: "react",
|
|
1634
1577
|
name: "React",
|
|
1635
1578
|
optionName: "react"
|
|
1636
1579
|
},
|
|
1637
1580
|
{
|
|
1638
|
-
config:
|
|
1581
|
+
config: V,
|
|
1639
1582
|
dep: "tailwindcss",
|
|
1640
1583
|
name: "Tailwind",
|
|
1641
1584
|
optionName: "tailwind"
|
|
1642
1585
|
},
|
|
1643
1586
|
{
|
|
1644
|
-
config:
|
|
1587
|
+
config: W,
|
|
1645
1588
|
dep: "vitest",
|
|
1646
1589
|
name: "Vitest",
|
|
1647
1590
|
optionName: "vitest"
|
|
1648
1591
|
}
|
|
1649
1592
|
];
|
|
1650
|
-
function
|
|
1651
|
-
const e =
|
|
1593
|
+
function Y(r) {
|
|
1594
|
+
const e = N(["**/package.json", "!**/node_modules/**"]), o = {}, t = () => Object.values(o).every(Boolean);
|
|
1652
1595
|
for (const a of r)
|
|
1653
1596
|
o[a] = !1;
|
|
1654
1597
|
for (const a of e) {
|
|
1655
|
-
const
|
|
1598
|
+
const p = L(a), l = new TextDecoder().decode(p), f = JSON.parse(l);
|
|
1656
1599
|
for (const n of r)
|
|
1657
|
-
if (
|
|
1600
|
+
if ((typeof f.dependencies?.[n] == "string" || typeof f.devDependencies?.[n] == "string") && (o[n] = !0, t()))
|
|
1658
1601
|
break;
|
|
1659
1602
|
if (t())
|
|
1660
1603
|
break;
|
|
1661
1604
|
}
|
|
1662
1605
|
return o;
|
|
1663
1606
|
}
|
|
1664
|
-
const
|
|
1665
|
-
async function
|
|
1666
|
-
const e = [], o = Object.values(m).map(({ dep: n }) => n), t =
|
|
1607
|
+
const Z = E("eslint:ws"), ee = {};
|
|
1608
|
+
async function re(r = ee) {
|
|
1609
|
+
const e = [], o = Object.values(m).map(({ dep: n }) => n), t = Y(o), a = m.filter(({ dep: n, optionName: u }) => (
|
|
1667
1610
|
// Is forced on.
|
|
1668
|
-
r
|
|
1669
|
-
t[n] && r
|
|
1670
|
-
)),
|
|
1611
|
+
!!r[u] || // Is present and not forced off.
|
|
1612
|
+
t[n] && r[u] !== !1
|
|
1613
|
+
)), p = {
|
|
1671
1614
|
options: r
|
|
1672
1615
|
};
|
|
1673
|
-
for (const n of
|
|
1674
|
-
e.push(n.config(
|
|
1616
|
+
for (const n of Q)
|
|
1617
|
+
e.push(n.config(p));
|
|
1675
1618
|
const l = await Promise.all(
|
|
1676
|
-
a.map((n) => (
|
|
1619
|
+
a.map(async (n) => (Z(`Auto-configured ${n.name} plugin`), n.config(p)))
|
|
1677
1620
|
);
|
|
1678
1621
|
return e.push(...l), e.flat();
|
|
1679
1622
|
}
|
|
1680
|
-
const
|
|
1623
|
+
const we = async (r, ...e) => b.config(await re(r), ...e);
|
|
1681
1624
|
export {
|
|
1682
|
-
|
|
1625
|
+
we as default
|
|
1683
1626
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@will-stone/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "26.0.0",
|
|
4
4
|
"description": "Will Stone's ESLint config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint-config"
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"@commits-with-character/conventional-changelog-preset": "^5.1.1",
|
|
56
56
|
"@eslint/config-inspector": "^1.4.2",
|
|
57
57
|
"@release-it/conventional-changelog": "^10.0.5",
|
|
58
|
+
"@types/eslint-plugin-tailwindcss": "^3.17.0",
|
|
58
59
|
"@types/node": "^24.10.13",
|
|
59
60
|
"@typescript-eslint/utils": "^8.55.0",
|
|
60
61
|
"@vitest/eslint-plugin": "^1.6.7",
|
|
@@ -106,7 +107,7 @@
|
|
|
106
107
|
"optional": true
|
|
107
108
|
}
|
|
108
109
|
},
|
|
109
|
-
"packageManager": "pnpm@10.
|
|
110
|
+
"packageManager": "pnpm@10.30.3",
|
|
110
111
|
"engines": {
|
|
111
112
|
"node": ">=22"
|
|
112
113
|
},
|