@storm-software/eslint 0.170.67 → 0.170.69

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.
Files changed (44) hide show
  1. package/README.md +1 -1
  2. package/dist/{chunk-Z2ZFJBUD.js → chunk-C74DAXLP.js} +0 -2
  3. package/dist/{chunk-WEPTDP5X.js → chunk-DMZFJCWX.js} +2 -5
  4. package/dist/{chunk-ZZRQVLBJ.js → chunk-RU7GXBCG.js} +0 -3
  5. package/dist/chunk-WBEFFLSU.js +13 -0
  6. package/dist/{chunk-EIPIQB5E.js → chunk-WYU7W4UW.js} +1 -4
  7. package/dist/preset.cjs +14708 -16062
  8. package/dist/preset.d.cts +1 -0
  9. package/dist/preset.d.ts +1 -0
  10. package/dist/preset.js +14549 -15253
  11. package/dist/types.d.cts +29 -31
  12. package/dist/types.d.ts +29 -31
  13. package/dist/types.js +1 -4
  14. package/dist/utils/combine.d.cts +1 -0
  15. package/dist/utils/combine.d.ts +1 -0
  16. package/dist/utils/combine.js +1 -2
  17. package/dist/utils/correct-paths.js +2 -2
  18. package/dist/utils/find-workspace-root.js +3 -3
  19. package/dist/utils/format-config.js +20 -2
  20. package/dist/utils/helpers.cjs +1 -1
  21. package/dist/utils/helpers.js +2 -2
  22. package/dist/utils/tsconfig-path.js +4 -4
  23. package/package.json +12 -11
  24. package/dist/chunk-2FWJ22PW.js +0 -349
  25. package/dist/chunk-LRVZTK6Y.js +0 -21
  26. package/dist/chunk-QO5ZXGIE.js +0 -46
  27. package/dist/chunk-UVAZFUOB.js +0 -62
  28. package/dist/chunk-WHUEAYCR.js +0 -236
  29. package/dist/utils/banner-plugin.cjs +0 -458
  30. package/dist/utils/banner-plugin.d.cts +0 -6
  31. package/dist/utils/banner-plugin.d.ts +0 -6
  32. package/dist/utils/banner-plugin.js +0 -4
  33. package/dist/utils/constants.cjs +0 -315
  34. package/dist/utils/constants.d.cts +0 -83
  35. package/dist/utils/constants.d.ts +0 -83
  36. package/dist/utils/constants.js +0 -2
  37. package/dist/utils/get-file-banner.cjs +0 -103
  38. package/dist/utils/get-file-banner.d.cts +0 -12
  39. package/dist/utils/get-file-banner.d.ts +0 -12
  40. package/dist/utils/get-file-banner.js +0 -3
  41. package/dist/utils/index.cjs +0 -333
  42. package/dist/utils/index.d.cts +0 -3
  43. package/dist/utils/index.d.ts +0 -3
  44. package/dist/utils/index.js +0 -6
@@ -1,349 +0,0 @@
1
- import { getFileBanner } from './chunk-UVAZFUOB.js';
2
- import { GLOB_SRC } from './chunk-WHUEAYCR.js';
3
- import { init_esm_shims } from './chunk-QO5ZXGIE.js';
4
- import { ESLintUtils } from '@typescript-eslint/utils';
5
- import os from 'node:os';
6
-
7
- // src/utils/banner-plugin.ts
8
- init_esm_shims();
9
- function match(actual, expected) {
10
- if (expected.test) {
11
- return expected.test(actual);
12
- } else {
13
- return expected === actual;
14
- }
15
- }
16
- function excludeShebangs(comments) {
17
- return comments.filter((comment) => {
18
- return comment.type !== "Shebang";
19
- });
20
- }
21
- function getLeadingComments(context, node) {
22
- const all = excludeShebangs(
23
- context.getSourceCode().getAllComments(node.body.length ? node.body[0] : node)
24
- );
25
- if (all[0].type.toLowerCase() === "block") {
26
- return [all[0]];
27
- }
28
- let i = 1;
29
- for (i = 1; i < all.length; ++i) {
30
- const txt = context.getSourceCode().getText().slice(all[i - 1].range[1], all[i].range[0]);
31
- if (!txt.match(/^(\r\n|\r|\n)$/)) {
32
- break;
33
- }
34
- }
35
- return all.slice(0, i);
36
- }
37
- function genCommentBody(commentType, textArray, eol, numNewlines) {
38
- const eols = eol.repeat(numNewlines);
39
- if (commentType === "block") {
40
- return "/*" + textArray.join(eol) + "*/" + eols;
41
- } else {
42
- return "//" + textArray.join(eol + "//") + eols;
43
- }
44
- }
45
- function genCommentsRange(context, comments, eol) {
46
- const start = comments[0].range[0];
47
- let end = comments.slice(-1)[0].range[1];
48
- if (context.getSourceCode().text[end] === eol) {
49
- end += eol.length;
50
- }
51
- return [start, end];
52
- }
53
- function genPrependFixer(commentType, node, bannerLines, eol, numNewlines) {
54
- return function(fixer) {
55
- return fixer.insertTextBefore(
56
- node,
57
- genCommentBody(commentType, bannerLines, eol, numNewlines)
58
- );
59
- };
60
- }
61
- function genReplaceFixer(commentType, context, leadingComments, bannerLines, eol, numNewlines) {
62
- return function(fixer) {
63
- return fixer.replaceTextRange(
64
- genCommentsRange(context, leadingComments, eol),
65
- genCommentBody(commentType, bannerLines, eol, numNewlines)
66
- );
67
- };
68
- }
69
- function getEOL(options) {
70
- if (options.lineEndings === "unix") {
71
- return "\n";
72
- }
73
- if (options.lineEndings === "windows") {
74
- return "\r\n";
75
- }
76
- return os.EOL;
77
- }
78
- function hasBanner(commentType = "block", src, eol) {
79
- if (src.startsWith("#!")) {
80
- const bannerLines = src.split(eol);
81
- if (bannerLines && bannerLines.length > 1) {
82
- bannerLines.shift();
83
- while (bannerLines.length && bannerLines[0] && !bannerLines[0].trim()) {
84
- bannerLines.shift();
85
- }
86
- if (bannerLines.length) {
87
- src = bannerLines.join(eol);
88
- } else {
89
- return false;
90
- }
91
- }
92
- }
93
- return commentType === "block" && src.startsWith("/*") || commentType === "line" && src.startsWith("//") || commentType !== "block" && commentType !== "line" && commentType && src.startsWith(commentType);
94
- }
95
- function matchesLineEndings(src, num) {
96
- for (let j = 0; j < num; ++j) {
97
- const m = src.match(/^(\r\n|\r|\n)/);
98
- if (m) {
99
- src = src.slice(m.index + m[0].length);
100
- } else {
101
- return false;
102
- }
103
- }
104
- return true;
105
- }
106
- var bannerRule = ESLintUtils.RuleCreator(
107
- () => `https://developer.stormsoftware.com/eslint/rules/banner`
108
- )({
109
- name: "banner",
110
- meta: {
111
- docs: {
112
- description: "Ensures the file has a organization specific banner at the top of source code files"
113
- },
114
- schema: [
115
- {
116
- type: "object",
117
- properties: {
118
- banner: {
119
- type: "string",
120
- description: "The banner to enforce at the top of the file. If not provided, the banner will be read from the file specified in the commentStart option"
121
- },
122
- name: {
123
- type: "string",
124
- description: "The name of the repository to use when reading the banner from a file."
125
- },
126
- commentType: {
127
- type: "string",
128
- description: "The comment token to use for the banner. Defaults to block ('/* <banner> */')"
129
- },
130
- numNewlines: {
131
- type: "number",
132
- description: "The number of newlines to use after the banner. Defaults to 1"
133
- },
134
- lineEndings: {
135
- type: "string",
136
- enum: ["unix", "windows"],
137
- description: "The type of line endings to use. Defaults to the system default"
138
- }
139
- },
140
- additionalProperties: false
141
- }
142
- ],
143
- type: "layout",
144
- messages: {
145
- missingBanner: "Missing banner",
146
- incorrectComment: "Banner should use the {{commentType}} comment type",
147
- incorrectBanner: "Incorrect banner",
148
- noNewlineAfterBanner: "No newline after banner"
149
- },
150
- fixable: "whitespace"
151
- },
152
- defaultOptions: [
153
- {
154
- name: "",
155
- commentType: "block",
156
- numNewlines: 2,
157
- lineEndings: "unix"
158
- }
159
- ],
160
- create(context, [
161
- {
162
- banner,
163
- name = "",
164
- commentType = "block",
165
- numNewlines = 2,
166
- lineEndings = "unix"
167
- }
168
- ]) {
169
- if (!banner) {
170
- banner = getFileBanner(name);
171
- }
172
- const options = context.options;
173
- const eol = getEOL({ lineEndings, ...options });
174
- const bannerLines = banner.split(/\r?\n/);
175
- let fixLines = bannerLines;
176
- return {
177
- Program: function(node) {
178
- if (!hasBanner(commentType, context.sourceCode.getText(), eol)) {
179
- context.report({
180
- loc: node.loc,
181
- messageId: "missingBanner",
182
- fix: genPrependFixer(commentType, node, fixLines, eol, numNewlines)
183
- });
184
- } else {
185
- const leadingComments = getLeadingComments(context, node);
186
- if (!leadingComments.length) {
187
- context.report({
188
- loc: node.loc,
189
- messageId: "missingBanner",
190
- fix: genPrependFixer(commentType, node, fixLines, eol, numNewlines)
191
- });
192
- } else if (leadingComments[0].type.toLowerCase() !== commentType) {
193
- context.report({
194
- loc: node.loc,
195
- messageId: "incorrectComment",
196
- data: {
197
- commentType
198
- },
199
- fix: genReplaceFixer(
200
- commentType,
201
- context,
202
- leadingComments,
203
- fixLines,
204
- eol,
205
- numNewlines
206
- )
207
- });
208
- } else {
209
- if (commentType === "line") {
210
- if (leadingComments.length < bannerLines.length) {
211
- context.report({
212
- loc: node.loc,
213
- messageId: "missingBanner",
214
- fix: genReplaceFixer(
215
- commentType,
216
- context,
217
- leadingComments,
218
- fixLines,
219
- eol,
220
- numNewlines
221
- )
222
- });
223
- return;
224
- }
225
- for (let i = 0; i < bannerLines.length; i++) {
226
- if (!match(leadingComments[i].value, bannerLines[i])) {
227
- context.report({
228
- loc: node.loc,
229
- messageId: "incorrectBanner",
230
- fix: genReplaceFixer(
231
- commentType,
232
- context,
233
- leadingComments,
234
- fixLines,
235
- eol,
236
- numNewlines
237
- )
238
- });
239
- return;
240
- }
241
- }
242
- const postLineBanner = context.getSourceCode().text.substr(
243
- leadingComments[bannerLines.length - 1].range[1],
244
- (numNewlines ?? 1) * 2
245
- );
246
- if (!matchesLineEndings(postLineBanner, numNewlines)) {
247
- context.report({
248
- loc: node.loc,
249
- messageId: "noNewlineAfterBanner",
250
- fix: genReplaceFixer(
251
- commentType,
252
- context,
253
- leadingComments,
254
- fixLines,
255
- eol,
256
- numNewlines
257
- )
258
- });
259
- }
260
- } else {
261
- let leadingLines = [leadingComments[0].value];
262
- if (bannerLines.length > 1) {
263
- leadingLines = leadingComments[0].value.split(/\r?\n/);
264
- }
265
- let hasError = false;
266
- if (leadingLines.length > bannerLines.length) {
267
- hasError = true;
268
- }
269
- for (let i = 0; !hasError && i < bannerLines.length; i++) {
270
- if (!match(leadingLines[i], bannerLines[i])) {
271
- hasError = true;
272
- }
273
- }
274
- if (hasError) {
275
- if (bannerLines.length > 1) {
276
- fixLines = [fixLines.join(eol)];
277
- }
278
- context.report({
279
- loc: node.loc,
280
- messageId: "incorrectBanner",
281
- fix: genReplaceFixer(
282
- commentType,
283
- context,
284
- leadingComments,
285
- fixLines,
286
- eol,
287
- numNewlines
288
- )
289
- });
290
- } else {
291
- const postBlockBanner = context.getSourceCode().text.substr(
292
- leadingComments[0].range[1],
293
- (numNewlines ?? 1) * 2
294
- );
295
- if (!matchesLineEndings(postBlockBanner, numNewlines)) {
296
- context.report({
297
- loc: node.loc,
298
- messageId: "noNewlineAfterBanner",
299
- fix: genReplaceFixer(
300
- commentType,
301
- context,
302
- leadingComments,
303
- fixLines,
304
- eol,
305
- numNewlines
306
- )
307
- });
308
- }
309
- }
310
- }
311
- }
312
- }
313
- }
314
- };
315
- }
316
- });
317
- var plugin = {
318
- meta: {
319
- name: "eslint-plugin-banner",
320
- version: "0.0.1"
321
- },
322
- configs: {},
323
- rules: {
324
- banner: bannerRule
325
- },
326
- processors: {}
327
- };
328
- plugin.configs && (plugin.configs.recommended = {
329
- name: "banner/recommended",
330
- plugins: { banner: plugin },
331
- files: [GLOB_SRC],
332
- ignores: [
333
- "!**/docs/**/*",
334
- "!**/crates/**/*",
335
- "!**/tmp/**/*",
336
- "!**/dist/**/*",
337
- "!**/coverage/**/*",
338
- "!**/node_modules/**/*",
339
- "!**/.cache/**/*",
340
- "!**/.nx/**/*",
341
- "!**/.storm/**/*"
342
- ],
343
- rules: {
344
- "banner/banner": ["error", { commentType: "block", numNewlines: 2 }]
345
- }
346
- });
347
- var banner_plugin_default = plugin;
348
-
349
- export { banner_plugin_default };
@@ -1,21 +0,0 @@
1
- import { init_esm_shims } from './chunk-QO5ZXGIE.js';
2
-
3
- // src/utils/format-config.ts
4
- init_esm_shims();
5
- var formatConfig = (name, config = []) => {
6
- return config.map((config2, index) => {
7
- if (!config2 || config2.name) {
8
- return config2 ?? {};
9
- }
10
- return {
11
- ...config2,
12
- name: `Storm Software (${config2.name ? config2.name : name}) #${index + 1}`,
13
- settings: {
14
- "import/resolver": "node",
15
- ...config2.settings ?? {}
16
- }
17
- };
18
- });
19
- };
20
-
21
- export { formatConfig };
@@ -1,46 +0,0 @@
1
- import { fileURLToPath } from 'url';
2
- import 'path';
3
-
4
- var __create = Object.create;
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
11
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
12
- }) : x)(function(x) {
13
- if (typeof require !== "undefined") return require.apply(this, arguments);
14
- throw Error('Dynamic require of "' + x + '" is not supported');
15
- });
16
- var __esm = (fn, res) => function __init() {
17
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
18
- };
19
- var __commonJS = (cb, mod) => function __require2() {
20
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
21
- };
22
- var __copyProps = (to, from, except, desc) => {
23
- if (from && typeof from === "object" || typeof from === "function") {
24
- for (let key of __getOwnPropNames(from))
25
- if (!__hasOwnProp.call(to, key) && key !== except)
26
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
27
- }
28
- return to;
29
- };
30
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
31
- // If the importer is in node compatibility mode or this is not an ESM
32
- // file that has been converted to a CommonJS file using a Babel-
33
- // compatible transform (i.e. "__esModule" has not been set), then set
34
- // "default" to the CommonJS "module.exports" for node compatibility.
35
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
36
- mod
37
- ));
38
- var getFilename, __filename$1;
39
- var init_esm_shims = __esm({
40
- "../../node_modules/.pnpm/tsup@8.4.0_patch_hash=751a554d775c3572381af4e7e5fa22eeda6dd6856012fb1cf521d6806eb2dc74__c6e5a1ff3e71b7415dce15be46368d04/node_modules/tsup/assets/esm_shims.js"() {
41
- getFilename = () => fileURLToPath(import.meta.url);
42
- __filename$1 = /* @__PURE__ */ getFilename();
43
- }
44
- });
45
-
46
- export { __commonJS, __filename$1 as __filename, __require, __toESM, init_esm_shims };
@@ -1,62 +0,0 @@
1
- import { ACRONYMS_LIST } from './chunk-WHUEAYCR.js';
2
- import { init_esm_shims } from './chunk-QO5ZXGIE.js';
3
-
4
- // src/utils/get-file-banner.ts
5
- init_esm_shims();
6
- var getFileBanner = (name = "", workspaceConfig) => {
7
- if (!name) {
8
- name = process.env.STORM_NAME || "";
9
- }
10
- let padding = " ";
11
- for (let i = 0; i < name.length + 2 && padding.length > 4; i++) {
12
- padding = padding.slice(0, -1);
13
- }
14
- let titleName = name || workspaceConfig?.name;
15
- if (titleName) {
16
- if (titleName?.startsWith("@")) {
17
- titleName = titleName.slice(1);
18
- }
19
- titleName = (titleName.charAt(0).toUpperCase() + titleName.slice(1)).split("-").filter((word) => word && word.length > 0).map((word) => {
20
- if (ACRONYMS_LIST.includes(word.toUpperCase())) {
21
- return word.toUpperCase();
22
- }
23
- return word.charAt(0).toUpperCase() + word.slice(1);
24
- }).join(" ");
25
- }
26
- const license = (process.env.STORM_LICENSE || workspaceConfig?.license || "Apache-2.0").split(" ").filter((word) => word && word.toLowerCase() !== "license").join(" ");
27
- const organization = process.env.STORM_ORG_NAME || process.env.STORM_ORGANIZATION_NAME || process.env.STORM_ORG || process.env.STORM_ORGANIZATION || (workspaceConfig?.organization && (typeof workspaceConfig.organization === "string" || typeof workspaceConfig.organization.name === "string") ? typeof workspaceConfig.organization === "string" ? workspaceConfig.organization : workspaceConfig.organization.name : void 0) || "storm-software";
28
- return ` -------------------------------------------------------------------
29
-
30
- ${padding}\u26A1 ${(organization.charAt(0).toUpperCase() + organization.slice(1)).split("-").filter((word) => word && word.length > 0).map((word) => {
31
- if (ACRONYMS_LIST.includes(word.toUpperCase())) {
32
- return word.toUpperCase();
33
- }
34
- return word.charAt(0).toUpperCase() + word.slice(1);
35
- }).join(" ")} ${titleName ? `- ${titleName}` : ""}
36
-
37
- This code was released as part of ${titleName ? `the ${titleName}` : `a ${(organization.charAt(0).toUpperCase() + organization.slice(1)).split("-").filter((word) => word && word.length > 0).map((word) => {
38
- if (ACRONYMS_LIST.includes(word.toUpperCase())) {
39
- return word.toUpperCase();
40
- }
41
- return word.charAt(0).toUpperCase() + word.slice(1);
42
- }).join(" ")}`} project. ${titleName ? titleName : "The project"}
43
- is maintained by ${(organization.charAt(0).toUpperCase() + organization.slice(1)).split("-").filter((word) => word && word.length > 0).map((word) => {
44
- if (ACRONYMS_LIST.includes(word.toUpperCase())) {
45
- return word.toUpperCase();
46
- }
47
- return word.charAt(0).toUpperCase() + word.slice(1);
48
- }).join(" ")} under the ${license} license, and is
49
- free for commercial and private use. For more information, please visit
50
- our licensing page at ${process.env.STORM_LICENSING?.replace(/\/$/, "") || workspaceConfig?.licensing?.replace(/\/$/, "") || "https://stormsoftware.com/licenses"}/${name ? `projects/${name}` : ""}.
51
-
52
- Website: ${process.env.STORM_HOMEPAGE || workspaceConfig?.homepage || "https://stormsoftware.com"}
53
- Repository: ${process.env.STORM_REPOSITORY || workspaceConfig?.repository || `https://github.com/${organization}${name ? `/${name}` : ""}`}
54
- Documentation: ${process.env.STORM_DOCS || workspaceConfig?.docs || `https://docs.stormsoftware.com${name ? `/projects/${name}` : ""}`}
55
- Contact: ${(process.env.STORM_HOMEPAGE || workspaceConfig?.homepage || "https://stormsoftware.com").endsWith("/") ? (process.env.STORM_HOMEPAGE || workspaceConfig?.homepage || "https://stormsoftware.com").slice(-1) : process.env.STORM_HOMEPAGE || workspaceConfig?.homepage || "https://stormsoftware.com"}/contact
56
-
57
- SPDX-License-Identifier: ${license}
58
-
59
- ------------------------------------------------------------------- `;
60
- };
61
-
62
- export { getFileBanner };