@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
|
File without changes
|
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",
|
|
@@ -1308,15 +1338,17 @@ function react(options = {}) {
|
|
|
1308
1338
|
"@eslint-react/no-implicit-key": "error",
|
|
1309
1339
|
"@eslint-react/no-missing-component-display-name": "error",
|
|
1310
1340
|
"@eslint-react/no-unstable-context-value": "error",
|
|
1311
|
-
"@eslint-react/dom/no-void-elements-with-children": "error",
|
|
1312
1341
|
// Update as of 2021: All current versions of major browsers now automatically use the
|
|
1313
1342
|
// behavior of rel="noopener" for any target="_blank" link, nullifying this issue.
|
|
1314
1343
|
// See: https://chromestatus.com/feature/6140064063029248.
|
|
1315
1344
|
// See: https://stackoverflow.com/a/50709724
|
|
1316
1345
|
"@eslint-react/dom/no-unsafe-target-blank": "off",
|
|
1346
|
+
"@eslint-react/dom/no-void-elements-with-children": "error",
|
|
1347
|
+
"@eslint-react/web-api/no-leaked-event-listener": "error",
|
|
1317
1348
|
"@eslint-react/web-api/no-leaked-interval": "error",
|
|
1318
1349
|
"@eslint-react/web-api/no-leaked-resize-observer": "error",
|
|
1319
1350
|
"@eslint-react/web-api/no-leaked-timeout": "error",
|
|
1351
|
+
"@eslint-react/hooks-extra/no-unnecessary-use-callback": "error",
|
|
1320
1352
|
"@eslint-react/hooks-extra/no-unnecessary-use-memo": "error",
|
|
1321
1353
|
"@eslint-react/hooks-extra/no-useless-custom-hooks": "error",
|
|
1322
1354
|
"@eslint-react/hooks-extra/no-direct-set-state-in-use-effect": "error",
|
|
@@ -1530,7 +1562,7 @@ function typescript(options = {}) {
|
|
|
1530
1562
|
// https://github.com/import-js/eslint-import-resolver-typescript
|
|
1531
1563
|
eslintImportResolverTypescript.createTypeScriptImportResolver({
|
|
1532
1564
|
alwaysTryTypes: true,
|
|
1533
|
-
project: tsconfigPath === true ?
|
|
1565
|
+
project: tsconfigPath === true ? void 0 : tsconfigPath,
|
|
1534
1566
|
extensions: [
|
|
1535
1567
|
".ts",
|
|
1536
1568
|
".tsx",
|
|
@@ -1688,13 +1720,13 @@ function unicorn() {
|
|
|
1688
1720
|
|
|
1689
1721
|
function enabled(options, defaults = false) {
|
|
1690
1722
|
if (typeof options === "boolean") return options;
|
|
1691
|
-
if (options ===
|
|
1723
|
+
if (options === void 0) return defaults;
|
|
1692
1724
|
if (options.enable) return true;
|
|
1693
1725
|
return defaults;
|
|
1694
1726
|
}
|
|
1695
1727
|
function configOptions(options, defaultOptions) {
|
|
1696
1728
|
const isInEditor = isInEditorEnv();
|
|
1697
|
-
if (options ===
|
|
1729
|
+
if (options === void 0) return { isInEditor };
|
|
1698
1730
|
if (typeof options === "boolean") return { isInEditor };
|
|
1699
1731
|
return { ...defaultOptions, ...options, isInEditor };
|
|
1700
1732
|
}
|
|
@@ -1735,7 +1767,7 @@ async function config(options, ...userConfigs) {
|
|
|
1735
1767
|
if (enabled(options?.node, localPkg.isPackageExists("@types/node"))) {
|
|
1736
1768
|
configs.push(nodeJs(configOptions(options?.node)));
|
|
1737
1769
|
}
|
|
1738
|
-
if (enabled(
|
|
1770
|
+
if (enabled(void 0, localPkg.isPackageExists("tailwindcss"))) {
|
|
1739
1771
|
configs.push(tailwindcss());
|
|
1740
1772
|
}
|
|
1741
1773
|
configs.push(regexp(), unicorn(), disables());
|