@lincy/eslint-config 5.9.0 → 6.0.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/dist/chunk-DWy1uDak.cjs +39 -0
- package/dist/index.cjs +66 -81
- package/dist/index.d.cts +626 -251
- package/dist/{index.d.ts → index.d.mts} +627 -252
- package/dist/{index.js → index.mjs} +55 -43
- package/dist/lib-BJFVxmuP.cjs +11153 -0
- package/dist/lib-D3OsxTXr.mjs +11157 -0
- package/package.json +46 -44
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
13
|
+
key = keys[i];
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
|
+
get: ((k) => from[k]).bind(null, key),
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
22
|
+
value: mod,
|
|
23
|
+
enumerable: true
|
|
24
|
+
}) : target, mod));
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
|
|
28
|
+
Object.defineProperty(exports, '__commonJS', {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () {
|
|
31
|
+
return __commonJS;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(exports, '__toESM', {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () {
|
|
37
|
+
return __toESM;
|
|
38
|
+
}
|
|
39
|
+
});
|
package/dist/index.cjs
CHANGED
|
@@ -1,57 +1,30 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
-
get: ((k) => from[k]).bind(null, key),
|
|
14
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
-
value: mod,
|
|
21
|
-
enumerable: true
|
|
22
|
-
}) : target, mod));
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
2
|
+
const require_chunk = require('./chunk-DWy1uDak.cjs');
|
|
25
3
|
let eslint_flat_config_utils = require("eslint-flat-config-utils");
|
|
26
|
-
eslint_flat_config_utils = __toESM(eslint_flat_config_utils);
|
|
27
4
|
let local_pkg = require("local-pkg");
|
|
28
|
-
local_pkg = __toESM(local_pkg);
|
|
29
5
|
let __eslint_community_eslint_plugin_eslint_comments = require("@eslint-community/eslint-plugin-eslint-comments");
|
|
30
|
-
__eslint_community_eslint_plugin_eslint_comments = __toESM(__eslint_community_eslint_plugin_eslint_comments);
|
|
6
|
+
__eslint_community_eslint_plugin_eslint_comments = require_chunk.__toESM(__eslint_community_eslint_plugin_eslint_comments);
|
|
31
7
|
let eslint_plugin_antfu = require("eslint-plugin-antfu");
|
|
32
|
-
eslint_plugin_antfu = __toESM(eslint_plugin_antfu);
|
|
8
|
+
eslint_plugin_antfu = require_chunk.__toESM(eslint_plugin_antfu);
|
|
33
9
|
let eslint_plugin_import_lite = require("eslint-plugin-import-lite");
|
|
34
|
-
eslint_plugin_import_lite = __toESM(eslint_plugin_import_lite);
|
|
10
|
+
eslint_plugin_import_lite = require_chunk.__toESM(eslint_plugin_import_lite);
|
|
35
11
|
let eslint_plugin_n = require("eslint-plugin-n");
|
|
36
|
-
eslint_plugin_n = __toESM(eslint_plugin_n);
|
|
12
|
+
eslint_plugin_n = require_chunk.__toESM(eslint_plugin_n);
|
|
37
13
|
let eslint_plugin_perfectionist = require("eslint-plugin-perfectionist");
|
|
38
|
-
eslint_plugin_perfectionist = __toESM(eslint_plugin_perfectionist);
|
|
14
|
+
eslint_plugin_perfectionist = require_chunk.__toESM(eslint_plugin_perfectionist);
|
|
39
15
|
let eslint_plugin_unicorn = require("eslint-plugin-unicorn");
|
|
40
|
-
eslint_plugin_unicorn = __toESM(eslint_plugin_unicorn);
|
|
16
|
+
eslint_plugin_unicorn = require_chunk.__toESM(eslint_plugin_unicorn);
|
|
41
17
|
let eslint_plugin_unused_imports = require("eslint-plugin-unused-imports");
|
|
42
|
-
eslint_plugin_unused_imports = __toESM(eslint_plugin_unused_imports);
|
|
18
|
+
eslint_plugin_unused_imports = require_chunk.__toESM(eslint_plugin_unused_imports);
|
|
43
19
|
let node_process = require("node:process");
|
|
44
|
-
node_process = __toESM(node_process);
|
|
20
|
+
node_process = require_chunk.__toESM(node_process);
|
|
45
21
|
let node_url = require("node:url");
|
|
46
|
-
node_url = __toESM(node_url);
|
|
47
22
|
let globals = require("globals");
|
|
48
|
-
globals = __toESM(globals);
|
|
23
|
+
globals = require_chunk.__toESM(globals);
|
|
49
24
|
let eslint_merge_processors = require("eslint-merge-processors");
|
|
50
|
-
eslint_merge_processors = __toESM(eslint_merge_processors);
|
|
51
25
|
let eslint_parser_plain = require("eslint-parser-plain");
|
|
52
|
-
eslint_parser_plain = __toESM(eslint_parser_plain);
|
|
26
|
+
eslint_parser_plain = require_chunk.__toESM(eslint_parser_plain);
|
|
53
27
|
let eslint_plugin_regexp = require("eslint-plugin-regexp");
|
|
54
|
-
eslint_plugin_regexp = __toESM(eslint_plugin_regexp);
|
|
55
28
|
|
|
56
29
|
//#region src/configs/comments.ts
|
|
57
30
|
async function comments(options = {}) {
|
|
@@ -902,6 +875,11 @@ async function nextjs(options = {}) {
|
|
|
902
875
|
const { files = [GLOB_SRC], overrides = {} } = options;
|
|
903
876
|
await ensurePackages(["@next/eslint-plugin-next"]);
|
|
904
877
|
const pluginNextJS = await interopDefault(import("@next/eslint-plugin-next"));
|
|
878
|
+
function getRules(name) {
|
|
879
|
+
const rules = pluginNextJS.configs?.[name]?.rules;
|
|
880
|
+
if (!rules) throw new Error(`[@lincy/eslint-config] Failed to find config ${name} in @next/eslint-plugin-next`);
|
|
881
|
+
return normalizeRules(rules);
|
|
882
|
+
}
|
|
905
883
|
return [{
|
|
906
884
|
name: "eslint/nextjs/setup",
|
|
907
885
|
plugins: { next: pluginNextJS }
|
|
@@ -913,8 +891,8 @@ async function nextjs(options = {}) {
|
|
|
913
891
|
},
|
|
914
892
|
name: "eslint/nextjs/rules",
|
|
915
893
|
rules: {
|
|
916
|
-
...
|
|
917
|
-
...
|
|
894
|
+
...getRules("recommended"),
|
|
895
|
+
...getRules("core-web-vitals"),
|
|
918
896
|
...overrides
|
|
919
897
|
},
|
|
920
898
|
settings: { react: { version: "detect" } }
|
|
@@ -1100,43 +1078,7 @@ async function react(options = {}) {
|
|
|
1100
1078
|
"react-dom/no-unsafe-target-blank": "warn",
|
|
1101
1079
|
"react-dom/no-use-form-state": "error",
|
|
1102
1080
|
"react-dom/no-void-elements-with-children": "error",
|
|
1103
|
-
"react-
|
|
1104
|
-
"react-hooks-extra/no-unnecessary-use-prefix": "warn",
|
|
1105
|
-
"react-hooks-extra/prefer-use-state-lazy-initialization": "warn",
|
|
1106
|
-
"react-hooks/exhaustive-deps": "warn",
|
|
1107
|
-
"react-hooks/rules-of-hooks": "error",
|
|
1108
|
-
"react-refresh/only-export-components": ["warn", {
|
|
1109
|
-
allowConstantExport: isAllowConstantExport,
|
|
1110
|
-
allowExportNames: [...isUsingNext ? [
|
|
1111
|
-
"dynamic",
|
|
1112
|
-
"dynamicParams",
|
|
1113
|
-
"revalidate",
|
|
1114
|
-
"fetchCache",
|
|
1115
|
-
"runtime",
|
|
1116
|
-
"preferredRegion",
|
|
1117
|
-
"maxDuration",
|
|
1118
|
-
"config",
|
|
1119
|
-
"generateStaticParams",
|
|
1120
|
-
"metadata",
|
|
1121
|
-
"generateMetadata",
|
|
1122
|
-
"viewport",
|
|
1123
|
-
"generateViewport"
|
|
1124
|
-
] : [], ...isUsingRemix || isUsingReactRouter ? [
|
|
1125
|
-
"meta",
|
|
1126
|
-
"links",
|
|
1127
|
-
"headers",
|
|
1128
|
-
"loader",
|
|
1129
|
-
"action",
|
|
1130
|
-
"clientLoader",
|
|
1131
|
-
"clientAction",
|
|
1132
|
-
"handle",
|
|
1133
|
-
"shouldRevalidate"
|
|
1134
|
-
] : []]
|
|
1135
|
-
}],
|
|
1136
|
-
"react-web-api/no-leaked-event-listener": "warn",
|
|
1137
|
-
"react-web-api/no-leaked-interval": "warn",
|
|
1138
|
-
"react-web-api/no-leaked-resize-observer": "warn",
|
|
1139
|
-
"react-web-api/no-leaked-timeout": "warn",
|
|
1081
|
+
"react/jsx-no-comment-textnodes": "warn",
|
|
1140
1082
|
"react/jsx-no-duplicate-props": "warn",
|
|
1141
1083
|
"react/jsx-uses-vars": "warn",
|
|
1142
1084
|
"react/no-access-state-in-setstate": "error",
|
|
@@ -1147,7 +1089,6 @@ async function react(options = {}) {
|
|
|
1147
1089
|
"react/no-children-only": "warn",
|
|
1148
1090
|
"react/no-children-to-array": "warn",
|
|
1149
1091
|
"react/no-clone-element": "warn",
|
|
1150
|
-
"react/no-comment-textnodes": "warn",
|
|
1151
1092
|
"react/no-component-will-mount": "error",
|
|
1152
1093
|
"react/no-component-will-receive-props": "error",
|
|
1153
1094
|
"react/no-component-will-update": "error",
|
|
@@ -1155,7 +1096,6 @@ async function react(options = {}) {
|
|
|
1155
1096
|
"react/no-create-ref": "error",
|
|
1156
1097
|
"react/no-default-props": "error",
|
|
1157
1098
|
"react/no-direct-mutation-state": "error",
|
|
1158
|
-
"react/no-duplicate-jsx-props": "warn",
|
|
1159
1099
|
"react/no-duplicate-key": "warn",
|
|
1160
1100
|
"react/no-forward-ref": "warn",
|
|
1161
1101
|
"react/no-implicit-key": "warn",
|
|
@@ -1167,6 +1107,7 @@ async function react(options = {}) {
|
|
|
1167
1107
|
"react/no-set-state-in-component-did-update": "warn",
|
|
1168
1108
|
"react/no-set-state-in-component-will-update": "warn",
|
|
1169
1109
|
"react/no-string-refs": "error",
|
|
1110
|
+
"react/no-unnecessary-use-prefix": "warn",
|
|
1170
1111
|
"react/no-unsafe-component-will-mount": "warn",
|
|
1171
1112
|
"react/no-unsafe-component-will-receive-props": "warn",
|
|
1172
1113
|
"react/no-unsafe-component-will-update": "warn",
|
|
@@ -1176,7 +1117,41 @@ async function react(options = {}) {
|
|
|
1176
1117
|
"react/no-unused-state": "warn",
|
|
1177
1118
|
"react/no-use-context": "warn",
|
|
1178
1119
|
"react/no-useless-forward-ref": "warn",
|
|
1179
|
-
"react/use-
|
|
1120
|
+
"react/prefer-use-state-lazy-initialization": "warn",
|
|
1121
|
+
...pluginReactHooks.configs.recommended.rules,
|
|
1122
|
+
"react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
|
|
1123
|
+
"react-refresh/only-export-components": ["warn", {
|
|
1124
|
+
allowConstantExport: isAllowConstantExport,
|
|
1125
|
+
allowExportNames: [...isUsingNext ? [
|
|
1126
|
+
"dynamic",
|
|
1127
|
+
"dynamicParams",
|
|
1128
|
+
"revalidate",
|
|
1129
|
+
"fetchCache",
|
|
1130
|
+
"runtime",
|
|
1131
|
+
"preferredRegion",
|
|
1132
|
+
"maxDuration",
|
|
1133
|
+
"config",
|
|
1134
|
+
"generateStaticParams",
|
|
1135
|
+
"metadata",
|
|
1136
|
+
"generateMetadata",
|
|
1137
|
+
"viewport",
|
|
1138
|
+
"generateViewport"
|
|
1139
|
+
] : [], ...isUsingRemix || isUsingReactRouter ? [
|
|
1140
|
+
"meta",
|
|
1141
|
+
"links",
|
|
1142
|
+
"headers",
|
|
1143
|
+
"loader",
|
|
1144
|
+
"action",
|
|
1145
|
+
"clientLoader",
|
|
1146
|
+
"clientAction",
|
|
1147
|
+
"handle",
|
|
1148
|
+
"shouldRevalidate"
|
|
1149
|
+
] : []]
|
|
1150
|
+
}],
|
|
1151
|
+
"react-web-api/no-leaked-event-listener": "warn",
|
|
1152
|
+
"react-web-api/no-leaked-interval": "warn",
|
|
1153
|
+
"react-web-api/no-leaked-resize-observer": "warn",
|
|
1154
|
+
"react-web-api/no-leaked-timeout": "warn",
|
|
1180
1155
|
...overrides
|
|
1181
1156
|
}
|
|
1182
1157
|
},
|
|
@@ -1520,7 +1495,7 @@ async function toml(options = {}) {
|
|
|
1520
1495
|
//#endregion
|
|
1521
1496
|
//#region src/configs/typescript.ts
|
|
1522
1497
|
async function typescript(options = {}) {
|
|
1523
|
-
const { componentExts = [], overrides = {}, parserOptions = {}, type = "app" } = options;
|
|
1498
|
+
const { componentExts = [], erasableOnly = false, overrides = {}, parserOptions = {}, type = "app" } = options;
|
|
1524
1499
|
const files = options.files ?? [GLOB_SRC, ...componentExts.map((ext) => `**/*.${ext}`)];
|
|
1525
1500
|
const ignoresTypeAware = options.ignoresTypeAware ?? [`${GLOB_MARKDOWN}/**`];
|
|
1526
1501
|
const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
|
|
@@ -1653,6 +1628,16 @@ async function typescript(options = {}) {
|
|
|
1653
1628
|
...typeAwareRules,
|
|
1654
1629
|
...overrides
|
|
1655
1630
|
}
|
|
1631
|
+
}] : [],
|
|
1632
|
+
...erasableOnly ? [{
|
|
1633
|
+
name: "eslint/typescript/erasable-syntax-only",
|
|
1634
|
+
plugins: { "erasable-syntax-only": await interopDefault(Promise.resolve().then(() => require("./lib-BJFVxmuP.cjs"))) },
|
|
1635
|
+
rules: {
|
|
1636
|
+
"erasable-syntax-only/enums": "error",
|
|
1637
|
+
"erasable-syntax-only/import-aliases": "error",
|
|
1638
|
+
"erasable-syntax-only/namespaces": "error",
|
|
1639
|
+
"erasable-syntax-only/parameter-properties": "error"
|
|
1640
|
+
}
|
|
1656
1641
|
}] : []
|
|
1657
1642
|
];
|
|
1658
1643
|
}
|