@sarj/eslint-plugin 16.23.2 → 16.23.3

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/index.cjs CHANGED
@@ -424,7 +424,21 @@ function isScriptFile(filename) {
424
424
  return SCRIPT_FILE_RE.test(scopedFilename(filename));
425
425
  }
426
426
  function scopedFilename(input) {
427
- return (typeof input === "string" ? input : input.filename).replaceAll("\\", "/");
427
+ if (typeof input === "string") return input.replaceAll("\\", "/");
428
+ const filename = input.filename.replaceAll("\\", "/");
429
+ const cwd = input.cwd.replaceAll("\\", "/");
430
+ const fileWindows = windowsAbsolute(filename);
431
+ const cwdWindows = windowsAbsolute(cwd);
432
+ let scoped = filename;
433
+ if (fileWindows && cwdWindows) scoped = import_node_path.win32.relative(cwd, filename).replaceAll("\\", "/");
434
+ else if (!fileWindows && !cwdWindows && import_node_path.posix.isAbsolute(filename) && import_node_path.posix.isAbsolute(cwd)) {
435
+ scoped = import_node_path.posix.relative(cwd, filename);
436
+ }
437
+ if (windowsAbsolute(scoped) || import_node_path.posix.isAbsolute(scoped)) return scoped;
438
+ return `./${import_node_path.posix.normalize(scoped)}`;
439
+ }
440
+ function windowsAbsolute(filename) {
441
+ return /^[A-Za-z]:\//u.test(filename) || filename.startsWith("//");
428
442
  }
429
443
  function matchesAnyPattern(filename, patterns) {
430
444
  const normalized = filename.replaceAll("\\", "/");
@@ -869,7 +883,7 @@ function isSearchParamReceiver(call, services) {
869
883
  // package.json
870
884
  var package_default = {
871
885
  name: "@sarj/eslint-plugin",
872
- version: "16.23.2",
886
+ version: "16.23.3",
873
887
  packageManager: "npm@12.2.0",
874
888
  description: "Custom ESLint rules for hypermodern TypeScript / React / Next.js projects",
875
889
  type: "module",
package/dist/index.js CHANGED
@@ -288,7 +288,7 @@ function isTypeOnly(node) {
288
288
  import { AST_NODE_TYPES as AST_NODE_TYPES4, ASTUtils as ASTUtils2 } from "@typescript-eslint/utils";
289
289
 
290
290
  // src/rules/_paths.ts
291
- import { posix } from "path";
291
+ import { posix, win32 } from "path";
292
292
  var LINE_TERMINATOR_RE = /[\n\r\u2028\u2029]/u;
293
293
  var SCRIPT_FILE_RE = /(?:^|[\\/])scripts[\\/]|\.mjs$/;
294
294
  var STORY_FILE_RE = /\.stories\.[cm]?[jt]sx?$/i;
@@ -373,7 +373,21 @@ function isScriptFile(filename) {
373
373
  return SCRIPT_FILE_RE.test(scopedFilename(filename));
374
374
  }
375
375
  function scopedFilename(input) {
376
- return (typeof input === "string" ? input : input.filename).replaceAll("\\", "/");
376
+ if (typeof input === "string") return input.replaceAll("\\", "/");
377
+ const filename = input.filename.replaceAll("\\", "/");
378
+ const cwd = input.cwd.replaceAll("\\", "/");
379
+ const fileWindows = windowsAbsolute(filename);
380
+ const cwdWindows = windowsAbsolute(cwd);
381
+ let scoped = filename;
382
+ if (fileWindows && cwdWindows) scoped = win32.relative(cwd, filename).replaceAll("\\", "/");
383
+ else if (!fileWindows && !cwdWindows && posix.isAbsolute(filename) && posix.isAbsolute(cwd)) {
384
+ scoped = posix.relative(cwd, filename);
385
+ }
386
+ if (windowsAbsolute(scoped) || posix.isAbsolute(scoped)) return scoped;
387
+ return `./${posix.normalize(scoped)}`;
388
+ }
389
+ function windowsAbsolute(filename) {
390
+ return /^[A-Za-z]:\//u.test(filename) || filename.startsWith("//");
377
391
  }
378
392
  function matchesAnyPattern(filename, patterns) {
379
393
  const normalized = filename.replaceAll("\\", "/");
@@ -822,7 +836,7 @@ function isSearchParamReceiver(call, services) {
822
836
  // package.json
823
837
  var package_default = {
824
838
  name: "@sarj/eslint-plugin",
825
- version: "16.23.2",
839
+ version: "16.23.3",
826
840
  packageManager: "npm@12.2.0",
827
841
  description: "Custom ESLint rules for hypermodern TypeScript / React / Next.js projects",
828
842
  type: "module",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sarj/eslint-plugin",
3
- "version": "16.23.2",
3
+ "version": "16.23.3",
4
4
  "packageManager": "npm@12.2.0",
5
5
  "description": "Custom ESLint rules for hypermodern TypeScript / React / Next.js projects",
6
6
  "type": "module",