@storm-software/eslint 0.116.5 → 0.116.7

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 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
- [![Version](https://img.shields.io/badge/version-0.116.4-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
24
+ [![Version](https://img.shields.io/badge/version-0.116.6-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
25
25
 
26
26
  <!-- prettier-ignore-start -->
27
27
  <!-- markdownlint-disable -->
package/dist/preset.cjs CHANGED
@@ -210,28 +210,131 @@ var _promises = require('fs/promises');
210
210
  var _path = require('path');
211
211
 
212
212
  // ../config-tools/src/utilities/correct-paths.ts
213
-
214
- var removeWindowsDriveLetter = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (osSpecificPath) => {
215
- return osSpecificPath.replace(/^[A-Z]:/, "");
216
- }, "removeWindowsDriveLetter");
217
- var correctPaths = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (path) => {
218
- if (!path) {
219
- return "";
213
+ var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
214
+ function normalizeWindowsPath(input = "") {
215
+ if (!input) {
216
+ return input;
217
+ }
218
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
219
+ }
220
+ _chunkUSNT2KNTcjs.__name.call(void 0, normalizeWindowsPath, "normalizeWindowsPath");
221
+ var _UNC_REGEX = /^[/\\]{2}/;
222
+ var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
223
+ var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
224
+ var correctPaths = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, function(path) {
225
+ if (!path || path.length === 0) {
226
+ return ".";
220
227
  }
221
- if (path.includes("\\")) {
222
- if (!path.toUpperCase().startsWith("C:")) {
223
- path = `C:${path}`;
228
+ path = normalizeWindowsPath(path);
229
+ const isUNCPath = path.match(_UNC_REGEX);
230
+ const isPathAbsolute = isAbsolute(path);
231
+ const trailingSeparator = path[path.length - 1] === "/";
232
+ path = normalizeString(path, !isPathAbsolute);
233
+ if (path.length === 0) {
234
+ if (isPathAbsolute) {
235
+ return "/";
224
236
  }
225
- return path.replaceAll("/", "\\");
237
+ return trailingSeparator ? "./" : ".";
226
238
  }
227
- return removeWindowsDriveLetter(path).split("\\").join("/");
239
+ if (trailingSeparator) {
240
+ path += "/";
241
+ }
242
+ if (_DRIVE_LETTER_RE.test(path)) {
243
+ path += "/";
244
+ }
245
+ if (isUNCPath) {
246
+ if (!isPathAbsolute) {
247
+ return `//./${path}`;
248
+ }
249
+ return `//${path}`;
250
+ }
251
+ return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
228
252
  }, "correctPaths");
229
- var joinPaths = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, (...paths) => {
230
- if (!paths || paths.length === 0) {
231
- return "";
253
+ var joinPaths = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, function(...segments) {
254
+ let path = "";
255
+ for (const seg of segments) {
256
+ if (!seg) {
257
+ continue;
258
+ }
259
+ if (path.length > 0) {
260
+ const pathTrailing = path[path.length - 1] === "/";
261
+ const segLeading = seg[0] === "/";
262
+ const both = pathTrailing && segLeading;
263
+ if (both) {
264
+ path += seg.slice(1);
265
+ } else {
266
+ path += pathTrailing || segLeading ? seg : `/${seg}`;
267
+ }
268
+ } else {
269
+ path += seg;
270
+ }
232
271
  }
233
- return correctPaths(_path.join.call(void 0, ...paths));
272
+ return correctPaths(path);
234
273
  }, "joinPaths");
274
+ function normalizeString(path, allowAboveRoot) {
275
+ let res = "";
276
+ let lastSegmentLength = 0;
277
+ let lastSlash = -1;
278
+ let dots = 0;
279
+ let char = null;
280
+ for (let index = 0; index <= path.length; ++index) {
281
+ if (index < path.length) {
282
+ char = path[index];
283
+ } else if (char === "/") {
284
+ break;
285
+ } else {
286
+ char = "/";
287
+ }
288
+ if (char === "/") {
289
+ if (lastSlash === index - 1 || dots === 1) {
290
+ } else if (dots === 2) {
291
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
292
+ if (res.length > 2) {
293
+ const lastSlashIndex = res.lastIndexOf("/");
294
+ if (lastSlashIndex === -1) {
295
+ res = "";
296
+ lastSegmentLength = 0;
297
+ } else {
298
+ res = res.slice(0, lastSlashIndex);
299
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
300
+ }
301
+ lastSlash = index;
302
+ dots = 0;
303
+ continue;
304
+ } else if (res.length > 0) {
305
+ res = "";
306
+ lastSegmentLength = 0;
307
+ lastSlash = index;
308
+ dots = 0;
309
+ continue;
310
+ }
311
+ }
312
+ if (allowAboveRoot) {
313
+ res += res.length > 0 ? "/.." : "..";
314
+ lastSegmentLength = 2;
315
+ }
316
+ } else {
317
+ if (res.length > 0) {
318
+ res += `/${path.slice(lastSlash + 1, index)}`;
319
+ } else {
320
+ res = path.slice(lastSlash + 1, index);
321
+ }
322
+ lastSegmentLength = index - lastSlash - 1;
323
+ }
324
+ lastSlash = index;
325
+ dots = 0;
326
+ } else if (char === "." && dots !== -1) {
327
+ ++dots;
328
+ } else {
329
+ dots = -1;
330
+ }
331
+ }
332
+ return res;
333
+ }
334
+ _chunkUSNT2KNTcjs.__name.call(void 0, normalizeString, "normalizeString");
335
+ var isAbsolute = /* @__PURE__ */ _chunkUSNT2KNTcjs.__name.call(void 0, function(p) {
336
+ return _IS_ABSOLUTE_RE.test(p);
337
+ }, "isAbsolute");
235
338
 
236
339
  // ../config-tools/src/utilities/find-up.ts
237
340
 
package/dist/preset.js CHANGED
@@ -207,44 +207,147 @@ var StormConfigSchema = z.object({
207
207
  // ../config-tools/src/utilities/get-default-config.ts
208
208
  import { existsSync as existsSync2 } from "node:fs";
209
209
  import { readFile } from "node:fs/promises";
210
- import { join as join3 } from "node:path";
210
+ import { join as join2 } from "node:path";
211
211
 
212
212
  // ../config-tools/src/utilities/correct-paths.ts
213
- import { join } from "node:path";
214
- var removeWindowsDriveLetter = /* @__PURE__ */ __name((osSpecificPath) => {
215
- return osSpecificPath.replace(/^[A-Z]:/, "");
216
- }, "removeWindowsDriveLetter");
217
- var correctPaths = /* @__PURE__ */ __name((path) => {
218
- if (!path) {
219
- return "";
213
+ var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
214
+ function normalizeWindowsPath(input = "") {
215
+ if (!input) {
216
+ return input;
217
+ }
218
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
219
+ }
220
+ __name(normalizeWindowsPath, "normalizeWindowsPath");
221
+ var _UNC_REGEX = /^[/\\]{2}/;
222
+ var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
223
+ var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
224
+ var correctPaths = /* @__PURE__ */ __name(function(path) {
225
+ if (!path || path.length === 0) {
226
+ return ".";
220
227
  }
221
- if (path.includes("\\")) {
222
- if (!path.toUpperCase().startsWith("C:")) {
223
- path = `C:${path}`;
228
+ path = normalizeWindowsPath(path);
229
+ const isUNCPath = path.match(_UNC_REGEX);
230
+ const isPathAbsolute = isAbsolute(path);
231
+ const trailingSeparator = path[path.length - 1] === "/";
232
+ path = normalizeString(path, !isPathAbsolute);
233
+ if (path.length === 0) {
234
+ if (isPathAbsolute) {
235
+ return "/";
224
236
  }
225
- return path.replaceAll("/", "\\");
237
+ return trailingSeparator ? "./" : ".";
226
238
  }
227
- return removeWindowsDriveLetter(path).split("\\").join("/");
239
+ if (trailingSeparator) {
240
+ path += "/";
241
+ }
242
+ if (_DRIVE_LETTER_RE.test(path)) {
243
+ path += "/";
244
+ }
245
+ if (isUNCPath) {
246
+ if (!isPathAbsolute) {
247
+ return `//./${path}`;
248
+ }
249
+ return `//${path}`;
250
+ }
251
+ return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
228
252
  }, "correctPaths");
229
- var joinPaths = /* @__PURE__ */ __name((...paths) => {
230
- if (!paths || paths.length === 0) {
231
- return "";
253
+ var joinPaths = /* @__PURE__ */ __name(function(...segments) {
254
+ let path = "";
255
+ for (const seg of segments) {
256
+ if (!seg) {
257
+ continue;
258
+ }
259
+ if (path.length > 0) {
260
+ const pathTrailing = path[path.length - 1] === "/";
261
+ const segLeading = seg[0] === "/";
262
+ const both = pathTrailing && segLeading;
263
+ if (both) {
264
+ path += seg.slice(1);
265
+ } else {
266
+ path += pathTrailing || segLeading ? seg : `/${seg}`;
267
+ }
268
+ } else {
269
+ path += seg;
270
+ }
232
271
  }
233
- return correctPaths(join(...paths));
272
+ return correctPaths(path);
234
273
  }, "joinPaths");
274
+ function normalizeString(path, allowAboveRoot) {
275
+ let res = "";
276
+ let lastSegmentLength = 0;
277
+ let lastSlash = -1;
278
+ let dots = 0;
279
+ let char = null;
280
+ for (let index = 0; index <= path.length; ++index) {
281
+ if (index < path.length) {
282
+ char = path[index];
283
+ } else if (char === "/") {
284
+ break;
285
+ } else {
286
+ char = "/";
287
+ }
288
+ if (char === "/") {
289
+ if (lastSlash === index - 1 || dots === 1) {
290
+ } else if (dots === 2) {
291
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
292
+ if (res.length > 2) {
293
+ const lastSlashIndex = res.lastIndexOf("/");
294
+ if (lastSlashIndex === -1) {
295
+ res = "";
296
+ lastSegmentLength = 0;
297
+ } else {
298
+ res = res.slice(0, lastSlashIndex);
299
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
300
+ }
301
+ lastSlash = index;
302
+ dots = 0;
303
+ continue;
304
+ } else if (res.length > 0) {
305
+ res = "";
306
+ lastSegmentLength = 0;
307
+ lastSlash = index;
308
+ dots = 0;
309
+ continue;
310
+ }
311
+ }
312
+ if (allowAboveRoot) {
313
+ res += res.length > 0 ? "/.." : "..";
314
+ lastSegmentLength = 2;
315
+ }
316
+ } else {
317
+ if (res.length > 0) {
318
+ res += `/${path.slice(lastSlash + 1, index)}`;
319
+ } else {
320
+ res = path.slice(lastSlash + 1, index);
321
+ }
322
+ lastSegmentLength = index - lastSlash - 1;
323
+ }
324
+ lastSlash = index;
325
+ dots = 0;
326
+ } else if (char === "." && dots !== -1) {
327
+ ++dots;
328
+ } else {
329
+ dots = -1;
330
+ }
331
+ }
332
+ return res;
333
+ }
334
+ __name(normalizeString, "normalizeString");
335
+ var isAbsolute = /* @__PURE__ */ __name(function(p) {
336
+ return _IS_ABSOLUTE_RE.test(p);
337
+ }, "isAbsolute");
235
338
 
236
339
  // ../config-tools/src/utilities/find-up.ts
237
340
  import { existsSync } from "node:fs";
238
- import { join as join2 } from "node:path";
341
+ import { join } from "node:path";
239
342
  var MAX_PATH_SEARCH_DEPTH = 30;
240
343
  var depth = 0;
241
344
  function findFolderUp(startPath, endFileNames) {
242
345
  const _startPath = startPath ?? process.cwd();
243
- if (endFileNames.some((endFileName) => existsSync(join2(_startPath, endFileName)))) {
346
+ if (endFileNames.some((endFileName) => existsSync(join(_startPath, endFileName)))) {
244
347
  return _startPath;
245
348
  }
246
349
  if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
247
- const parent = join2(_startPath, "..");
350
+ const parent = join(_startPath, "..");
248
351
  return findFolderUp(parent, endFileNames);
249
352
  }
250
353
  return void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/eslint",
3
- "version": "0.116.5",
3
+ "version": "0.116.7",
4
4
  "type": "module",
5
5
  "description": "⚡ A package containing the base ESLint configuration used by Storm Software across many projects.",
6
6
  "repository": {
@@ -151,6 +151,9 @@
151
151
  },
152
152
  "dependencies": {
153
153
  "@cspell/eslint-plugin": "8.13.1",
154
+ "@graphql-eslint/eslint-plugin": "4.3.0",
155
+ "@next/eslint-plugin-next": "15.1.6",
156
+ "@nx/eslint-plugin": "^20.3.1",
154
157
  "defu": "6.1.4",
155
158
  "eslint": "^9.12.0",
156
159
  "eslint-config-prettier": "10.0.1",
@@ -182,10 +185,7 @@
182
185
  },
183
186
  "devDependencies": {
184
187
  "@eslint/config-inspector": "^0.5.1",
185
- "@graphql-eslint/eslint-plugin": "4.3.0",
186
- "@next/eslint-plugin-next": "15.1.6",
187
188
  "@nx/eslint": "^20.3.1",
188
- "@nx/eslint-plugin": "^20.3.1",
189
189
  "@nx/workspace": "^20.3.1",
190
190
  "@types/eslint": "^9.6.1",
191
191
  "@types/eslint__js": "^8.42.3",