@biscuittin/eslint-config 0.0.2 → 0.0.5
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/.jiek-production-tag +0 -0
- package/dist/index.cjs +82 -50
- package/dist/index.d.cts +3 -11489
- package/dist/index.d.ts +3 -11489
- package/dist/index.js +80 -47
- package/package.json +39 -25
- package/typegen.d.ts +12567 -0
package/dist/index.js
CHANGED
|
@@ -12,8 +12,7 @@ import pluginJsonc from 'eslint-plugin-jsonc';
|
|
|
12
12
|
import pluginNode from 'eslint-plugin-n';
|
|
13
13
|
import pluginPerfectionist from 'eslint-plugin-perfectionist';
|
|
14
14
|
import * as pluginReactCompiler from 'eslint-plugin-react-compiler';
|
|
15
|
-
import pluginReactHooks from 'eslint-plugin-react-hooks';
|
|
16
|
-
import pluginReactPreferFunctionComponent from 'eslint-plugin-react-prefer-function-component';
|
|
15
|
+
import * as pluginReactHooks from 'eslint-plugin-react-hooks';
|
|
17
16
|
import pluginReactRefresh from 'eslint-plugin-react-refresh';
|
|
18
17
|
import * as pluginRegexp from 'eslint-plugin-regexp';
|
|
19
18
|
import pluginTailwindCSS from 'eslint-plugin-tailwindcss';
|
|
@@ -25,7 +24,7 @@ import path from 'node:path';
|
|
|
25
24
|
import process from 'node:process';
|
|
26
25
|
import { findUp } from 'find-up';
|
|
27
26
|
import fsp from 'node:fs/promises';
|
|
28
|
-
import parserJsonc from 'jsonc-eslint-parser';
|
|
27
|
+
import * as parserJsonc from 'jsonc-eslint-parser';
|
|
29
28
|
import gitignore from 'eslint-config-flat-gitignore';
|
|
30
29
|
import js from '@eslint/js';
|
|
31
30
|
import globals from 'globals';
|
|
@@ -149,12 +148,12 @@ async function loadLocalFile(name, cwd = process.cwd()) {
|
|
|
149
148
|
function memo(function_, key) {
|
|
150
149
|
var _a;
|
|
151
150
|
let _key = key;
|
|
152
|
-
if (_key ===
|
|
151
|
+
if (_key === void 0 || !_key) {
|
|
153
152
|
if (typeof function_.toString !== "function") throw new TypeError("memo() requires a key!");
|
|
154
153
|
_key = function_.toString();
|
|
155
154
|
}
|
|
156
155
|
globalThis.__ESLINT_PLUGIN_MEMO__ ?? (globalThis.__ESLINT_PLUGIN_MEMO__ = {});
|
|
157
|
-
(_a = globalThis.__ESLINT_PLUGIN_MEMO__)[_key]
|
|
156
|
+
(_a = globalThis.__ESLINT_PLUGIN_MEMO__)[_key] ?? (_a[_key] = function_);
|
|
158
157
|
return globalThis.__ESLINT_PLUGIN_MEMO__[_key];
|
|
159
158
|
}
|
|
160
159
|
|
|
@@ -199,10 +198,6 @@ const plugins = {
|
|
|
199
198
|
reactPlugins["@eslint-react/naming-convention"],
|
|
200
199
|
"eslint-plugin-react-naming-convention"
|
|
201
200
|
),
|
|
202
|
-
pluginReactPreferFunctionComponent: memo(
|
|
203
|
-
pluginReactPreferFunctionComponent,
|
|
204
|
-
"eslint-plugin-react-prefer-function-component"
|
|
205
|
-
),
|
|
206
201
|
pluginReactRefresh: memo(pluginReactRefresh, "eslint-plugin-react-refresh"),
|
|
207
202
|
pluginReactWebApi: memo(
|
|
208
203
|
reactPlugins["@eslint-react/web-api"],
|
|
@@ -1082,9 +1077,25 @@ function nextJs() {
|
|
|
1082
1077
|
|
|
1083
1078
|
const name$5 = getFlatConfigName("node-js");
|
|
1084
1079
|
const isModule = getPackageJson()?.type === "module";
|
|
1080
|
+
const globalsCommonJs = {
|
|
1081
|
+
...globals.es2025,
|
|
1082
|
+
...globals.node,
|
|
1083
|
+
...globals.commonjs,
|
|
1084
|
+
__dirname: "readonly",
|
|
1085
|
+
__filename: "readonly"
|
|
1086
|
+
};
|
|
1087
|
+
const globalsModule = {
|
|
1088
|
+
...globals.es2025,
|
|
1089
|
+
...globals.node,
|
|
1090
|
+
__dirname: "off",
|
|
1091
|
+
__filename: "off",
|
|
1092
|
+
exports: "off",
|
|
1093
|
+
module: "off",
|
|
1094
|
+
require: "off"
|
|
1095
|
+
};
|
|
1085
1096
|
function nodeJs(options = {}) {
|
|
1086
1097
|
const { module = isModule, extraFiles = [] } = options;
|
|
1087
|
-
const files = [GLOB_JS, ...extraFiles];
|
|
1098
|
+
const files = [GLOB_JS, GLOB_TS, ...extraFiles];
|
|
1088
1099
|
return [
|
|
1089
1100
|
{
|
|
1090
1101
|
name: name$5.setup,
|
|
@@ -1093,27 +1104,11 @@ function nodeJs(options = {}) {
|
|
|
1093
1104
|
node: plugins["pluginNode"]
|
|
1094
1105
|
},
|
|
1095
1106
|
languageOptions: {
|
|
1096
|
-
sourceType: module ? "module" : "commonjs",
|
|
1097
1107
|
ecmaVersion: "latest",
|
|
1098
1108
|
parserOptions: {
|
|
1099
1109
|
ecmaFeatures: {
|
|
1100
1110
|
impliedStrict: true
|
|
1101
1111
|
}
|
|
1102
|
-
},
|
|
1103
|
-
globals: {
|
|
1104
|
-
...globals.es2025,
|
|
1105
|
-
...globals.node,
|
|
1106
|
-
...module ? {
|
|
1107
|
-
__dirname: "off",
|
|
1108
|
-
__filename: "off",
|
|
1109
|
-
exports: "off",
|
|
1110
|
-
module: "off",
|
|
1111
|
-
require: "off"
|
|
1112
|
-
} : {
|
|
1113
|
-
...globals.commonjs,
|
|
1114
|
-
__dirname: "readonly",
|
|
1115
|
-
__filename: "readonly"
|
|
1116
|
-
}
|
|
1117
1112
|
}
|
|
1118
1113
|
}
|
|
1119
1114
|
},
|
|
@@ -1125,11 +1120,7 @@ function nodeJs(options = {}) {
|
|
|
1125
1120
|
// pluginNode.configs.commons
|
|
1126
1121
|
// Ref: https://github.com/eslint-community/eslint-plugin-n/blob/ccf5f9e482c32f2fd2d5f78649d7f837a5db8870/lib/configs/_commons.js#L6
|
|
1127
1122
|
"node/no-deprecated-api": "error",
|
|
1128
|
-
"node/no-extraneous-import": "error",
|
|
1129
|
-
"node/no-extraneous-require": "error",
|
|
1130
1123
|
"node/no-exports-assign": "error",
|
|
1131
|
-
"node/no-missing-import": "error",
|
|
1132
|
-
"node/no-missing-require": "error",
|
|
1133
1124
|
"node/no-process-exit": "error",
|
|
1134
1125
|
"node/no-unpublished-bin": "error",
|
|
1135
1126
|
"node/no-unpublished-import": "error",
|
|
@@ -1139,6 +1130,11 @@ function nodeJs(options = {}) {
|
|
|
1139
1130
|
"node/no-unsupported-features/node-builtins": "error",
|
|
1140
1131
|
"node/process-exit-as-throw": "error",
|
|
1141
1132
|
"node/hashbang": "error",
|
|
1133
|
+
// Will handled by `eslint-plugin-import-x`
|
|
1134
|
+
"node/no-extraneous-import": "off",
|
|
1135
|
+
"node/no-extraneous-require": "off",
|
|
1136
|
+
"node/no-missing-import": "off",
|
|
1137
|
+
"node/no-missing-require": "off",
|
|
1142
1138
|
// Require error handling in callbacks
|
|
1143
1139
|
"node/handle-callback-err": ["error", "^error$"],
|
|
1144
1140
|
// Disallow `new` operators with calls to `require`
|
|
@@ -1159,21 +1155,54 @@ function nodeJs(options = {}) {
|
|
|
1159
1155
|
}
|
|
1160
1156
|
}
|
|
1161
1157
|
},
|
|
1158
|
+
{
|
|
1159
|
+
name: name$5.script,
|
|
1160
|
+
files: ["**/*.[jt]s"],
|
|
1161
|
+
languageOptions: {
|
|
1162
|
+
sourceType: module ? "module" : "commonjs",
|
|
1163
|
+
parserOptions: {
|
|
1164
|
+
ecmaFeatures: {
|
|
1165
|
+
globalReturn: !module
|
|
1166
|
+
}
|
|
1167
|
+
},
|
|
1168
|
+
globals: {
|
|
1169
|
+
...module ? globalsModule : globalsCommonJs
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
},
|
|
1162
1173
|
{
|
|
1163
1174
|
name: name$5.commonjs,
|
|
1164
|
-
files: ["
|
|
1175
|
+
files: ["**/*.c[jt]s"],
|
|
1165
1176
|
languageOptions: {
|
|
1166
1177
|
sourceType: "commonjs",
|
|
1178
|
+
parserOptions: {
|
|
1179
|
+
ecmaFeatures: {
|
|
1180
|
+
globalReturn: true
|
|
1181
|
+
}
|
|
1182
|
+
},
|
|
1167
1183
|
globals: {
|
|
1168
|
-
...
|
|
1169
|
-
__dirname: "readonly",
|
|
1170
|
-
__filename: "readonly"
|
|
1184
|
+
...globalsCommonJs
|
|
1171
1185
|
}
|
|
1172
1186
|
},
|
|
1173
1187
|
rules: {
|
|
1174
1188
|
strict: ["error", "global"],
|
|
1175
1189
|
"node/no-unsupported-features/es-syntax": ["error", { ignores: [] }]
|
|
1176
1190
|
}
|
|
1191
|
+
},
|
|
1192
|
+
{
|
|
1193
|
+
name: name$5.module,
|
|
1194
|
+
files: ["**/*.m[jt]s"],
|
|
1195
|
+
languageOptions: {
|
|
1196
|
+
sourceType: "module",
|
|
1197
|
+
parserOptions: {
|
|
1198
|
+
ecmaFeatures: {
|
|
1199
|
+
globalReturn: false
|
|
1200
|
+
}
|
|
1201
|
+
},
|
|
1202
|
+
globals: {
|
|
1203
|
+
...globalsModule
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1177
1206
|
}
|
|
1178
1207
|
];
|
|
1179
1208
|
}
|
|
@@ -1190,7 +1219,6 @@ function react(options = {}) {
|
|
|
1190
1219
|
"react-hooks": plugins["pluginReactHooks"],
|
|
1191
1220
|
"react-compiler": plugins["pluginReactCompiler"],
|
|
1192
1221
|
"react-refresh": plugins["pluginReactRefresh"],
|
|
1193
|
-
"react-prefer-function-component": plugins["pluginReactPreferFunctionComponent"],
|
|
1194
1222
|
"jsx-a11y": plugins["pluginJsxA11y"],
|
|
1195
1223
|
"@stylistic/jsx": plugins["pluginStylisticJsx"],
|
|
1196
1224
|
"@eslint-react": plugins["pluginReact"],
|
|
@@ -1202,12 +1230,17 @@ function react(options = {}) {
|
|
|
1202
1230
|
},
|
|
1203
1231
|
settings: {
|
|
1204
1232
|
"react-x": {
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1233
|
+
importSource: "react",
|
|
1234
|
+
jsxPragma: "createElement",
|
|
1235
|
+
jsxPragmaFrag: "Fragment",
|
|
1208
1236
|
polymorphicPropName: "as",
|
|
1237
|
+
strict: true,
|
|
1209
1238
|
strictImportCheck: true,
|
|
1210
|
-
version: "detect"
|
|
1239
|
+
version: "detect",
|
|
1240
|
+
additionalHooks: {
|
|
1241
|
+
useEffect: ["useIsomorphicLayoutEffect"],
|
|
1242
|
+
useLayoutEffect: ["useIsomorphicLayoutEffect"]
|
|
1243
|
+
}
|
|
1211
1244
|
}
|
|
1212
1245
|
}
|
|
1213
1246
|
},
|
|
@@ -1225,9 +1258,6 @@ function react(options = {}) {
|
|
|
1225
1258
|
// eslint-plugin-react-refresh
|
|
1226
1259
|
// https://github.com/ArnaudBarre/eslint-plugin-react-refresh
|
|
1227
1260
|
"react-refresh/only-export-components": "warn",
|
|
1228
|
-
// eslint-plugin-react-prefer-function-component
|
|
1229
|
-
// https://github.com/tatethurston/eslint-plugin-react-prefer-function-component
|
|
1230
|
-
"react-prefer-function-component/react-prefer-function-component": "error",
|
|
1231
1261
|
// @eslint-sukka/eslint-plugin-react-jsx-a11y
|
|
1232
1262
|
// https://github.com/SukkaW/eslint-config-sukka/tree/master/packages/eslint-plugin-react-jsx-a11y
|
|
1233
1263
|
// Copied from SukkaW/eslint-config-sukka
|
|
@@ -1247,6 +1277,7 @@ function react(options = {}) {
|
|
|
1247
1277
|
...pluginReact.configs.recommended.rules,
|
|
1248
1278
|
"@eslint-react/ensure-forward-ref-using-ref": "error",
|
|
1249
1279
|
"@eslint-react/no-duplicate-jsx-props": "error",
|
|
1280
|
+
"@eslint-react/no-duplicate-key": "error",
|
|
1250
1281
|
"@eslint-react/no-children-count": "error",
|
|
1251
1282
|
"@eslint-react/no-children-for-each": "error",
|
|
1252
1283
|
"@eslint-react/no-children-only": "error",
|
|
@@ -1256,15 +1287,17 @@ function react(options = {}) {
|
|
|
1256
1287
|
"@eslint-react/no-implicit-key": "error",
|
|
1257
1288
|
"@eslint-react/no-missing-component-display-name": "error",
|
|
1258
1289
|
"@eslint-react/no-unstable-context-value": "error",
|
|
1259
|
-
"@eslint-react/dom/no-void-elements-with-children": "error",
|
|
1260
1290
|
// Update as of 2021: All current versions of major browsers now automatically use the
|
|
1261
1291
|
// behavior of rel="noopener" for any target="_blank" link, nullifying this issue.
|
|
1262
1292
|
// See: https://chromestatus.com/feature/6140064063029248.
|
|
1263
1293
|
// See: https://stackoverflow.com/a/50709724
|
|
1264
1294
|
"@eslint-react/dom/no-unsafe-target-blank": "off",
|
|
1295
|
+
"@eslint-react/dom/no-void-elements-with-children": "error",
|
|
1296
|
+
"@eslint-react/web-api/no-leaked-event-listener": "error",
|
|
1265
1297
|
"@eslint-react/web-api/no-leaked-interval": "error",
|
|
1266
1298
|
"@eslint-react/web-api/no-leaked-resize-observer": "error",
|
|
1267
1299
|
"@eslint-react/web-api/no-leaked-timeout": "error",
|
|
1300
|
+
"@eslint-react/hooks-extra/no-unnecessary-use-callback": "error",
|
|
1268
1301
|
"@eslint-react/hooks-extra/no-unnecessary-use-memo": "error",
|
|
1269
1302
|
"@eslint-react/hooks-extra/no-useless-custom-hooks": "error",
|
|
1270
1303
|
"@eslint-react/hooks-extra/no-direct-set-state-in-use-effect": "error",
|
|
@@ -1478,7 +1511,7 @@ function typescript(options = {}) {
|
|
|
1478
1511
|
// https://github.com/import-js/eslint-import-resolver-typescript
|
|
1479
1512
|
createTypeScriptImportResolver({
|
|
1480
1513
|
alwaysTryTypes: true,
|
|
1481
|
-
project: tsconfigPath === true ?
|
|
1514
|
+
project: tsconfigPath === true ? void 0 : tsconfigPath,
|
|
1482
1515
|
extensions: [
|
|
1483
1516
|
".ts",
|
|
1484
1517
|
".tsx",
|
|
@@ -1636,13 +1669,13 @@ function unicorn() {
|
|
|
1636
1669
|
|
|
1637
1670
|
function enabled(options, defaults = false) {
|
|
1638
1671
|
if (typeof options === "boolean") return options;
|
|
1639
|
-
if (options ===
|
|
1672
|
+
if (options === void 0) return defaults;
|
|
1640
1673
|
if (options.enable) return true;
|
|
1641
1674
|
return defaults;
|
|
1642
1675
|
}
|
|
1643
1676
|
function configOptions(options, defaultOptions) {
|
|
1644
1677
|
const isInEditor = isInEditorEnv();
|
|
1645
|
-
if (options ===
|
|
1678
|
+
if (options === void 0) return { isInEditor };
|
|
1646
1679
|
if (typeof options === "boolean") return { isInEditor };
|
|
1647
1680
|
return { ...defaultOptions, ...options, isInEditor };
|
|
1648
1681
|
}
|
|
@@ -1683,7 +1716,7 @@ async function config(options, ...userConfigs) {
|
|
|
1683
1716
|
if (enabled(options?.node, isPackageExists("@types/node"))) {
|
|
1684
1717
|
configs.push(nodeJs(configOptions(options?.node)));
|
|
1685
1718
|
}
|
|
1686
|
-
if (enabled(
|
|
1719
|
+
if (enabled(void 0, isPackageExists("tailwindcss"))) {
|
|
1687
1720
|
configs.push(tailwindcss());
|
|
1688
1721
|
}
|
|
1689
1722
|
configs.push(regexp(), unicorn(), disables());
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@biscuittin/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.5",
|
|
5
5
|
"description": "A collection of ESLint configurations for Biscuit Tin projects.",
|
|
6
6
|
"author": "Biscuit Tin <opensource@biscuitt.in>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -19,13 +19,19 @@
|
|
|
19
19
|
"default": "./dist/index.js"
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
|
+
"imports": {
|
|
23
|
+
"#typegen": "./typegen.d.ts"
|
|
24
|
+
},
|
|
22
25
|
"publishConfig": {
|
|
23
26
|
"provenance": true
|
|
24
27
|
},
|
|
25
28
|
"peerDependencies": {
|
|
26
29
|
"@typescript-eslint/parser": ">=8.17.0",
|
|
27
30
|
"dprint": ">=0.47.0",
|
|
28
|
-
"eslint": ">=9.15.0"
|
|
31
|
+
"eslint": ">=9.15.0",
|
|
32
|
+
"tailwindcss": ">=3.4.0 <4",
|
|
33
|
+
"ts-api-utils": "^2.0.1",
|
|
34
|
+
"typescript": "^5.7.3"
|
|
29
35
|
},
|
|
30
36
|
"peerDependenciesMeta": {
|
|
31
37
|
"@typescript-eslint/parser": {
|
|
@@ -36,40 +42,48 @@
|
|
|
36
42
|
},
|
|
37
43
|
"eslint": {
|
|
38
44
|
"optional": true
|
|
45
|
+
},
|
|
46
|
+
"tailwindcss": {
|
|
47
|
+
"optional": true
|
|
48
|
+
},
|
|
49
|
+
"ts-api-utils": {
|
|
50
|
+
"optional": true
|
|
51
|
+
},
|
|
52
|
+
"typescript": {
|
|
53
|
+
"optional": true
|
|
39
54
|
}
|
|
40
55
|
},
|
|
41
56
|
"dependencies": {
|
|
42
57
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
|
43
|
-
"@eslint-react/eslint-plugin": "^1.
|
|
44
|
-
"@eslint-sukka/eslint-plugin-react-jsx-a11y": "^6.
|
|
45
|
-
"@eslint/js": "^9.
|
|
46
|
-
"@eslint/json": "^0.
|
|
47
|
-
"@next/eslint-plugin-next": "^15.
|
|
58
|
+
"@eslint-react/eslint-plugin": "^1.37.3",
|
|
59
|
+
"@eslint-sukka/eslint-plugin-react-jsx-a11y": "^6.17.1",
|
|
60
|
+
"@eslint/js": "^9.23.0",
|
|
61
|
+
"@eslint/json": "^0.11.0",
|
|
62
|
+
"@next/eslint-plugin-next": "^15.2.3",
|
|
48
63
|
"@package-json/types": "^0.0.11",
|
|
49
|
-
"@stylistic/eslint-plugin-jsx": "^2.
|
|
50
|
-
"eslint-config-flat-gitignore": "^1.0
|
|
51
|
-
"eslint-flat-config-utils": "^
|
|
52
|
-
"eslint-import-resolver-typescript": "^
|
|
53
|
-
"eslint-plugin-antfu": "^
|
|
64
|
+
"@stylistic/eslint-plugin-jsx": "^4.2.0",
|
|
65
|
+
"eslint-config-flat-gitignore": "^2.1.0",
|
|
66
|
+
"eslint-flat-config-utils": "^2.0.1",
|
|
67
|
+
"eslint-import-resolver-typescript": "^4.2.2",
|
|
68
|
+
"eslint-plugin-antfu": "^3.1.1",
|
|
54
69
|
"eslint-plugin-autofix": "^2.2.0",
|
|
55
70
|
"eslint-plugin-format": "^1.0.1",
|
|
56
|
-
"eslint-plugin-import-x": "^4.
|
|
57
|
-
"eslint-plugin-jsonc": "^2.
|
|
58
|
-
"eslint-plugin-n": "^17.
|
|
59
|
-
"eslint-plugin-perfectionist": "^4.
|
|
60
|
-
"eslint-plugin-react-compiler": "19.0.0-beta-
|
|
61
|
-
"eslint-plugin-react-hooks": "^5.
|
|
62
|
-
"eslint-plugin-react-
|
|
63
|
-
"eslint-plugin-react-refresh": "^0.4.16",
|
|
71
|
+
"eslint-plugin-import-x": "^4.9.1",
|
|
72
|
+
"eslint-plugin-jsonc": "^2.19.1",
|
|
73
|
+
"eslint-plugin-n": "^17.16.2",
|
|
74
|
+
"eslint-plugin-perfectionist": "^4.10.1",
|
|
75
|
+
"eslint-plugin-react-compiler": "19.0.0-beta-714736e-20250131",
|
|
76
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
77
|
+
"eslint-plugin-react-refresh": "^0.4.19",
|
|
64
78
|
"eslint-plugin-regexp": "^2.7.0",
|
|
65
|
-
"eslint-plugin-tailwindcss": "^3.
|
|
66
|
-
"eslint-plugin-unicorn": "^
|
|
79
|
+
"eslint-plugin-tailwindcss": "^3.18.0",
|
|
80
|
+
"eslint-plugin-unicorn": "^57.0.0",
|
|
67
81
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
68
82
|
"find-up": "^7.0.0",
|
|
69
|
-
"globals": "^
|
|
83
|
+
"globals": "^16.0.0",
|
|
70
84
|
"jsonc-eslint-parser": "^2.4.0",
|
|
71
|
-
"local-pkg": "^1.
|
|
72
|
-
"typescript-eslint": "^8.
|
|
85
|
+
"local-pkg": "^1.1.1",
|
|
86
|
+
"typescript-eslint": "^8.27.0"
|
|
73
87
|
},
|
|
74
88
|
"scripts": {
|
|
75
89
|
"build:inspector": "eslint-config-inspector build --config eslint-inspector.config.ts",
|