@jsse/eslint-config 0.7.9 → 0.8.1
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/CHANGELOG.md +13 -0
- package/dist/cli.js +1 -1
- package/dist/{const-DcPxulJ0.js → const-1mb8msxs.js} +1 -1
- package/dist/index.d.ts +6676 -6026
- package/dist/index.js +151 -252
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +21 -19
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __exportAll, r as __toESM, t as __commonJSMin } from "./rolldown-runtime-DJK8HYOj.js";
|
|
2
|
-
import { n as SLOW_RULES, r as VERSION, t as DEBUG } from "./const-
|
|
2
|
+
import { n as SLOW_RULES, r as VERSION, t as DEBUG } from "./const-1mb8msxs.js";
|
|
3
3
|
import { builtinModules, createRequire } from "node:module";
|
|
4
4
|
import process$1 from "node:process";
|
|
5
5
|
import fs, { realpathSync, statSync } from "node:fs";
|
|
@@ -19,6 +19,7 @@ import pluginImportLite from "eslint-plugin-import-lite";
|
|
|
19
19
|
import pluginN from "eslint-plugin-n";
|
|
20
20
|
import pluginPerfectionist from "eslint-plugin-perfectionist";
|
|
21
21
|
import pluginPnpm from "eslint-plugin-pnpm";
|
|
22
|
+
import pluginRegexp, { configs } from "eslint-plugin-regexp";
|
|
22
23
|
import pluginUnicorn from "eslint-plugin-unicorn";
|
|
23
24
|
import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
24
25
|
import createCommand from "eslint-plugin-command/config";
|
|
@@ -5183,7 +5184,7 @@ function normalizeSlash(path) {
|
|
|
5183
5184
|
*/
|
|
5184
5185
|
const own$1 = {}.hasOwnProperty;
|
|
5185
5186
|
const classRegExp = /^([A-Z][a-z\d]*)+$/;
|
|
5186
|
-
const kTypes = new Set([
|
|
5187
|
+
const kTypes = /* @__PURE__ */ new Set([
|
|
5187
5188
|
"string",
|
|
5188
5189
|
"function",
|
|
5189
5190
|
"number",
|
|
@@ -6751,7 +6752,10 @@ function turnOffRules(configs, off) {
|
|
|
6751
6752
|
if (off.length > 0) {
|
|
6752
6753
|
for (const rule of off) dbg(`turning-off: ${rule}`);
|
|
6753
6754
|
const currentlyActiveRules = /* @__PURE__ */ new Set();
|
|
6754
|
-
for (const config of configs)
|
|
6755
|
+
for (const config of configs) {
|
|
6756
|
+
const cfgRules = Object.keys(config.rules ?? {});
|
|
6757
|
+
for (const rule of cfgRules) currentlyActiveRules.add(rule);
|
|
6758
|
+
}
|
|
6755
6759
|
for (const rule of off) if (!currentlyActiveRules.has(rule)) dbg(`Rule \`${rule}\` is not active in the current config, you can remove it from the off list`);
|
|
6756
6760
|
for (const config of configs) {
|
|
6757
6761
|
const cfgRules = config.rules;
|
|
@@ -6785,6 +6789,14 @@ function warn2error(configs) {
|
|
|
6785
6789
|
}));
|
|
6786
6790
|
return configs;
|
|
6787
6791
|
}
|
|
6792
|
+
const TYPESCRIPT_ESLINT_PREFIX = "@typescript-eslint/";
|
|
6793
|
+
function replaceTypescriptEslintPrefix(items, tsPrefix) {
|
|
6794
|
+
for (const [key, value] of Object.entries(items)) {
|
|
6795
|
+
if (!key.startsWith(TYPESCRIPT_ESLINT_PREFIX)) continue;
|
|
6796
|
+
delete items[key];
|
|
6797
|
+
items[`${tsPrefix}/${key.slice(19)}`] = value;
|
|
6798
|
+
}
|
|
6799
|
+
}
|
|
6788
6800
|
//#endregion
|
|
6789
6801
|
//#region src/plugins.ts
|
|
6790
6802
|
async function importPluginReact() {
|
|
@@ -6848,6 +6860,101 @@ const eslintComments = async () => [{
|
|
|
6848
6860
|
}
|
|
6849
6861
|
}];
|
|
6850
6862
|
//#endregion
|
|
6863
|
+
//#region src/configs/react-hooks.ts
|
|
6864
|
+
const reactHooks = async () => {
|
|
6865
|
+
const pluginReactHooks = await interopDefault(import("eslint-plugin-react-hooks"));
|
|
6866
|
+
return [{
|
|
6867
|
+
files: [GLOB_SRC],
|
|
6868
|
+
name: "jsse/react-hooks/rules",
|
|
6869
|
+
plugins: { "react-hooks": pluginReactHooks },
|
|
6870
|
+
rules: {
|
|
6871
|
+
"react-hooks/exhaustive-deps": "error",
|
|
6872
|
+
"react-hooks/rules-of-hooks": "error",
|
|
6873
|
+
...pluginReactHooks.configs.recommended.rules
|
|
6874
|
+
},
|
|
6875
|
+
settings: { react: { version: "detect" } }
|
|
6876
|
+
}];
|
|
6877
|
+
};
|
|
6878
|
+
//#endregion
|
|
6879
|
+
//#region src/configs/ts/typescript-language-options.ts
|
|
6880
|
+
function typescriptLanguageOptions(options) {
|
|
6881
|
+
const { componentExts = [], react, tsconfig } = options || {};
|
|
6882
|
+
const tsOptions = tsconfig ? {
|
|
6883
|
+
project: Array.isArray(tsconfig) ? tsconfig : [tsconfig],
|
|
6884
|
+
tsconfigRootDir: process$1.cwd()
|
|
6885
|
+
} : {};
|
|
6886
|
+
return {
|
|
6887
|
+
parser: parserTs,
|
|
6888
|
+
parserOptions: {
|
|
6889
|
+
ecmaFeatures: react ? {
|
|
6890
|
+
jsx: true,
|
|
6891
|
+
modules: true
|
|
6892
|
+
} : void 0,
|
|
6893
|
+
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
6894
|
+
sourceType: "module",
|
|
6895
|
+
...tsOptions,
|
|
6896
|
+
jsxPragma: react ? "React" : void 0
|
|
6897
|
+
}
|
|
6898
|
+
};
|
|
6899
|
+
}
|
|
6900
|
+
//#endregion
|
|
6901
|
+
//#region src/configs/eslint-react.ts
|
|
6902
|
+
async function importReactPlugins() {
|
|
6903
|
+
const [pluginReact, pluginReactRefresh] = await Promise.all([interopDefault(import("@eslint-react/eslint-plugin")), interopDefault(import("eslint-plugin-react-refresh"))]);
|
|
6904
|
+
return {
|
|
6905
|
+
pluginReact,
|
|
6906
|
+
pluginReactRefresh
|
|
6907
|
+
};
|
|
6908
|
+
}
|
|
6909
|
+
const eslintReact = async (options) => {
|
|
6910
|
+
const { componentExts, parserOptions = {}, react, reactRefresh, tsconfig } = options ?? {};
|
|
6911
|
+
const { pluginReact, pluginReactRefresh } = await importReactPlugins();
|
|
6912
|
+
const coreReactPlugins = pluginReact.configs.all.plugins;
|
|
6913
|
+
const reactHooksConfig = await reactHooks();
|
|
6914
|
+
const config = [
|
|
6915
|
+
{
|
|
6916
|
+
files: [GLOB_SRC],
|
|
6917
|
+
languageOptions: typescriptLanguageOptions({
|
|
6918
|
+
componentExts,
|
|
6919
|
+
parserOptions,
|
|
6920
|
+
react,
|
|
6921
|
+
tsconfig
|
|
6922
|
+
}),
|
|
6923
|
+
name: "jsse/react/setup",
|
|
6924
|
+
plugins: {
|
|
6925
|
+
"@eslint-react": coreReactPlugins["@eslint-react"],
|
|
6926
|
+
"react-refresh": pluginReactRefresh
|
|
6927
|
+
}
|
|
6928
|
+
},
|
|
6929
|
+
{
|
|
6930
|
+
files: [GLOB_SRC],
|
|
6931
|
+
name: "jsse/react/rules",
|
|
6932
|
+
rules: {
|
|
6933
|
+
...pluginReact.configs.recommended.rules,
|
|
6934
|
+
"react/dom-no-string-style-prop": "off",
|
|
6935
|
+
"react/dom-no-unknown-property": "off"
|
|
6936
|
+
},
|
|
6937
|
+
settings: { react: { version: "detect" } }
|
|
6938
|
+
},
|
|
6939
|
+
...reactHooksConfig,
|
|
6940
|
+
{
|
|
6941
|
+
files: [GLOB_JSX, GLOB_TSX],
|
|
6942
|
+
name: "jsse/react/disables",
|
|
6943
|
+
rules: { "unicorn/no-null": "off" }
|
|
6944
|
+
}
|
|
6945
|
+
];
|
|
6946
|
+
if (reactRefresh) config.push({
|
|
6947
|
+
files: [GLOB_SRC],
|
|
6948
|
+
name: "jsse/react/refresh",
|
|
6949
|
+
rules: { "react-refresh/only-export-components": "error" }
|
|
6950
|
+
}, {
|
|
6951
|
+
files: ["**/*.stories.tsx"],
|
|
6952
|
+
name: "jsse/react-refresh/stories",
|
|
6953
|
+
rules: { "react-refresh/only-export-components": "off" }
|
|
6954
|
+
});
|
|
6955
|
+
return config;
|
|
6956
|
+
};
|
|
6957
|
+
//#endregion
|
|
6851
6958
|
//#region src/configs/ignores.ts
|
|
6852
6959
|
const ignores = async () => {
|
|
6853
6960
|
return [{
|
|
@@ -6877,7 +6984,7 @@ const imports = async (options) => {
|
|
|
6877
6984
|
}];
|
|
6878
6985
|
};
|
|
6879
6986
|
//#endregion
|
|
6880
|
-
//#region node_modules/.pnpm/globals@17.
|
|
6987
|
+
//#region node_modules/.pnpm/globals@17.7.0/node_modules/globals/globals.json
|
|
6881
6988
|
var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6882
6989
|
module.exports = {
|
|
6883
6990
|
"amd": {
|
|
@@ -7078,6 +7185,7 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7078
7185
|
"CSSConditionRule": false,
|
|
7079
7186
|
"CSSContainerRule": false,
|
|
7080
7187
|
"CSSCounterStyleRule": false,
|
|
7188
|
+
"CSSFontFaceDescriptors": false,
|
|
7081
7189
|
"CSSFontFaceRule": false,
|
|
7082
7190
|
"CSSFontFeatureValuesRule": false,
|
|
7083
7191
|
"CSSFontPaletteValuesRule": false,
|
|
@@ -7114,6 +7222,7 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7114
7222
|
"CSSPositionTryRule": false,
|
|
7115
7223
|
"CSSPositionValue": false,
|
|
7116
7224
|
"CSSPropertyRule": false,
|
|
7225
|
+
"CSSPseudoElement": false,
|
|
7117
7226
|
"CSSRotate": false,
|
|
7118
7227
|
"CSSRule": false,
|
|
7119
7228
|
"CSSRuleList": false,
|
|
@@ -7417,6 +7526,7 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7417
7526
|
"KeyboardLayoutMap": false,
|
|
7418
7527
|
"KeyframeEffect": false,
|
|
7419
7528
|
"LanguageDetector": false,
|
|
7529
|
+
"LanguageModel": false,
|
|
7420
7530
|
"LargestContentfulPaint": false,
|
|
7421
7531
|
"LaunchParams": false,
|
|
7422
7532
|
"launchQueue": false,
|
|
@@ -7481,6 +7591,7 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
7481
7591
|
"MimeType": false,
|
|
7482
7592
|
"MimeTypeArray": false,
|
|
7483
7593
|
"model": false,
|
|
7594
|
+
"ModelContext": false,
|
|
7484
7595
|
"ModelGenericSession": false,
|
|
7485
7596
|
"ModelManager": false,
|
|
7486
7597
|
"MouseEvent": false,
|
|
@@ -8057,6 +8168,7 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8057
8168
|
"WebGLTransformFeedback": false,
|
|
8058
8169
|
"WebGLUniformLocation": false,
|
|
8059
8170
|
"WebGLVertexArrayObject": false,
|
|
8171
|
+
"WebMCPEvent": false,
|
|
8060
8172
|
"WebSocket": false,
|
|
8061
8173
|
"WebSocketError": false,
|
|
8062
8174
|
"WebSocketStream": false,
|
|
@@ -8358,6 +8470,13 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8358
8470
|
"dispatchEvent": false,
|
|
8359
8471
|
"DisposableStack": false,
|
|
8360
8472
|
"DOMException": false,
|
|
8473
|
+
"DOMMatrix": false,
|
|
8474
|
+
"DOMMatrixReadOnly": false,
|
|
8475
|
+
"DOMPoint": false,
|
|
8476
|
+
"DOMPointReadOnly": false,
|
|
8477
|
+
"DOMQuad": false,
|
|
8478
|
+
"DOMRect": false,
|
|
8479
|
+
"DOMRectReadOnly": false,
|
|
8361
8480
|
"ErrorEvent": false,
|
|
8362
8481
|
"Event": false,
|
|
8363
8482
|
"EventSource": false,
|
|
@@ -8409,6 +8528,7 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8409
8528
|
"GPUValidationError": false,
|
|
8410
8529
|
"Headers": false,
|
|
8411
8530
|
"ImageBitmap": false,
|
|
8531
|
+
"ImageBitmapRenderingContext": false,
|
|
8412
8532
|
"ImageData": false,
|
|
8413
8533
|
"localStorage": false,
|
|
8414
8534
|
"location": false,
|
|
@@ -8419,6 +8539,7 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
8419
8539
|
"name": false,
|
|
8420
8540
|
"navigator": false,
|
|
8421
8541
|
"Navigator": false,
|
|
8542
|
+
"OffscreenCanvas": false,
|
|
8422
8543
|
"onbeforeunload": true,
|
|
8423
8544
|
"onerror": true,
|
|
8424
8545
|
"onload": true,
|
|
@@ -9602,6 +9723,7 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9602
9723
|
"PerformanceResourceTiming": false,
|
|
9603
9724
|
"process": false,
|
|
9604
9725
|
"queueMicrotask": false,
|
|
9726
|
+
"QuotaExceededError": false,
|
|
9605
9727
|
"ReadableByteStreamController": false,
|
|
9606
9728
|
"ReadableStream": false,
|
|
9607
9729
|
"ReadableStreamBYOBReader": false,
|
|
@@ -9619,6 +9741,7 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9619
9741
|
"structuredClone": false,
|
|
9620
9742
|
"SubtleCrypto": false,
|
|
9621
9743
|
"SuppressedError": false,
|
|
9744
|
+
"Temporal": false,
|
|
9622
9745
|
"TextDecoder": false,
|
|
9623
9746
|
"TextDecoderStream": false,
|
|
9624
9747
|
"TextEncoder": false,
|
|
@@ -9682,6 +9805,7 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9682
9805
|
"PerformanceResourceTiming": false,
|
|
9683
9806
|
"process": false,
|
|
9684
9807
|
"queueMicrotask": false,
|
|
9808
|
+
"QuotaExceededError": false,
|
|
9685
9809
|
"ReadableByteStreamController": false,
|
|
9686
9810
|
"ReadableStream": false,
|
|
9687
9811
|
"ReadableStreamBYOBReader": false,
|
|
@@ -9698,6 +9822,7 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9698
9822
|
"structuredClone": false,
|
|
9699
9823
|
"SubtleCrypto": false,
|
|
9700
9824
|
"SuppressedError": false,
|
|
9825
|
+
"Temporal": false,
|
|
9701
9826
|
"TextDecoder": false,
|
|
9702
9827
|
"TextDecoderStream": false,
|
|
9703
9828
|
"TextEncoder": false,
|
|
@@ -10241,6 +10366,7 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
10241
10366
|
"PerformanceObserverEntryList": false,
|
|
10242
10367
|
"PerformanceResourceTiming": false,
|
|
10243
10368
|
"queueMicrotask": false,
|
|
10369
|
+
"QuotaExceededError": false,
|
|
10244
10370
|
"ReadableByteStreamController": false,
|
|
10245
10371
|
"ReadableStream": false,
|
|
10246
10372
|
"ReadableStreamBYOBReader": false,
|
|
@@ -10256,6 +10382,7 @@ var require_globals$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
10256
10382
|
"structuredClone": false,
|
|
10257
10383
|
"SubtleCrypto": false,
|
|
10258
10384
|
"SuppressedError": false,
|
|
10385
|
+
"Temporal": false,
|
|
10259
10386
|
"TextDecoder": false,
|
|
10260
10387
|
"TextDecoderStream": false,
|
|
10261
10388
|
"TextEncoder": false,
|
|
@@ -11778,238 +11905,16 @@ const prettier = async () => {
|
|
|
11778
11905
|
}];
|
|
11779
11906
|
};
|
|
11780
11907
|
//#endregion
|
|
11781
|
-
//#region src/configs/
|
|
11782
|
-
|
|
11783
|
-
const
|
|
11784
|
-
const
|
|
11785
|
-
|
|
11786
|
-
|
|
11787
|
-
} : {};
|
|
11788
|
-
return {
|
|
11789
|
-
parser: parserTs,
|
|
11790
|
-
parserOptions: {
|
|
11791
|
-
ecmaFeatures: react ? {
|
|
11792
|
-
jsx: true,
|
|
11793
|
-
modules: true
|
|
11794
|
-
} : void 0,
|
|
11795
|
-
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
11796
|
-
sourceType: "module",
|
|
11797
|
-
...tsOptions,
|
|
11798
|
-
jsxPragma: react ? "React" : void 0
|
|
11799
|
-
}
|
|
11800
|
-
};
|
|
11801
|
-
}
|
|
11802
|
-
//#endregion
|
|
11803
|
-
//#region src/configs/react.ts
|
|
11804
|
-
function reactRules() {
|
|
11805
|
-
return {
|
|
11806
|
-
"react-hooks/exhaustive-deps": "error",
|
|
11807
|
-
"react-hooks/rules-of-hooks": "error",
|
|
11808
|
-
"react/boolean-prop-naming": ["error", {
|
|
11809
|
-
rule: ["^(is|has)[A-Z]([A-Za-z0-9]?)+", "|^(debug|disabled|hidden|required|selected|highlight)$"].join(""),
|
|
11810
|
-
validateNested: true
|
|
11811
|
-
}],
|
|
11812
|
-
"react/button-has-type": "error",
|
|
11813
|
-
"react/function-component-definition": ["error", {
|
|
11814
|
-
namedComponents: "function-declaration",
|
|
11815
|
-
unnamedComponents: "arrow-function"
|
|
11816
|
-
}],
|
|
11817
|
-
"react/hook-use-state": "error",
|
|
11818
|
-
"react/iframe-missing-sandbox": "error",
|
|
11819
|
-
"react/jsx-boolean-value": "error",
|
|
11820
|
-
"react/jsx-child-element-spacing": "error",
|
|
11821
|
-
"react/jsx-closing-bracket-location": ["error", {
|
|
11822
|
-
nonEmpty: "tag-aligned",
|
|
11823
|
-
selfClosing: false
|
|
11824
|
-
}],
|
|
11825
|
-
"react/jsx-closing-tag-location": "error",
|
|
11826
|
-
"react/jsx-curly-brace-presence": ["error", {
|
|
11827
|
-
children: "never",
|
|
11828
|
-
propElementValues: "always",
|
|
11829
|
-
props: "never"
|
|
11830
|
-
}],
|
|
11831
|
-
"react/jsx-curly-newline": ["error", {
|
|
11832
|
-
multiline: "consistent",
|
|
11833
|
-
singleline: "forbid"
|
|
11834
|
-
}],
|
|
11835
|
-
"react/jsx-curly-spacing": ["error", "never"],
|
|
11836
|
-
"react/jsx-equals-spacing": ["error", "never"],
|
|
11837
|
-
"react/jsx-first-prop-new-line": "error",
|
|
11838
|
-
"react/jsx-fragments": ["error", "syntax"],
|
|
11839
|
-
"react/jsx-indent": ["error", 2],
|
|
11840
|
-
"react/jsx-indent-props": ["error", 2],
|
|
11841
|
-
"react/jsx-key": "warn",
|
|
11842
|
-
"react/jsx-max-props-per-line": ["error", {
|
|
11843
|
-
maximum: 3,
|
|
11844
|
-
when: "multiline"
|
|
11845
|
-
}],
|
|
11846
|
-
"react/jsx-no-bind": ["error", { allowArrowFunctions: true }],
|
|
11847
|
-
"react/jsx-no-comment-textnodes": "error",
|
|
11848
|
-
"react/jsx-no-constructed-context-values": "error",
|
|
11849
|
-
"react/jsx-no-duplicate-props": ["error", { ignoreCase: true }],
|
|
11850
|
-
"react/jsx-no-script-url": "error",
|
|
11851
|
-
"react/jsx-no-target-blank": ["error", {
|
|
11852
|
-
allowReferrer: true,
|
|
11853
|
-
forms: true,
|
|
11854
|
-
warnOnSpreadAttributes: true
|
|
11855
|
-
}],
|
|
11856
|
-
"react/jsx-no-undef": "error",
|
|
11857
|
-
"react/jsx-no-useless-fragment": "error",
|
|
11858
|
-
"react/jsx-pascal-case": "error",
|
|
11859
|
-
"react/jsx-props-no-multi-spaces": "error",
|
|
11860
|
-
"react/jsx-sort-props": ["error", {
|
|
11861
|
-
callbacksLast: true,
|
|
11862
|
-
noSortAlphabetically: true,
|
|
11863
|
-
reservedFirst: true,
|
|
11864
|
-
shorthandFirst: true
|
|
11865
|
-
}],
|
|
11866
|
-
"react/jsx-tag-spacing": ["error", {
|
|
11867
|
-
afterOpening: "never",
|
|
11868
|
-
beforeClosing: "never",
|
|
11869
|
-
beforeSelfClosing: "never",
|
|
11870
|
-
closingSlash: "never"
|
|
11871
|
-
}],
|
|
11872
|
-
"react/jsx-uses-react": "error",
|
|
11873
|
-
"react/jsx-uses-vars": "error",
|
|
11874
|
-
"react/jsx-wrap-multilines": ["error", {
|
|
11875
|
-
arrow: "parens-new-line",
|
|
11876
|
-
assignment: "parens-new-line",
|
|
11877
|
-
condition: "ignore",
|
|
11878
|
-
declaration: "parens-new-line",
|
|
11879
|
-
logical: "ignore",
|
|
11880
|
-
prop: "ignore",
|
|
11881
|
-
return: "parens-new-line"
|
|
11882
|
-
}],
|
|
11883
|
-
"react/no-array-index-key": "error",
|
|
11884
|
-
"react/no-arrow-function-lifecycle": "error",
|
|
11885
|
-
"react/no-children-prop": "error",
|
|
11886
|
-
"react/no-danger": "error",
|
|
11887
|
-
"react/no-danger-with-children": "error",
|
|
11888
|
-
"react/no-deprecated": "error",
|
|
11889
|
-
"react/no-did-update-set-state": "error",
|
|
11890
|
-
"react/no-direct-mutation-state": "error",
|
|
11891
|
-
"react/no-find-dom-node": "error",
|
|
11892
|
-
"react/no-invalid-html-attribute": "error",
|
|
11893
|
-
"react/no-is-mounted": "error",
|
|
11894
|
-
"react/no-namespace": "error",
|
|
11895
|
-
"react/no-redundant-should-component-update": "error",
|
|
11896
|
-
"react/no-render-return-value": "error",
|
|
11897
|
-
"react/no-string-refs": ["error", { noTemplateLiterals: true }],
|
|
11898
|
-
"react/no-this-in-sfc": "error",
|
|
11899
|
-
"react/no-typos": "error",
|
|
11900
|
-
"react/no-unescaped-entities": "error",
|
|
11901
|
-
"react/no-unsafe": "error",
|
|
11902
|
-
"react/no-unstable-nested-components": "error",
|
|
11903
|
-
"react/no-unused-state": "error",
|
|
11904
|
-
"react/prefer-read-only-props": "error",
|
|
11905
|
-
"react/react-in-jsx-scope": "off",
|
|
11906
|
-
"react/require-default-props": ["error", {
|
|
11907
|
-
forbidDefaultForRequired: true,
|
|
11908
|
-
ignoreFunctionalComponents: true
|
|
11909
|
-
}],
|
|
11910
|
-
"react/self-closing-comp": "error",
|
|
11911
|
-
"react/state-in-constructor": ["error", "never"],
|
|
11912
|
-
"react/static-property-placement": "error",
|
|
11913
|
-
"react/style-prop-object": ["error", { allow: ["FormattedNumber"] }],
|
|
11914
|
-
"react/void-dom-elements-no-children": "error"
|
|
11915
|
-
};
|
|
11916
|
-
}
|
|
11917
|
-
/**
|
|
11918
|
-
* Stupid prop types causes test error
|
|
11919
|
-
* @returns React recommended rules
|
|
11920
|
-
*/
|
|
11921
|
-
function reactRecomendedRules() {
|
|
11922
|
-
return {
|
|
11923
|
-
"react/display-name": 0,
|
|
11924
|
-
"react/jsx-key": 2,
|
|
11925
|
-
"react/jsx-no-comment-textnodes": 2,
|
|
11926
|
-
"react/jsx-no-duplicate-props": 2,
|
|
11927
|
-
"react/jsx-no-target-blank": 2,
|
|
11928
|
-
"react/jsx-no-undef": 2,
|
|
11929
|
-
"react/jsx-uses-react": 2,
|
|
11930
|
-
"react/jsx-uses-vars": 2,
|
|
11931
|
-
"react/no-children-prop": 2,
|
|
11932
|
-
"react/no-danger-with-children": 2,
|
|
11933
|
-
"react/no-deprecated": 2,
|
|
11934
|
-
"react/no-direct-mutation-state": 0,
|
|
11935
|
-
"react/no-find-dom-node": 2,
|
|
11936
|
-
"react/no-is-mounted": 2,
|
|
11937
|
-
"react/no-render-return-value": 2,
|
|
11938
|
-
"react/no-string-refs": 2,
|
|
11939
|
-
"react/no-unescaped-entities": 2,
|
|
11940
|
-
"react/no-unsafe": 0,
|
|
11941
|
-
"react/prop-types": 1,
|
|
11942
|
-
"react/react-in-jsx-scope": 2,
|
|
11943
|
-
"react/require-render-return": 2
|
|
11944
|
-
};
|
|
11945
|
-
}
|
|
11946
|
-
async function importReactPlugins() {
|
|
11947
|
-
const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all([
|
|
11948
|
-
interopDefault(import("eslint-plugin-react")),
|
|
11949
|
-
interopDefault(import("eslint-plugin-react-hooks")),
|
|
11950
|
-
interopDefault(import("eslint-plugin-react-refresh"))
|
|
11951
|
-
]);
|
|
11952
|
-
return {
|
|
11953
|
-
pluginReact,
|
|
11954
|
-
pluginReactHooks,
|
|
11955
|
-
pluginReactRefresh
|
|
11956
|
-
};
|
|
11957
|
-
}
|
|
11958
|
-
const react = async (options) => {
|
|
11959
|
-
const { componentExts, parserOptions = {}, react, reactRefresh, tsconfig } = options ?? {};
|
|
11960
|
-
const { pluginReact, pluginReactHooks, pluginReactRefresh } = await importReactPlugins();
|
|
11961
|
-
const config = [
|
|
11962
|
-
{
|
|
11963
|
-
files: [GLOB_SRC],
|
|
11964
|
-
languageOptions: typescriptLanguageOptions({
|
|
11965
|
-
componentExts,
|
|
11966
|
-
parserOptions,
|
|
11967
|
-
react,
|
|
11968
|
-
tsconfig
|
|
11969
|
-
}),
|
|
11970
|
-
name: "jsse/react/setup",
|
|
11971
|
-
plugins: {
|
|
11972
|
-
react: pluginReact,
|
|
11973
|
-
"react-hooks": pluginReactHooks,
|
|
11974
|
-
"react-refresh": pluginReactRefresh
|
|
11975
|
-
}
|
|
11976
|
-
},
|
|
11977
|
-
{
|
|
11978
|
-
files: [GLOB_SRC],
|
|
11979
|
-
name: "jsse/react/rules",
|
|
11980
|
-
rules: {
|
|
11981
|
-
...reactRecomendedRules(),
|
|
11982
|
-
...pluginReact.configs["jsx-runtime"].rules,
|
|
11983
|
-
...reactRules()
|
|
11984
|
-
},
|
|
11985
|
-
settings: { react: { version: "detect" } }
|
|
11986
|
-
},
|
|
11987
|
-
{
|
|
11988
|
-
files: [GLOB_SRC],
|
|
11989
|
-
name: "jsse/react-hooks/rules",
|
|
11990
|
-
rules: {
|
|
11991
|
-
"react-hooks/exhaustive-deps": "error",
|
|
11992
|
-
"react-hooks/rules-of-hooks": "error",
|
|
11993
|
-
...pluginReactHooks.configs.recommended.rules
|
|
11994
|
-
},
|
|
11995
|
-
settings: { react: { version: "detect" } }
|
|
11996
|
-
},
|
|
11997
|
-
{
|
|
11998
|
-
files: [GLOB_JSX, GLOB_TSX],
|
|
11999
|
-
name: "jsse/react/disables",
|
|
12000
|
-
rules: { "unicorn/no-null": "off" }
|
|
12001
|
-
}
|
|
12002
|
-
];
|
|
12003
|
-
if (reactRefresh) config.push({
|
|
11908
|
+
//#region src/configs/regexp.ts
|
|
11909
|
+
const regexp = async () => {
|
|
11910
|
+
const config = configs["flat/recommended"];
|
|
11911
|
+
const rules = { ...config.rules };
|
|
11912
|
+
return [{
|
|
11913
|
+
...config,
|
|
12004
11914
|
files: [GLOB_SRC],
|
|
12005
|
-
name: "jsse/
|
|
12006
|
-
rules
|
|
12007
|
-
}
|
|
12008
|
-
files: ["**/*.stories.tsx"],
|
|
12009
|
-
name: "jsse/react-refresh/stories",
|
|
12010
|
-
rules: { "react-refresh/only-export-components": "off" }
|
|
12011
|
-
});
|
|
12012
|
-
return config;
|
|
11915
|
+
name: "jsse/regexp/rules",
|
|
11916
|
+
rules
|
|
11917
|
+
}];
|
|
12013
11918
|
};
|
|
12014
11919
|
//#endregion
|
|
12015
11920
|
//#region src/configs/sort-package-json.ts
|
|
@@ -12420,7 +12325,9 @@ function unicornOff() {
|
|
|
12420
12325
|
return {
|
|
12421
12326
|
"unicorn/catch-error-name": "off",
|
|
12422
12327
|
"unicorn/comment-content": "off",
|
|
12328
|
+
"unicorn/consistent-boolean-name": "off",
|
|
12423
12329
|
"unicorn/consistent-destructuring": "off",
|
|
12330
|
+
"unicorn/name-replacements": "off",
|
|
12424
12331
|
"unicorn/no-array-reduce": "off",
|
|
12425
12332
|
"unicorn/no-nested-ternary": "off",
|
|
12426
12333
|
"unicorn/no-process-exit": "off",
|
|
@@ -12583,7 +12490,7 @@ const flatConfigProps = [
|
|
|
12583
12490
|
"rules",
|
|
12584
12491
|
"settings"
|
|
12585
12492
|
];
|
|
12586
|
-
const codeScopedConfigNames = new Set([
|
|
12493
|
+
const codeScopedConfigNames = /* @__PURE__ */ new Set([
|
|
12587
12494
|
"jsse/antfu",
|
|
12588
12495
|
"jsse/command/rules",
|
|
12589
12496
|
"jsse/de-morgan",
|
|
@@ -12613,6 +12520,7 @@ function defaultOptions() {
|
|
|
12613
12520
|
pnpm: false,
|
|
12614
12521
|
prettier: true,
|
|
12615
12522
|
react: false,
|
|
12523
|
+
regexp: true,
|
|
12616
12524
|
reportUnusedDisableDirectives: true,
|
|
12617
12525
|
rootId: "jsse",
|
|
12618
12526
|
sortImports: false,
|
|
@@ -12626,7 +12534,7 @@ function defaultOptions() {
|
|
|
12626
12534
|
};
|
|
12627
12535
|
}
|
|
12628
12536
|
function normalizeOptions(options = {}) {
|
|
12629
|
-
const off = [
|
|
12537
|
+
const off = [.../* @__PURE__ */ new Set([...options.off ?? [], ...options.fast ? [...SLOW_RULES] : []])].sort((a, b) => a.localeCompare(b, void 0, {
|
|
12630
12538
|
numeric: true,
|
|
12631
12539
|
sensitivity: "base"
|
|
12632
12540
|
}));
|
|
@@ -12650,7 +12558,7 @@ function normalizeOptions(options = {}) {
|
|
|
12650
12558
|
*/
|
|
12651
12559
|
async function jsse(options = {}, ...userConfigs) {
|
|
12652
12560
|
const normalizedOptions = normalizeOptions(options);
|
|
12653
|
-
const { command: enableCommand, componentExts, debug, gitignore: enableGitignore, isInEditor, jsonc: enableJsonc, markdown: enableMarkdown, off, overrides = {}, pnpm: enablePnpm, prettier: enablePrettier, react: enableReact, reportUnusedDisableDirectives, rootId, sortImports: enableSortImports, sortPackageJson: enableSortPackageJson, sortTsconfig: enableSortTsconfig, stylistic: stylisticOptions, tailwind: tailwindOptions, test: enableTest, tsPrefix, typeAware, typescript: typescriptOptions, yaml: enableYaml } = normalizedOptions;
|
|
12561
|
+
const { command: enableCommand, componentExts, debug, gitignore: enableGitignore, isInEditor, jsonc: enableJsonc, markdown: enableMarkdown, off, overrides = {}, pnpm: enablePnpm, prettier: enablePrettier, react: enableReact, regexp: enableRegexp, reportUnusedDisableDirectives, rootId, sortImports: enableSortImports, sortPackageJson: enableSortPackageJson, sortTsconfig: enableSortTsconfig, stylistic: stylisticOptions, tailwind: tailwindOptions, test: enableTest, tsPrefix, typeAware, typescript: typescriptOptions, yaml: enableYaml } = normalizedOptions;
|
|
12654
12562
|
if (debug || process$1.argv.includes("--debug")) enableDbg();
|
|
12655
12563
|
dbg("@jsse/eslint-config debug=true");
|
|
12656
12564
|
dbg("@jsse/eslint-config isInEditor: %O", isInEditor);
|
|
@@ -12716,9 +12624,10 @@ async function jsse(options = {}, ...userConfigs) {
|
|
|
12716
12624
|
const ymlConfig = yml();
|
|
12717
12625
|
configs.push(ymlConfig);
|
|
12718
12626
|
}
|
|
12719
|
-
if (enableReact) configs.push(
|
|
12627
|
+
if (enableReact) configs.push(eslintReact({ reactRefresh: normalizedOptions.reactRefresh !== false }));
|
|
12720
12628
|
if (enablePrettier) configs.push(prettier());
|
|
12721
12629
|
if (stylisticOptions) configs.push(stylistic(stylisticOptions === true ? {} : stylisticOptions));
|
|
12630
|
+
if (enableRegexp) configs.push(regexp());
|
|
12722
12631
|
if (enableTest) configs.push(vitest({
|
|
12723
12632
|
isInEditor,
|
|
12724
12633
|
overrides: overrides.test
|
|
@@ -12757,18 +12666,8 @@ async function jsse(options = {}, ...userConfigs) {
|
|
|
12757
12666
|
for (const config of scopedConfigs) if (config.name && config.name.startsWith("jsse/")) config.name = config.name.replace("jsse/", `${rootId}/`);
|
|
12758
12667
|
}
|
|
12759
12668
|
if (tsPrefix && tsPrefix !== "@typescript-eslint") for (const config of scopedConfigs) {
|
|
12760
|
-
if (config.plugins)
|
|
12761
|
-
|
|
12762
|
-
delete config.plugins[key];
|
|
12763
|
-
config.plugins[`${tsPrefix}/${key.slice(19)}`] = value;
|
|
12764
|
-
}
|
|
12765
|
-
}
|
|
12766
|
-
if (config.rules) {
|
|
12767
|
-
for (const [key, value] of Object.entries(config.rules)) if (key.startsWith("@typescript-eslint/")) {
|
|
12768
|
-
delete config.rules[key];
|
|
12769
|
-
config.rules[`${tsPrefix}/${key.slice(19)}`] = value;
|
|
12770
|
-
}
|
|
12771
|
-
}
|
|
12669
|
+
if (config.plugins) replaceTypescriptEslintPrefix(config.plugins, tsPrefix);
|
|
12670
|
+
if (config.rules) replaceTypescriptEslintPrefix(config.rules, tsPrefix);
|
|
12772
12671
|
}
|
|
12773
12672
|
if (normalizedOptions.preReturn) {
|
|
12774
12673
|
dbg("Running preReturn");
|
|
@@ -12793,4 +12692,4 @@ const jsseReact = (options, ...configs) => {
|
|
|
12793
12692
|
}, ...configs);
|
|
12794
12693
|
};
|
|
12795
12694
|
//#endregion
|
|
12796
|
-
export { SLOW_RULES, VERSION, changeRuleEntrySeverity, combine, combineAsync, jsse as default, jsse, defineConfig, error2warn, globs_exports as globs, importPluginMarkdown, importPluginReact, importPluginReactRefresh, importPluginStylistic, interopDefault, isCI, isInEditor, jsseReact, parserPlain, parserTs, pluginAntfu, pluginDeMorgan, pluginEslintComments, pluginImportLite, pluginN, pluginPerfectionist, pluginPnpm, pluginTs, pluginUnicorn, pluginUnusedImports, renameRules, scopeTypeScriptRules, turnOffRules, uniqueStrings, warn2error };
|
|
12695
|
+
export { SLOW_RULES, VERSION, changeRuleEntrySeverity, combine, combineAsync, jsse as default, jsse, defineConfig, error2warn, globs_exports as globs, importPluginMarkdown, importPluginReact, importPluginReactRefresh, importPluginStylistic, interopDefault, isCI, isInEditor, jsseReact, parserPlain, parserTs, pluginAntfu, pluginDeMorgan, pluginEslintComments, pluginImportLite, pluginN, pluginPerfectionist, pluginPnpm, pluginRegexp, pluginTs, pluginUnicorn, pluginUnusedImports, renameRules, replaceTypescriptEslintPrefix, scopeTypeScriptRules, turnOffRules, uniqueStrings, warn2error };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/cli.ts","../src/config-fns.ts","../src/configs.test.ts","../src/const.ts","../src/define-config.ts","../src/dev.ts","../src/fixable.test.ts","../src/fixable.ts","../src/globs.ts","../src/index.ts","../src/lager.ts","../src/plugins-all.test.ts","../src/plugins-all.ts","../src/plugins.ts","../src/presets.ts","../src/types.ts","../src/utils.ts","../src/_generated/fixable-rules-map.ts","../src/_generated/rule-options.d.ts","../src/_generated/version.ts","../src/_generated/dts/antfu.d.ts","../src/_generated/dts/builtins.d.ts","../src/_generated/dts/command.d.ts","../src/_generated/dts/de-morgan.d.ts","../src/_generated/dts/eslint-comments.d.ts","../src/_generated/dts/ignores.d.ts","../src/_generated/dts/imports.d.ts","../src/_generated/dts/javascript.d.ts","../src/_generated/dts/jsdoc.d.ts","../src/_generated/dts/jsonc.d.ts","../src/_generated/dts/markdown.d.ts","../src/_generated/dts/n.d.ts","../src/_generated/dts/no-only-tests.d.ts","../src/_generated/dts/perfectionist.d.ts","../src/_generated/dts/pnpm.d.ts","../src/_generated/dts/prettier.d.ts","../src/_generated/dts/react-hooks.d.ts","../src/_generated/dts/
|
|
1
|
+
{"root":["../src/cli.ts","../src/config-fns.ts","../src/configs.test.ts","../src/const.ts","../src/define-config.ts","../src/dev.ts","../src/fixable.test.ts","../src/fixable.ts","../src/globs.ts","../src/index.ts","../src/lager.ts","../src/plugins-all.test.ts","../src/plugins-all.ts","../src/plugins.ts","../src/presets.ts","../src/types.ts","../src/utils.ts","../src/_generated/fixable-rules-map.ts","../src/_generated/rule-options.d.ts","../src/_generated/version.ts","../src/_generated/dts/antfu.d.ts","../src/_generated/dts/builtins.d.ts","../src/_generated/dts/command.d.ts","../src/_generated/dts/de-morgan.d.ts","../src/_generated/dts/eslint-comments.d.ts","../src/_generated/dts/eslint-react.d.ts","../src/_generated/dts/ignores.d.ts","../src/_generated/dts/imports.d.ts","../src/_generated/dts/javascript.d.ts","../src/_generated/dts/jsdoc.d.ts","../src/_generated/dts/jsonc.d.ts","../src/_generated/dts/markdown.d.ts","../src/_generated/dts/n.d.ts","../src/_generated/dts/no-only-tests.d.ts","../src/_generated/dts/perfectionist.d.ts","../src/_generated/dts/pnpm.d.ts","../src/_generated/dts/prettier.d.ts","../src/_generated/dts/react-hooks.d.ts","../src/_generated/dts/regexp.d.ts","../src/_generated/dts/sort-package-json.d.ts","../src/_generated/dts/sort-tsconfig.d.ts","../src/_generated/dts/stylistic.d.ts","../src/_generated/dts/toml.d.ts","../src/_generated/dts/typescript.d.ts","../src/_generated/dts/unicorn.d.ts","../src/_generated/dts/vitest.d.ts","../src/_generated/dts/yml.d.ts","../src/configs/_template.ts","../src/configs/antfu.ts","../src/configs/command.ts","../src/configs/de-morgan.ts","../src/configs/eslint-comments.ts","../src/configs/eslint-react.ts","../src/configs/ignores.ts","../src/configs/imports.ts","../src/configs/javascript.ts","../src/configs/jsdoc.ts","../src/configs/jsonc.ts","../src/configs/markdown.ts","../src/configs/n.ts","../src/configs/no-only-tests.ts","../src/configs/perfectionist.ts","../src/configs/pnpm.ts","../src/configs/prettier.ts","../src/configs/react-hooks.ts","../src/configs/react.ts","../src/configs/regexp.ts","../src/configs/rules.test.ts","../src/configs/sort-package-json.ts","../src/configs/sort-tsconfig.ts","../src/configs/stylistic.ts","../src/configs/toml.ts","../src/configs/tsdoc.ts","../src/configs/unicorn.ts","../src/configs/vitest.ts","../src/configs/yml.ts","../src/configs/_legacy/tailwind.ts","../src/configs/ts/parser.ts","../src/configs/ts/requires-type-checking.ts","../src/configs/ts/typescript-language-options.ts","../src/configs/ts/typescript-rules.ts","../src/configs/ts/typescript.ts"],"version":"6.0.3"}
|