@biscuittin/eslint-config 0.0.4 → 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/dist/index.cjs +79 -49
- package/dist/index.js +77 -46
- package/package.json +34 -23
- package/typegen.d.ts +1548 -598
package/dist/index.cjs
CHANGED
|
@@ -17,7 +17,6 @@ var pluginNode = require('eslint-plugin-n');
|
|
|
17
17
|
var pluginPerfectionist = require('eslint-plugin-perfectionist');
|
|
18
18
|
var pluginReactCompiler = require('eslint-plugin-react-compiler');
|
|
19
19
|
var pluginReactHooks = require('eslint-plugin-react-hooks');
|
|
20
|
-
var pluginReactPreferFunctionComponent = require('eslint-plugin-react-prefer-function-component');
|
|
21
20
|
var pluginReactRefresh = require('eslint-plugin-react-refresh');
|
|
22
21
|
var pluginRegexp = require('eslint-plugin-regexp');
|
|
23
22
|
var pluginTailwindCSS = require('eslint-plugin-tailwindcss');
|
|
@@ -70,8 +69,7 @@ var pluginJsonc__default = /*#__PURE__*/_interopDefault(pluginJsonc);
|
|
|
70
69
|
var pluginNode__default = /*#__PURE__*/_interopDefault(pluginNode);
|
|
71
70
|
var pluginPerfectionist__default = /*#__PURE__*/_interopDefault(pluginPerfectionist);
|
|
72
71
|
var pluginReactCompiler__namespace = /*#__PURE__*/_interopNamespace(pluginReactCompiler);
|
|
73
|
-
var
|
|
74
|
-
var pluginReactPreferFunctionComponent__default = /*#__PURE__*/_interopDefault(pluginReactPreferFunctionComponent);
|
|
72
|
+
var pluginReactHooks__namespace = /*#__PURE__*/_interopNamespace(pluginReactHooks);
|
|
75
73
|
var pluginReactRefresh__default = /*#__PURE__*/_interopDefault(pluginReactRefresh);
|
|
76
74
|
var pluginRegexp__namespace = /*#__PURE__*/_interopNamespace(pluginRegexp);
|
|
77
75
|
var pluginTailwindCSS__default = /*#__PURE__*/_interopDefault(pluginTailwindCSS);
|
|
@@ -81,7 +79,7 @@ var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
|
81
79
|
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
82
80
|
var process__default = /*#__PURE__*/_interopDefault(process);
|
|
83
81
|
var fsp__default = /*#__PURE__*/_interopDefault(fsp);
|
|
84
|
-
var
|
|
82
|
+
var parserJsonc__namespace = /*#__PURE__*/_interopNamespace(parserJsonc);
|
|
85
83
|
var gitignore__default = /*#__PURE__*/_interopDefault(gitignore);
|
|
86
84
|
var js__default = /*#__PURE__*/_interopDefault(js);
|
|
87
85
|
var globals__default = /*#__PURE__*/_interopDefault(globals);
|
|
@@ -201,12 +199,12 @@ async function loadLocalFile(name, cwd = process__default.default.cwd()) {
|
|
|
201
199
|
function memo(function_, key) {
|
|
202
200
|
var _a;
|
|
203
201
|
let _key = key;
|
|
204
|
-
if (_key ===
|
|
202
|
+
if (_key === void 0 || !_key) {
|
|
205
203
|
if (typeof function_.toString !== "function") throw new TypeError("memo() requires a key!");
|
|
206
204
|
_key = function_.toString();
|
|
207
205
|
}
|
|
208
206
|
globalThis.__ESLINT_PLUGIN_MEMO__ ?? (globalThis.__ESLINT_PLUGIN_MEMO__ = {});
|
|
209
|
-
(_a = globalThis.__ESLINT_PLUGIN_MEMO__)[_key]
|
|
207
|
+
(_a = globalThis.__ESLINT_PLUGIN_MEMO__)[_key] ?? (_a[_key] = function_);
|
|
210
208
|
return globalThis.__ESLINT_PLUGIN_MEMO__[_key];
|
|
211
209
|
}
|
|
212
210
|
|
|
@@ -242,7 +240,7 @@ const plugins = {
|
|
|
242
240
|
reactPlugins["@eslint-react/dom"],
|
|
243
241
|
"eslint-plugin-react-dom"
|
|
244
242
|
),
|
|
245
|
-
pluginReactHooks: memo(
|
|
243
|
+
pluginReactHooks: memo(pluginReactHooks__namespace, "eslint-plugin-react-hooks"),
|
|
246
244
|
pluginReactHooksExtra: memo(
|
|
247
245
|
reactPlugins["@eslint-react/hooks-extra"],
|
|
248
246
|
"eslint-plugin-react-hooks-extra"
|
|
@@ -251,10 +249,6 @@ const plugins = {
|
|
|
251
249
|
reactPlugins["@eslint-react/naming-convention"],
|
|
252
250
|
"eslint-plugin-react-naming-convention"
|
|
253
251
|
),
|
|
254
|
-
pluginReactPreferFunctionComponent: memo(
|
|
255
|
-
pluginReactPreferFunctionComponent__default.default,
|
|
256
|
-
"eslint-plugin-react-prefer-function-component"
|
|
257
|
-
),
|
|
258
252
|
pluginReactRefresh: memo(pluginReactRefresh__default.default, "eslint-plugin-react-refresh"),
|
|
259
253
|
pluginReactWebApi: memo(
|
|
260
254
|
reactPlugins["@eslint-react/web-api"],
|
|
@@ -424,7 +418,7 @@ function disables() {
|
|
|
424
418
|
}
|
|
425
419
|
|
|
426
420
|
const parsers = {
|
|
427
|
-
parserJsonc:
|
|
421
|
+
parserJsonc: parserJsonc__namespace,
|
|
428
422
|
parserPlain: pluginFormat__default.default.parserPlain,
|
|
429
423
|
parserTypescript: typescriptEslint.parser
|
|
430
424
|
};
|
|
@@ -1134,9 +1128,25 @@ function nextJs() {
|
|
|
1134
1128
|
|
|
1135
1129
|
const name$5 = getFlatConfigName("node-js");
|
|
1136
1130
|
const isModule = getPackageJson()?.type === "module";
|
|
1131
|
+
const globalsCommonJs = {
|
|
1132
|
+
...globals__default.default.es2025,
|
|
1133
|
+
...globals__default.default.node,
|
|
1134
|
+
...globals__default.default.commonjs,
|
|
1135
|
+
__dirname: "readonly",
|
|
1136
|
+
__filename: "readonly"
|
|
1137
|
+
};
|
|
1138
|
+
const globalsModule = {
|
|
1139
|
+
...globals__default.default.es2025,
|
|
1140
|
+
...globals__default.default.node,
|
|
1141
|
+
__dirname: "off",
|
|
1142
|
+
__filename: "off",
|
|
1143
|
+
exports: "off",
|
|
1144
|
+
module: "off",
|
|
1145
|
+
require: "off"
|
|
1146
|
+
};
|
|
1137
1147
|
function nodeJs(options = {}) {
|
|
1138
1148
|
const { module = isModule, extraFiles = [] } = options;
|
|
1139
|
-
const files = [GLOB_JS, ...extraFiles];
|
|
1149
|
+
const files = [GLOB_JS, GLOB_TS, ...extraFiles];
|
|
1140
1150
|
return [
|
|
1141
1151
|
{
|
|
1142
1152
|
name: name$5.setup,
|
|
@@ -1145,27 +1155,11 @@ function nodeJs(options = {}) {
|
|
|
1145
1155
|
node: plugins["pluginNode"]
|
|
1146
1156
|
},
|
|
1147
1157
|
languageOptions: {
|
|
1148
|
-
sourceType: module ? "module" : "commonjs",
|
|
1149
1158
|
ecmaVersion: "latest",
|
|
1150
1159
|
parserOptions: {
|
|
1151
1160
|
ecmaFeatures: {
|
|
1152
1161
|
impliedStrict: true
|
|
1153
1162
|
}
|
|
1154
|
-
},
|
|
1155
|
-
globals: {
|
|
1156
|
-
...globals__default.default.es2025,
|
|
1157
|
-
...globals__default.default.node,
|
|
1158
|
-
...module ? {
|
|
1159
|
-
__dirname: "off",
|
|
1160
|
-
__filename: "off",
|
|
1161
|
-
exports: "off",
|
|
1162
|
-
module: "off",
|
|
1163
|
-
require: "off"
|
|
1164
|
-
} : {
|
|
1165
|
-
...globals__default.default.commonjs,
|
|
1166
|
-
__dirname: "readonly",
|
|
1167
|
-
__filename: "readonly"
|
|
1168
|
-
}
|
|
1169
1163
|
}
|
|
1170
1164
|
}
|
|
1171
1165
|
},
|
|
@@ -1177,11 +1171,7 @@ function nodeJs(options = {}) {
|
|
|
1177
1171
|
// pluginNode.configs.commons
|
|
1178
1172
|
// Ref: https://github.com/eslint-community/eslint-plugin-n/blob/ccf5f9e482c32f2fd2d5f78649d7f837a5db8870/lib/configs/_commons.js#L6
|
|
1179
1173
|
"node/no-deprecated-api": "error",
|
|
1180
|
-
"node/no-extraneous-import": "error",
|
|
1181
|
-
"node/no-extraneous-require": "error",
|
|
1182
1174
|
"node/no-exports-assign": "error",
|
|
1183
|
-
"node/no-missing-import": "error",
|
|
1184
|
-
"node/no-missing-require": "error",
|
|
1185
1175
|
"node/no-process-exit": "error",
|
|
1186
1176
|
"node/no-unpublished-bin": "error",
|
|
1187
1177
|
"node/no-unpublished-import": "error",
|
|
@@ -1191,6 +1181,11 @@ function nodeJs(options = {}) {
|
|
|
1191
1181
|
"node/no-unsupported-features/node-builtins": "error",
|
|
1192
1182
|
"node/process-exit-as-throw": "error",
|
|
1193
1183
|
"node/hashbang": "error",
|
|
1184
|
+
// Will handled by `eslint-plugin-import-x`
|
|
1185
|
+
"node/no-extraneous-import": "off",
|
|
1186
|
+
"node/no-extraneous-require": "off",
|
|
1187
|
+
"node/no-missing-import": "off",
|
|
1188
|
+
"node/no-missing-require": "off",
|
|
1194
1189
|
// Require error handling in callbacks
|
|
1195
1190
|
"node/handle-callback-err": ["error", "^error$"],
|
|
1196
1191
|
// Disallow `new` operators with calls to `require`
|
|
@@ -1211,21 +1206,54 @@ function nodeJs(options = {}) {
|
|
|
1211
1206
|
}
|
|
1212
1207
|
}
|
|
1213
1208
|
},
|
|
1209
|
+
{
|
|
1210
|
+
name: name$5.script,
|
|
1211
|
+
files: ["**/*.[jt]s"],
|
|
1212
|
+
languageOptions: {
|
|
1213
|
+
sourceType: module ? "module" : "commonjs",
|
|
1214
|
+
parserOptions: {
|
|
1215
|
+
ecmaFeatures: {
|
|
1216
|
+
globalReturn: !module
|
|
1217
|
+
}
|
|
1218
|
+
},
|
|
1219
|
+
globals: {
|
|
1220
|
+
...module ? globalsModule : globalsCommonJs
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
},
|
|
1214
1224
|
{
|
|
1215
1225
|
name: name$5.commonjs,
|
|
1216
|
-
files: ["
|
|
1226
|
+
files: ["**/*.c[jt]s"],
|
|
1217
1227
|
languageOptions: {
|
|
1218
1228
|
sourceType: "commonjs",
|
|
1229
|
+
parserOptions: {
|
|
1230
|
+
ecmaFeatures: {
|
|
1231
|
+
globalReturn: true
|
|
1232
|
+
}
|
|
1233
|
+
},
|
|
1219
1234
|
globals: {
|
|
1220
|
-
...
|
|
1221
|
-
__dirname: "readonly",
|
|
1222
|
-
__filename: "readonly"
|
|
1235
|
+
...globalsCommonJs
|
|
1223
1236
|
}
|
|
1224
1237
|
},
|
|
1225
1238
|
rules: {
|
|
1226
1239
|
strict: ["error", "global"],
|
|
1227
1240
|
"node/no-unsupported-features/es-syntax": ["error", { ignores: [] }]
|
|
1228
1241
|
}
|
|
1242
|
+
},
|
|
1243
|
+
{
|
|
1244
|
+
name: name$5.module,
|
|
1245
|
+
files: ["**/*.m[jt]s"],
|
|
1246
|
+
languageOptions: {
|
|
1247
|
+
sourceType: "module",
|
|
1248
|
+
parserOptions: {
|
|
1249
|
+
ecmaFeatures: {
|
|
1250
|
+
globalReturn: false
|
|
1251
|
+
}
|
|
1252
|
+
},
|
|
1253
|
+
globals: {
|
|
1254
|
+
...globalsModule
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1229
1257
|
}
|
|
1230
1258
|
];
|
|
1231
1259
|
}
|
|
@@ -1242,7 +1270,6 @@ function react(options = {}) {
|
|
|
1242
1270
|
"react-hooks": plugins["pluginReactHooks"],
|
|
1243
1271
|
"react-compiler": plugins["pluginReactCompiler"],
|
|
1244
1272
|
"react-refresh": plugins["pluginReactRefresh"],
|
|
1245
|
-
"react-prefer-function-component": plugins["pluginReactPreferFunctionComponent"],
|
|
1246
1273
|
"jsx-a11y": plugins["pluginJsxA11y"],
|
|
1247
1274
|
"@stylistic/jsx": plugins["pluginStylisticJsx"],
|
|
1248
1275
|
"@eslint-react": plugins["pluginReact"],
|
|
@@ -1254,12 +1281,17 @@ function react(options = {}) {
|
|
|
1254
1281
|
},
|
|
1255
1282
|
settings: {
|
|
1256
1283
|
"react-x": {
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1284
|
+
importSource: "react",
|
|
1285
|
+
jsxPragma: "createElement",
|
|
1286
|
+
jsxPragmaFrag: "Fragment",
|
|
1260
1287
|
polymorphicPropName: "as",
|
|
1288
|
+
strict: true,
|
|
1261
1289
|
strictImportCheck: true,
|
|
1262
|
-
version: "detect"
|
|
1290
|
+
version: "detect",
|
|
1291
|
+
additionalHooks: {
|
|
1292
|
+
useEffect: ["useIsomorphicLayoutEffect"],
|
|
1293
|
+
useLayoutEffect: ["useIsomorphicLayoutEffect"]
|
|
1294
|
+
}
|
|
1263
1295
|
}
|
|
1264
1296
|
}
|
|
1265
1297
|
},
|
|
@@ -1277,9 +1309,6 @@ function react(options = {}) {
|
|
|
1277
1309
|
// eslint-plugin-react-refresh
|
|
1278
1310
|
// https://github.com/ArnaudBarre/eslint-plugin-react-refresh
|
|
1279
1311
|
"react-refresh/only-export-components": "warn",
|
|
1280
|
-
// eslint-plugin-react-prefer-function-component
|
|
1281
|
-
// https://github.com/tatethurston/eslint-plugin-react-prefer-function-component
|
|
1282
|
-
"react-prefer-function-component/react-prefer-function-component": "error",
|
|
1283
1312
|
// @eslint-sukka/eslint-plugin-react-jsx-a11y
|
|
1284
1313
|
// https://github.com/SukkaW/eslint-config-sukka/tree/master/packages/eslint-plugin-react-jsx-a11y
|
|
1285
1314
|
// Copied from SukkaW/eslint-config-sukka
|
|
@@ -1299,6 +1328,7 @@ function react(options = {}) {
|
|
|
1299
1328
|
...pluginReact__default.default.configs.recommended.rules,
|
|
1300
1329
|
"@eslint-react/ensure-forward-ref-using-ref": "error",
|
|
1301
1330
|
"@eslint-react/no-duplicate-jsx-props": "error",
|
|
1331
|
+
"@eslint-react/no-duplicate-key": "error",
|
|
1302
1332
|
"@eslint-react/no-children-count": "error",
|
|
1303
1333
|
"@eslint-react/no-children-for-each": "error",
|
|
1304
1334
|
"@eslint-react/no-children-only": "error",
|
|
@@ -1532,7 +1562,7 @@ function typescript(options = {}) {
|
|
|
1532
1562
|
// https://github.com/import-js/eslint-import-resolver-typescript
|
|
1533
1563
|
eslintImportResolverTypescript.createTypeScriptImportResolver({
|
|
1534
1564
|
alwaysTryTypes: true,
|
|
1535
|
-
project: tsconfigPath === true ?
|
|
1565
|
+
project: tsconfigPath === true ? void 0 : tsconfigPath,
|
|
1536
1566
|
extensions: [
|
|
1537
1567
|
".ts",
|
|
1538
1568
|
".tsx",
|
|
@@ -1690,13 +1720,13 @@ function unicorn() {
|
|
|
1690
1720
|
|
|
1691
1721
|
function enabled(options, defaults = false) {
|
|
1692
1722
|
if (typeof options === "boolean") return options;
|
|
1693
|
-
if (options ===
|
|
1723
|
+
if (options === void 0) return defaults;
|
|
1694
1724
|
if (options.enable) return true;
|
|
1695
1725
|
return defaults;
|
|
1696
1726
|
}
|
|
1697
1727
|
function configOptions(options, defaultOptions) {
|
|
1698
1728
|
const isInEditor = isInEditorEnv();
|
|
1699
|
-
if (options ===
|
|
1729
|
+
if (options === void 0) return { isInEditor };
|
|
1700
1730
|
if (typeof options === "boolean") return { isInEditor };
|
|
1701
1731
|
return { ...defaultOptions, ...options, isInEditor };
|
|
1702
1732
|
}
|
|
@@ -1737,7 +1767,7 @@ async function config(options, ...userConfigs) {
|
|
|
1737
1767
|
if (enabled(options?.node, localPkg.isPackageExists("@types/node"))) {
|
|
1738
1768
|
configs.push(nodeJs(configOptions(options?.node)));
|
|
1739
1769
|
}
|
|
1740
|
-
if (enabled(
|
|
1770
|
+
if (enabled(void 0, localPkg.isPackageExists("tailwindcss"))) {
|
|
1741
1771
|
configs.push(tailwindcss());
|
|
1742
1772
|
}
|
|
1743
1773
|
configs.push(regexp(), unicorn(), disables());
|
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",
|
|
@@ -1480,7 +1511,7 @@ function typescript(options = {}) {
|
|
|
1480
1511
|
// https://github.com/import-js/eslint-import-resolver-typescript
|
|
1481
1512
|
createTypeScriptImportResolver({
|
|
1482
1513
|
alwaysTryTypes: true,
|
|
1483
|
-
project: tsconfigPath === true ?
|
|
1514
|
+
project: tsconfigPath === true ? void 0 : tsconfigPath,
|
|
1484
1515
|
extensions: [
|
|
1485
1516
|
".ts",
|
|
1486
1517
|
".tsx",
|
|
@@ -1638,13 +1669,13 @@ function unicorn() {
|
|
|
1638
1669
|
|
|
1639
1670
|
function enabled(options, defaults = false) {
|
|
1640
1671
|
if (typeof options === "boolean") return options;
|
|
1641
|
-
if (options ===
|
|
1672
|
+
if (options === void 0) return defaults;
|
|
1642
1673
|
if (options.enable) return true;
|
|
1643
1674
|
return defaults;
|
|
1644
1675
|
}
|
|
1645
1676
|
function configOptions(options, defaultOptions) {
|
|
1646
1677
|
const isInEditor = isInEditorEnv();
|
|
1647
|
-
if (options ===
|
|
1678
|
+
if (options === void 0) return { isInEditor };
|
|
1648
1679
|
if (typeof options === "boolean") return { isInEditor };
|
|
1649
1680
|
return { ...defaultOptions, ...options, isInEditor };
|
|
1650
1681
|
}
|
|
@@ -1685,7 +1716,7 @@ async function config(options, ...userConfigs) {
|
|
|
1685
1716
|
if (enabled(options?.node, isPackageExists("@types/node"))) {
|
|
1686
1717
|
configs.push(nodeJs(configOptions(options?.node)));
|
|
1687
1718
|
}
|
|
1688
|
-
if (enabled(
|
|
1719
|
+
if (enabled(void 0, isPackageExists("tailwindcss"))) {
|
|
1689
1720
|
configs.push(tailwindcss());
|
|
1690
1721
|
}
|
|
1691
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",
|
|
@@ -28,7 +28,10 @@
|
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@typescript-eslint/parser": ">=8.17.0",
|
|
30
30
|
"dprint": ">=0.47.0",
|
|
31
|
-
"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"
|
|
32
35
|
},
|
|
33
36
|
"peerDependenciesMeta": {
|
|
34
37
|
"@typescript-eslint/parser": {
|
|
@@ -39,40 +42,48 @@
|
|
|
39
42
|
},
|
|
40
43
|
"eslint": {
|
|
41
44
|
"optional": true
|
|
45
|
+
},
|
|
46
|
+
"tailwindcss": {
|
|
47
|
+
"optional": true
|
|
48
|
+
},
|
|
49
|
+
"ts-api-utils": {
|
|
50
|
+
"optional": true
|
|
51
|
+
},
|
|
52
|
+
"typescript": {
|
|
53
|
+
"optional": true
|
|
42
54
|
}
|
|
43
55
|
},
|
|
44
56
|
"dependencies": {
|
|
45
57
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
|
46
|
-
"@eslint-react/eslint-plugin": "^1.
|
|
47
|
-
"@eslint-sukka/eslint-plugin-react-jsx-a11y": "^6.
|
|
48
|
-
"@eslint/js": "^9.
|
|
49
|
-
"@eslint/json": "^0.
|
|
50
|
-
"@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",
|
|
51
63
|
"@package-json/types": "^0.0.11",
|
|
52
|
-
"@stylistic/eslint-plugin-jsx": "^
|
|
53
|
-
"eslint-config-flat-gitignore": "^1.0
|
|
54
|
-
"eslint-flat-config-utils": "^2.0.
|
|
55
|
-
"eslint-import-resolver-typescript": "^
|
|
56
|
-
"eslint-plugin-antfu": "^3.
|
|
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",
|
|
57
69
|
"eslint-plugin-autofix": "^2.2.0",
|
|
58
70
|
"eslint-plugin-format": "^1.0.1",
|
|
59
|
-
"eslint-plugin-import-x": "^4.
|
|
71
|
+
"eslint-plugin-import-x": "^4.9.1",
|
|
60
72
|
"eslint-plugin-jsonc": "^2.19.1",
|
|
61
|
-
"eslint-plugin-n": "^17.
|
|
62
|
-
"eslint-plugin-perfectionist": "^4.
|
|
63
|
-
"eslint-plugin-react-compiler": "19.0.0-beta-
|
|
64
|
-
"eslint-plugin-react-hooks": "^5.
|
|
65
|
-
"eslint-plugin-react-
|
|
66
|
-
"eslint-plugin-react-refresh": "^0.4.16",
|
|
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",
|
|
67
78
|
"eslint-plugin-regexp": "^2.7.0",
|
|
68
79
|
"eslint-plugin-tailwindcss": "^3.18.0",
|
|
69
|
-
"eslint-plugin-unicorn": "^
|
|
80
|
+
"eslint-plugin-unicorn": "^57.0.0",
|
|
70
81
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
71
82
|
"find-up": "^7.0.0",
|
|
72
|
-
"globals": "^
|
|
83
|
+
"globals": "^16.0.0",
|
|
73
84
|
"jsonc-eslint-parser": "^2.4.0",
|
|
74
|
-
"local-pkg": "^1.
|
|
75
|
-
"typescript-eslint": "^8.
|
|
85
|
+
"local-pkg": "^1.1.1",
|
|
86
|
+
"typescript-eslint": "^8.27.0"
|
|
76
87
|
},
|
|
77
88
|
"scripts": {
|
|
78
89
|
"build:inspector": "eslint-config-inspector build --config eslint-inspector.config.ts",
|