@storm-software/eslint 0.126.2 → 0.128.0
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/README.md +1 -1
- package/dist/chunk-G7QVU75O.js +245 -0
- package/dist/preset.d.ts +1 -1
- package/dist/preset.js +148 -162
- package/dist/{types-CnDDaY3J.d.ts → types-CqEOmL6d.d.ts} +1612 -7
- package/dist/utils/combine.d.ts +1 -1
- package/dist/utils/correct-paths.d.ts +30 -0
- package/dist/utils/correct-paths.js +33 -0
- package/dist/utils/index.js +3 -3
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
|
|
|
21
21
|
|
|
22
22
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
23
23
|
|
|
24
|
-
[](https://prettier.io/) [](http://nx.dev/) [](https://nextjs.org/) [](http://commitizen.github.io/cz-cli/)  [](https://fumadocs.vercel.app/) 
|
|
25
25
|
|
|
26
26
|
<!-- prettier-ignore-start -->
|
|
27
27
|
<!-- markdownlint-disable -->
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__name
|
|
3
|
+
} from "./chunk-SHUYVCID.js";
|
|
4
|
+
|
|
5
|
+
// src/utils/correct-paths.ts
|
|
6
|
+
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
7
|
+
function normalizeWindowsPath(input = "") {
|
|
8
|
+
if (!input) {
|
|
9
|
+
return input;
|
|
10
|
+
}
|
|
11
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
12
|
+
}
|
|
13
|
+
__name(normalizeWindowsPath, "normalizeWindowsPath");
|
|
14
|
+
var _UNC_REGEX = /^[/\\]{2}/;
|
|
15
|
+
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
16
|
+
var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
17
|
+
var _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
|
|
18
|
+
var _EXTNAME_RE = /.(\.[^./]+|\.)$/;
|
|
19
|
+
var _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/;
|
|
20
|
+
var sep = "/";
|
|
21
|
+
var correctPaths = /* @__PURE__ */ __name(function(path) {
|
|
22
|
+
if (!path || path.length === 0) {
|
|
23
|
+
return ".";
|
|
24
|
+
}
|
|
25
|
+
path = normalizeWindowsPath(path);
|
|
26
|
+
const isUNCPath = path.match(_UNC_REGEX);
|
|
27
|
+
const isPathAbsolute = isAbsolute(path);
|
|
28
|
+
const trailingSeparator = path[path.length - 1] === "/";
|
|
29
|
+
path = normalizeString(path, !isPathAbsolute);
|
|
30
|
+
if (path.length === 0) {
|
|
31
|
+
if (isPathAbsolute) {
|
|
32
|
+
return "/";
|
|
33
|
+
}
|
|
34
|
+
return trailingSeparator ? "./" : ".";
|
|
35
|
+
}
|
|
36
|
+
if (trailingSeparator) {
|
|
37
|
+
path += "/";
|
|
38
|
+
}
|
|
39
|
+
if (_DRIVE_LETTER_RE.test(path)) {
|
|
40
|
+
path += "/";
|
|
41
|
+
}
|
|
42
|
+
if (isUNCPath) {
|
|
43
|
+
if (!isPathAbsolute) {
|
|
44
|
+
return `//./${path}`;
|
|
45
|
+
}
|
|
46
|
+
return `//${path}`;
|
|
47
|
+
}
|
|
48
|
+
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
49
|
+
}, "correctPaths");
|
|
50
|
+
var joinPaths = /* @__PURE__ */ __name(function(...segments) {
|
|
51
|
+
let path = "";
|
|
52
|
+
for (const seg of segments) {
|
|
53
|
+
if (!seg) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (path.length > 0) {
|
|
57
|
+
const pathTrailing = path[path.length - 1] === "/";
|
|
58
|
+
const segLeading = seg[0] === "/";
|
|
59
|
+
const both = pathTrailing && segLeading;
|
|
60
|
+
if (both) {
|
|
61
|
+
path += seg.slice(1);
|
|
62
|
+
} else {
|
|
63
|
+
path += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
64
|
+
}
|
|
65
|
+
} else {
|
|
66
|
+
path += seg;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return correctPaths(path);
|
|
70
|
+
}, "joinPaths");
|
|
71
|
+
function cwd() {
|
|
72
|
+
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
73
|
+
return process.cwd().replace(/\\/g, "/");
|
|
74
|
+
}
|
|
75
|
+
return "/";
|
|
76
|
+
}
|
|
77
|
+
__name(cwd, "cwd");
|
|
78
|
+
var resolve = /* @__PURE__ */ __name(function(...arguments_) {
|
|
79
|
+
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
80
|
+
let resolvedPath = "";
|
|
81
|
+
let resolvedAbsolute = false;
|
|
82
|
+
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
83
|
+
const path = index >= 0 ? arguments_[index] : cwd();
|
|
84
|
+
if (!path || path.length === 0) {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
resolvedPath = `${path}/${resolvedPath}`;
|
|
88
|
+
resolvedAbsolute = isAbsolute(path);
|
|
89
|
+
}
|
|
90
|
+
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
91
|
+
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
|
|
92
|
+
return `/${resolvedPath}`;
|
|
93
|
+
}
|
|
94
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
95
|
+
}, "resolve");
|
|
96
|
+
function normalizeString(path, allowAboveRoot) {
|
|
97
|
+
let res = "";
|
|
98
|
+
let lastSegmentLength = 0;
|
|
99
|
+
let lastSlash = -1;
|
|
100
|
+
let dots = 0;
|
|
101
|
+
let char = null;
|
|
102
|
+
for (let index = 0; index <= path.length; ++index) {
|
|
103
|
+
if (index < path.length) {
|
|
104
|
+
char = path[index];
|
|
105
|
+
} else if (char === "/") {
|
|
106
|
+
break;
|
|
107
|
+
} else {
|
|
108
|
+
char = "/";
|
|
109
|
+
}
|
|
110
|
+
if (char === "/") {
|
|
111
|
+
if (lastSlash === index - 1 || dots === 1) {
|
|
112
|
+
} else if (dots === 2) {
|
|
113
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
114
|
+
if (res.length > 2) {
|
|
115
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
116
|
+
if (lastSlashIndex === -1) {
|
|
117
|
+
res = "";
|
|
118
|
+
lastSegmentLength = 0;
|
|
119
|
+
} else {
|
|
120
|
+
res = res.slice(0, lastSlashIndex);
|
|
121
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
122
|
+
}
|
|
123
|
+
lastSlash = index;
|
|
124
|
+
dots = 0;
|
|
125
|
+
continue;
|
|
126
|
+
} else if (res.length > 0) {
|
|
127
|
+
res = "";
|
|
128
|
+
lastSegmentLength = 0;
|
|
129
|
+
lastSlash = index;
|
|
130
|
+
dots = 0;
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (allowAboveRoot) {
|
|
135
|
+
res += res.length > 0 ? "/.." : "..";
|
|
136
|
+
lastSegmentLength = 2;
|
|
137
|
+
}
|
|
138
|
+
} else {
|
|
139
|
+
if (res.length > 0) {
|
|
140
|
+
res += `/${path.slice(lastSlash + 1, index)}`;
|
|
141
|
+
} else {
|
|
142
|
+
res = path.slice(lastSlash + 1, index);
|
|
143
|
+
}
|
|
144
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
145
|
+
}
|
|
146
|
+
lastSlash = index;
|
|
147
|
+
dots = 0;
|
|
148
|
+
} else if (char === "." && dots !== -1) {
|
|
149
|
+
++dots;
|
|
150
|
+
} else {
|
|
151
|
+
dots = -1;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return res;
|
|
155
|
+
}
|
|
156
|
+
__name(normalizeString, "normalizeString");
|
|
157
|
+
var isAbsolute = /* @__PURE__ */ __name(function(p) {
|
|
158
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
159
|
+
}, "isAbsolute");
|
|
160
|
+
var toNamespacedPath = /* @__PURE__ */ __name(function(p) {
|
|
161
|
+
return normalizeWindowsPath(p);
|
|
162
|
+
}, "toNamespacedPath");
|
|
163
|
+
var extname = /* @__PURE__ */ __name(function(p) {
|
|
164
|
+
if (p === "..") return "";
|
|
165
|
+
const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
|
|
166
|
+
return match && match[1] || "";
|
|
167
|
+
}, "extname");
|
|
168
|
+
var relative = /* @__PURE__ */ __name(function(from, to) {
|
|
169
|
+
const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
170
|
+
const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
171
|
+
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
|
|
172
|
+
return _to.join("/");
|
|
173
|
+
}
|
|
174
|
+
const _fromCopy = [
|
|
175
|
+
..._from
|
|
176
|
+
];
|
|
177
|
+
for (const segment of _fromCopy) {
|
|
178
|
+
if (_to[0] !== segment) {
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
_from.shift();
|
|
182
|
+
_to.shift();
|
|
183
|
+
}
|
|
184
|
+
return [
|
|
185
|
+
..._from.map(() => ".."),
|
|
186
|
+
..._to
|
|
187
|
+
].join("/");
|
|
188
|
+
}, "relative");
|
|
189
|
+
var dirname = /* @__PURE__ */ __name(function(p) {
|
|
190
|
+
const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
191
|
+
if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) {
|
|
192
|
+
segments[0] += "/";
|
|
193
|
+
}
|
|
194
|
+
return segments.join("/") || (isAbsolute(p) ? "/" : ".");
|
|
195
|
+
}, "dirname");
|
|
196
|
+
var format = /* @__PURE__ */ __name(function(p) {
|
|
197
|
+
const ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : "";
|
|
198
|
+
const segments = [
|
|
199
|
+
p.root,
|
|
200
|
+
p.dir,
|
|
201
|
+
p.base ?? (p.name ?? "") + ext
|
|
202
|
+
].filter(Boolean);
|
|
203
|
+
return normalizeWindowsPath(p.root ? resolve(...segments) : segments.join("/"));
|
|
204
|
+
}, "format");
|
|
205
|
+
var basename = /* @__PURE__ */ __name(function(p, extension) {
|
|
206
|
+
const segments = normalizeWindowsPath(p).split("/");
|
|
207
|
+
let lastSegment = "";
|
|
208
|
+
for (let i = segments.length - 1; i >= 0; i--) {
|
|
209
|
+
const val = segments[i];
|
|
210
|
+
if (val) {
|
|
211
|
+
lastSegment = val;
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
216
|
+
}, "basename");
|
|
217
|
+
var parse = /* @__PURE__ */ __name(function(p) {
|
|
218
|
+
const root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "";
|
|
219
|
+
const base = basename(p);
|
|
220
|
+
const extension = extname(base);
|
|
221
|
+
return {
|
|
222
|
+
root,
|
|
223
|
+
dir: dirname(p),
|
|
224
|
+
base,
|
|
225
|
+
ext: extension,
|
|
226
|
+
name: base.slice(0, base.length - extension.length)
|
|
227
|
+
};
|
|
228
|
+
}, "parse");
|
|
229
|
+
|
|
230
|
+
export {
|
|
231
|
+
normalizeWindowsPath,
|
|
232
|
+
sep,
|
|
233
|
+
correctPaths,
|
|
234
|
+
joinPaths,
|
|
235
|
+
resolve,
|
|
236
|
+
normalizeString,
|
|
237
|
+
isAbsolute,
|
|
238
|
+
toNamespacedPath,
|
|
239
|
+
extname,
|
|
240
|
+
relative,
|
|
241
|
+
dirname,
|
|
242
|
+
format,
|
|
243
|
+
basename,
|
|
244
|
+
parse
|
|
245
|
+
};
|
package/dist/preset.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Linter } from 'eslint';
|
|
2
2
|
import { FlatConfigComposer } from 'eslint-flat-config-utils';
|
|
3
|
-
import { O as OptionsConfig, R as RuleOptions, T as TypedFlatConfigItem, A as Awaitable, C as ConfigNames } from './types-
|
|
3
|
+
import { O as OptionsConfig, R as RuleOptions, T as TypedFlatConfigItem, A as Awaitable, C as ConfigNames } from './types-CqEOmL6d.js';
|
|
4
4
|
import '@nx/eslint-plugin/src/utils/runtime-lint-utils';
|
|
5
5
|
import '@stylistic/eslint-plugin';
|
|
6
6
|
import '@typescript-eslint/parser';
|
package/dist/preset.js
CHANGED
|
@@ -4,6 +4,9 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
banner_plugin_default
|
|
6
6
|
} from "./chunk-BXVDD33Y.js";
|
|
7
|
+
import {
|
|
8
|
+
joinPaths
|
|
9
|
+
} from "./chunk-G7QVU75O.js";
|
|
7
10
|
import "./chunk-KDHZD7SF.js";
|
|
8
11
|
import {
|
|
9
12
|
GLOB_ASTRO,
|
|
@@ -106,6 +109,36 @@ async function astro(options = {}) {
|
|
|
106
109
|
}
|
|
107
110
|
__name(astro, "astro");
|
|
108
111
|
|
|
112
|
+
// src/configs/cspell.ts
|
|
113
|
+
import cspellConfig from "@cspell/eslint-plugin/recommended";
|
|
114
|
+
async function cspell(options = {}) {
|
|
115
|
+
const { configFile = "./.vscode/cspell.json", overrides = {} } = options;
|
|
116
|
+
let workspaceConfigFile = configFile;
|
|
117
|
+
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
118
|
+
workspaceConfigFile = joinPaths(process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH || "./", configFile);
|
|
119
|
+
}
|
|
120
|
+
return [
|
|
121
|
+
{
|
|
122
|
+
name: "storm/cspell/rules",
|
|
123
|
+
...cspellConfig,
|
|
124
|
+
rules: {
|
|
125
|
+
...cspellConfig.rules,
|
|
126
|
+
"@cspell/spellchecker": [
|
|
127
|
+
"warn",
|
|
128
|
+
{
|
|
129
|
+
configFile: workspaceConfigFile,
|
|
130
|
+
generateSuggestions: true,
|
|
131
|
+
numSuggestions: 10,
|
|
132
|
+
autoFix: true
|
|
133
|
+
}
|
|
134
|
+
],
|
|
135
|
+
...overrides
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
];
|
|
139
|
+
}
|
|
140
|
+
__name(cspell, "cspell");
|
|
141
|
+
|
|
109
142
|
// src/configs/disables.ts
|
|
110
143
|
async function disables() {
|
|
111
144
|
return [
|
|
@@ -237,6 +270,13 @@ async function stylistic(options = {}) {
|
|
|
237
270
|
"error",
|
|
238
271
|
quotes === "single" ? "prefer-single" : "prefer-double"
|
|
239
272
|
],
|
|
273
|
+
"style/brace-style": [
|
|
274
|
+
"error",
|
|
275
|
+
"1tbs",
|
|
276
|
+
{
|
|
277
|
+
allowSingleLine: false
|
|
278
|
+
}
|
|
279
|
+
],
|
|
240
280
|
...overrides
|
|
241
281
|
}
|
|
242
282
|
}
|
|
@@ -519,19 +559,15 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
519
559
|
__name(formatters, "formatters");
|
|
520
560
|
|
|
521
561
|
// src/configs/graphql.ts
|
|
522
|
-
import { FlatCompat } from "@eslint/eslintrc";
|
|
523
|
-
var compat = new FlatCompat({
|
|
524
|
-
// import.meta.dirname is available after Node.js v20.11.0
|
|
525
|
-
baseDirectory: import.meta.dirname
|
|
526
|
-
});
|
|
527
562
|
async function graphql(options = {}) {
|
|
528
563
|
const { relay = true, operations = true, schema = true, overrides = {} } = options;
|
|
529
564
|
await ensurePackages([
|
|
530
565
|
"@graphql-eslint/eslint-plugin",
|
|
531
566
|
"eslint-plugin-relay"
|
|
532
567
|
]);
|
|
533
|
-
const [pluginGraphQL] = await Promise.all([
|
|
534
|
-
interopDefault(import("@graphql-eslint/eslint-plugin"))
|
|
568
|
+
const [pluginGraphQL, pluginRelay] = await Promise.all([
|
|
569
|
+
interopDefault(import("@graphql-eslint/eslint-plugin")),
|
|
570
|
+
interopDefault(import("eslint-plugin-relay"))
|
|
535
571
|
]);
|
|
536
572
|
return [
|
|
537
573
|
{
|
|
@@ -719,14 +755,11 @@ async function graphql(options = {}) {
|
|
|
719
755
|
...overrides
|
|
720
756
|
}
|
|
721
757
|
},
|
|
722
|
-
|
|
758
|
+
relay ? {
|
|
723
759
|
name: "storm/graphql/relay",
|
|
724
|
-
plugins:
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
extends: [
|
|
728
|
-
"plugin:relay/ts-recommended"
|
|
729
|
-
],
|
|
760
|
+
plugins: {
|
|
761
|
+
relay: pluginRelay
|
|
762
|
+
},
|
|
730
763
|
rules: {
|
|
731
764
|
// errors
|
|
732
765
|
"relay/graphql-syntax": "error",
|
|
@@ -745,7 +778,7 @@ async function graphql(options = {}) {
|
|
|
745
778
|
"@graphql-eslint/relay-edge-types": "error",
|
|
746
779
|
"@graphql-eslint/relay-page-info": "error"
|
|
747
780
|
}
|
|
748
|
-
}
|
|
781
|
+
} : {}
|
|
749
782
|
];
|
|
750
783
|
}
|
|
751
784
|
__name(graphql, "graphql");
|
|
@@ -812,7 +845,7 @@ __name(imports, "imports");
|
|
|
812
845
|
import defu2 from "defu";
|
|
813
846
|
import globalsLib from "globals";
|
|
814
847
|
async function javascript(options = {}) {
|
|
815
|
-
const {
|
|
848
|
+
const { lineEndings = "unix", overrides = {}, name = "", globals = {} } = options;
|
|
816
849
|
return [
|
|
817
850
|
{
|
|
818
851
|
name: "storm/javascript/setup",
|
|
@@ -2412,23 +2445,51 @@ async function markdown(options = {}) {
|
|
|
2412
2445
|
}
|
|
2413
2446
|
__name(markdown, "markdown");
|
|
2414
2447
|
|
|
2448
|
+
// src/configs/mdx.ts
|
|
2449
|
+
async function mdx(options = {}) {
|
|
2450
|
+
const { files = [
|
|
2451
|
+
GLOB_MDX
|
|
2452
|
+
], overrides = {} } = options;
|
|
2453
|
+
await ensurePackages([
|
|
2454
|
+
"eslint-plugin-mdx"
|
|
2455
|
+
]);
|
|
2456
|
+
const mdx1 = await interopDefault(import("eslint-plugin-mdx"));
|
|
2457
|
+
return [
|
|
2458
|
+
{
|
|
2459
|
+
name: "storm/mdx/setup",
|
|
2460
|
+
plugins: {
|
|
2461
|
+
mdx: mdx1
|
|
2462
|
+
},
|
|
2463
|
+
...mdx1.flat,
|
|
2464
|
+
files,
|
|
2465
|
+
processor: mdx1.createRemarkProcessor({
|
|
2466
|
+
lintCodeBlocks: true,
|
|
2467
|
+
// optional, if you want to disable language mapper, set it to `false`
|
|
2468
|
+
// if you want to override the default language mapper inside, you can provide your own
|
|
2469
|
+
languageMapper: {}
|
|
2470
|
+
}),
|
|
2471
|
+
rules: {
|
|
2472
|
+
...mdx1.flat.rules,
|
|
2473
|
+
...overrides
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
];
|
|
2477
|
+
}
|
|
2478
|
+
__name(mdx, "mdx");
|
|
2479
|
+
|
|
2415
2480
|
// src/configs/next.ts
|
|
2416
|
-
import { FlatCompat as FlatCompat2 } from "@eslint/eslintrc";
|
|
2417
|
-
var compat2 = new FlatCompat2({
|
|
2418
|
-
// import.meta.dirname is available after Node.js v20.11.0
|
|
2419
|
-
baseDirectory: import.meta.dirname
|
|
2420
|
-
});
|
|
2421
2481
|
async function next(options = {}) {
|
|
2422
2482
|
const { coreWebVitals = true, rootDir } = options;
|
|
2423
2483
|
await ensurePackages([
|
|
2424
2484
|
"@next/eslint-plugin-next"
|
|
2425
2485
|
]);
|
|
2486
|
+
const pluginNext = await interopDefault(import("@next/eslint-plugin-next"));
|
|
2426
2487
|
return [
|
|
2427
|
-
|
|
2488
|
+
{
|
|
2428
2489
|
name: "storm/next/rules",
|
|
2429
|
-
|
|
2430
|
-
"next"
|
|
2431
|
-
|
|
2490
|
+
plugins: {
|
|
2491
|
+
"@next/next": pluginNext
|
|
2492
|
+
},
|
|
2432
2493
|
settings: {
|
|
2433
2494
|
next: {
|
|
2434
2495
|
rootDir
|
|
@@ -2464,7 +2525,7 @@ async function next(options = {}) {
|
|
|
2464
2525
|
"@next/next/no-sync-scripts": "error"
|
|
2465
2526
|
} : {}
|
|
2466
2527
|
}
|
|
2467
|
-
}
|
|
2528
|
+
}
|
|
2468
2529
|
];
|
|
2469
2530
|
}
|
|
2470
2531
|
__name(next, "next");
|
|
@@ -2555,7 +2616,7 @@ async function nx(options = {}) {
|
|
|
2555
2616
|
"**/*.js",
|
|
2556
2617
|
"**/*.jsx"
|
|
2557
2618
|
],
|
|
2558
|
-
rules: {
|
|
2619
|
+
rules: moduleBoundaries !== false ? {
|
|
2559
2620
|
"@nx/enforce-module-boundaries": [
|
|
2560
2621
|
"error",
|
|
2561
2622
|
moduleBoundaries ?? {
|
|
@@ -2574,7 +2635,7 @@ async function nx(options = {}) {
|
|
|
2574
2635
|
]
|
|
2575
2636
|
}
|
|
2576
2637
|
]
|
|
2577
|
-
}
|
|
2638
|
+
} : {}
|
|
2578
2639
|
}
|
|
2579
2640
|
];
|
|
2580
2641
|
}
|
|
@@ -2826,6 +2887,31 @@ async function react(options = {}) {
|
|
|
2826
2887
|
}
|
|
2827
2888
|
__name(react, "react");
|
|
2828
2889
|
|
|
2890
|
+
// src/configs/react-native.ts
|
|
2891
|
+
async function reactNative(options = {}) {
|
|
2892
|
+
const { overrides = {} } = options;
|
|
2893
|
+
await ensurePackages([
|
|
2894
|
+
"eslint-plugin-react-native"
|
|
2895
|
+
]);
|
|
2896
|
+
const reactNative1 = await interopDefault(
|
|
2897
|
+
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
2898
|
+
import("eslint-plugin-react-native")
|
|
2899
|
+
);
|
|
2900
|
+
return [
|
|
2901
|
+
{
|
|
2902
|
+
name: "storm/react-native/rules",
|
|
2903
|
+
plugins: {
|
|
2904
|
+
"react-native": reactNative1
|
|
2905
|
+
},
|
|
2906
|
+
rules: {
|
|
2907
|
+
...reactNative1.configs.all.rules,
|
|
2908
|
+
...overrides
|
|
2909
|
+
}
|
|
2910
|
+
}
|
|
2911
|
+
];
|
|
2912
|
+
}
|
|
2913
|
+
__name(reactNative, "reactNative");
|
|
2914
|
+
|
|
2829
2915
|
// src/configs/regexp.ts
|
|
2830
2916
|
import { configs } from "eslint-plugin-regexp";
|
|
2831
2917
|
async function regexp(options = {}) {
|
|
@@ -2858,6 +2944,38 @@ async function regexp(options = {}) {
|
|
|
2858
2944
|
}
|
|
2859
2945
|
__name(regexp, "regexp");
|
|
2860
2946
|
|
|
2947
|
+
// src/configs/secrets.ts
|
|
2948
|
+
async function secrets(options) {
|
|
2949
|
+
const { json = true } = options;
|
|
2950
|
+
if (json) {
|
|
2951
|
+
await ensurePackages([
|
|
2952
|
+
"eslint-plugin-jsonc"
|
|
2953
|
+
]);
|
|
2954
|
+
}
|
|
2955
|
+
return [
|
|
2956
|
+
{
|
|
2957
|
+
name: "storm/secrets/rules",
|
|
2958
|
+
files: [
|
|
2959
|
+
`**/*.{js,ts,jsx,tsx${json ? ",json,jsonc" : ""}`
|
|
2960
|
+
],
|
|
2961
|
+
plugins: {
|
|
2962
|
+
"no-secrets": default5
|
|
2963
|
+
},
|
|
2964
|
+
rules: {
|
|
2965
|
+
"no-secrets/no-secrets": [
|
|
2966
|
+
"error",
|
|
2967
|
+
{
|
|
2968
|
+
ignoreIdentifiers: [
|
|
2969
|
+
"nxCloudId"
|
|
2970
|
+
]
|
|
2971
|
+
}
|
|
2972
|
+
]
|
|
2973
|
+
}
|
|
2974
|
+
}
|
|
2975
|
+
];
|
|
2976
|
+
}
|
|
2977
|
+
__name(secrets, "secrets");
|
|
2978
|
+
|
|
2861
2979
|
// src/configs/sort.ts
|
|
2862
2980
|
async function sortPackageJson() {
|
|
2863
2981
|
return [
|
|
@@ -3273,7 +3391,7 @@ async function toml(options = {}) {
|
|
|
3273
3391
|
__name(toml, "toml");
|
|
3274
3392
|
|
|
3275
3393
|
// src/configs/typescript.ts
|
|
3276
|
-
import
|
|
3394
|
+
import process2 from "node:process";
|
|
3277
3395
|
async function typescript(options = {}) {
|
|
3278
3396
|
const { componentExts = [], overrides = {}, overridesTypeAware = {}, parserOptions = {}, type = "app" } = options;
|
|
3279
3397
|
const files = options.files ?? [
|
|
@@ -3355,7 +3473,7 @@ async function typescript(options = {}) {
|
|
|
3355
3473
|
],
|
|
3356
3474
|
defaultProject: tsconfigPath
|
|
3357
3475
|
},
|
|
3358
|
-
tsconfigRootDir:
|
|
3476
|
+
tsconfigRootDir: process2.cwd()
|
|
3359
3477
|
} : {},
|
|
3360
3478
|
...parserOptions
|
|
3361
3479
|
}
|
|
@@ -3685,138 +3803,6 @@ async function yaml(options = {}) {
|
|
|
3685
3803
|
}
|
|
3686
3804
|
__name(yaml, "yaml");
|
|
3687
3805
|
|
|
3688
|
-
// src/configs/cspell.ts
|
|
3689
|
-
import cspellConfig from "@cspell/eslint-plugin/recommended";
|
|
3690
|
-
import { findWorkspaceRoot, joinPaths } from "@storm-software/config-tools";
|
|
3691
|
-
async function cspell(options = {}) {
|
|
3692
|
-
const { configFile = "./.vscode/cspell.json", overrides = {} } = options;
|
|
3693
|
-
return [
|
|
3694
|
-
{
|
|
3695
|
-
name: "storm/cspell/rules",
|
|
3696
|
-
...cspellConfig,
|
|
3697
|
-
rules: {
|
|
3698
|
-
...cspellConfig.rules,
|
|
3699
|
-
"@cspell/spellchecker": [
|
|
3700
|
-
"warn",
|
|
3701
|
-
{
|
|
3702
|
-
configFile: joinPaths(findWorkspaceRoot(), configFile),
|
|
3703
|
-
autoFix: true
|
|
3704
|
-
}
|
|
3705
|
-
],
|
|
3706
|
-
...overrides
|
|
3707
|
-
}
|
|
3708
|
-
}
|
|
3709
|
-
];
|
|
3710
|
-
}
|
|
3711
|
-
__name(cspell, "cspell");
|
|
3712
|
-
|
|
3713
|
-
// src/configs/mdx.ts
|
|
3714
|
-
async function mdx(options = {}) {
|
|
3715
|
-
const { files = [
|
|
3716
|
-
GLOB_MDX
|
|
3717
|
-
], overrides = {} } = options;
|
|
3718
|
-
await ensurePackages([
|
|
3719
|
-
"eslint-plugin-mdx"
|
|
3720
|
-
]);
|
|
3721
|
-
const mdx1 = await interopDefault(import("eslint-plugin-mdx"));
|
|
3722
|
-
return [
|
|
3723
|
-
{
|
|
3724
|
-
name: "storm/mdx/setup",
|
|
3725
|
-
plugins: {
|
|
3726
|
-
mdx: mdx1
|
|
3727
|
-
},
|
|
3728
|
-
...mdx1.flat,
|
|
3729
|
-
files,
|
|
3730
|
-
processor: mdx1.createRemarkProcessor({
|
|
3731
|
-
lintCodeBlocks: true,
|
|
3732
|
-
// optional, if you want to disable language mapper, set it to `false`
|
|
3733
|
-
// if you want to override the default language mapper inside, you can provide your own
|
|
3734
|
-
languageMapper: {}
|
|
3735
|
-
}),
|
|
3736
|
-
rules: {
|
|
3737
|
-
...mdx1.flat.rules,
|
|
3738
|
-
...overrides
|
|
3739
|
-
}
|
|
3740
|
-
}
|
|
3741
|
-
];
|
|
3742
|
-
}
|
|
3743
|
-
__name(mdx, "mdx");
|
|
3744
|
-
|
|
3745
|
-
// src/configs/react-native.ts
|
|
3746
|
-
import { FlatCompat as FlatCompat3 } from "@eslint/eslintrc";
|
|
3747
|
-
var compat3 = new FlatCompat3({
|
|
3748
|
-
// import.meta.dirname is available after Node.js v20.11.0
|
|
3749
|
-
baseDirectory: import.meta.dirname
|
|
3750
|
-
});
|
|
3751
|
-
async function reactNative(options = {}) {
|
|
3752
|
-
const { overrides = {} } = options;
|
|
3753
|
-
await ensurePackages([
|
|
3754
|
-
"eslint-plugin-react-native"
|
|
3755
|
-
]);
|
|
3756
|
-
const reactNative1 = await interopDefault(
|
|
3757
|
-
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
3758
|
-
import("eslint-plugin-react-native")
|
|
3759
|
-
);
|
|
3760
|
-
return [
|
|
3761
|
-
...compat3.config({
|
|
3762
|
-
name: "storm/react-native/rules",
|
|
3763
|
-
parserOptions: {
|
|
3764
|
-
ecmaFeatures: {
|
|
3765
|
-
"jsx": true
|
|
3766
|
-
}
|
|
3767
|
-
},
|
|
3768
|
-
env: {
|
|
3769
|
-
"react-native/react-native": true
|
|
3770
|
-
},
|
|
3771
|
-
plugins: [
|
|
3772
|
-
"react-native"
|
|
3773
|
-
],
|
|
3774
|
-
extends: [
|
|
3775
|
-
"plugin:react-native/all"
|
|
3776
|
-
],
|
|
3777
|
-
rules: {
|
|
3778
|
-
...reactNative1.configs.all.rules,
|
|
3779
|
-
...overrides
|
|
3780
|
-
}
|
|
3781
|
-
})
|
|
3782
|
-
];
|
|
3783
|
-
}
|
|
3784
|
-
__name(reactNative, "reactNative");
|
|
3785
|
-
|
|
3786
|
-
// src/configs/secrets.ts
|
|
3787
|
-
async function secrets(options) {
|
|
3788
|
-
const { json = true } = options;
|
|
3789
|
-
await ensurePackages([
|
|
3790
|
-
"eslint-plugin-jsonc"
|
|
3791
|
-
]);
|
|
3792
|
-
const [pluginJsonc] = await Promise.all([
|
|
3793
|
-
interopDefault(import("eslint-plugin-jsonc"))
|
|
3794
|
-
]);
|
|
3795
|
-
return [
|
|
3796
|
-
...json ? pluginJsonc.configs["flat/recommended-with-jsonc"] : [],
|
|
3797
|
-
{
|
|
3798
|
-
name: "storm/secrets/rules",
|
|
3799
|
-
files: [
|
|
3800
|
-
`**/*.{js,ts,jsx,tsx${json ? ",json,jsonc" : ""}`
|
|
3801
|
-
],
|
|
3802
|
-
plugins: {
|
|
3803
|
-
"no-secrets": default5
|
|
3804
|
-
},
|
|
3805
|
-
rules: {
|
|
3806
|
-
"no-secrets/no-secrets": [
|
|
3807
|
-
"error",
|
|
3808
|
-
{
|
|
3809
|
-
"ignoreIdentifiers": [
|
|
3810
|
-
"nxCloudId"
|
|
3811
|
-
]
|
|
3812
|
-
}
|
|
3813
|
-
]
|
|
3814
|
-
}
|
|
3815
|
-
}
|
|
3816
|
-
];
|
|
3817
|
-
}
|
|
3818
|
-
__name(secrets, "secrets");
|
|
3819
|
-
|
|
3820
3806
|
// src/preset.ts
|
|
3821
3807
|
var flatConfigProps = [
|
|
3822
3808
|
"name",
|