typescript-eslint 8.37.1-alpha.4 → 8.37.1-alpha.5

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.
@@ -1,2 +1,9 @@
1
- export declare function getTSConfigRootDirFromStack(stack: string): string | undefined;
1
+ /**
2
+ * Infers the `tsconfigRootDir` from the current call stack, using the V8 API.
3
+ *
4
+ * See https://v8.dev/docs/stack-trace-api
5
+ *
6
+ * This API is implemented in Deno and Bun as well.
7
+ */
8
+ export declare function getTSConfigRootDirFromStack(): string | undefined;
2
9
  //# sourceMappingURL=getTSConfigRootDirFromStack.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getTSConfigRootDirFromStack.d.ts","sourceRoot":"","sources":["../src/getTSConfigRootDirFromStack.ts"],"names":[],"mappings":"AAEA,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAa7E"}
1
+ {"version":3,"file":"getTSConfigRootDirFromStack.d.ts","sourceRoot":"","sources":["../src/getTSConfigRootDirFromStack.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,2BAA2B,IAAI,MAAM,GAAG,SAAS,CA+BhE"}
@@ -1,16 +1,40 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.getTSConfigRootDirFromStack = getTSConfigRootDirFromStack;
4
- const node_url_1 = require("node:url");
5
- function getTSConfigRootDirFromStack(stack) {
6
- for (const line of stack.split('\n').map(line => line.trim())) {
7
- const candidate = /(\S+)eslint\.config\.(c|m)?(j|t)s/.exec(line)?.[1];
8
- if (!candidate) {
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ /**
9
+ * Infers the `tsconfigRootDir` from the current call stack, using the V8 API.
10
+ *
11
+ * See https://v8.dev/docs/stack-trace-api
12
+ *
13
+ * This API is implemented in Deno and Bun as well.
14
+ */
15
+ function getTSConfigRootDirFromStack() {
16
+ function getStack() {
17
+ const stackTraceLimit = Error.stackTraceLimit;
18
+ Error.stackTraceLimit = Infinity;
19
+ const prepareStackTrace = Error.prepareStackTrace;
20
+ Error.prepareStackTrace = (_, structuredStackTrace) => structuredStackTrace;
21
+ const dummyObject = {};
22
+ Error.captureStackTrace(dummyObject, getTSConfigRootDirFromStack);
23
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- stack is set by captureStackTrace
24
+ const rv = dummyObject.stack;
25
+ Error.prepareStackTrace = prepareStackTrace;
26
+ Error.stackTraceLimit = stackTraceLimit;
27
+ return rv;
28
+ }
29
+ for (const callSite of getStack()) {
30
+ const stackFrameFilePath = callSite.getFileName();
31
+ if (!stackFrameFilePath) {
9
32
  continue;
10
33
  }
11
- return candidate.startsWith('file://')
12
- ? (0, node_url_1.fileURLToPath)(candidate)
13
- : candidate;
34
+ const parsedPath = node_path_1.default.parse(stackFrameFilePath);
35
+ if (/^eslint\.config\.(c|m)?(j|t)s$/.test(parsedPath.base)) {
36
+ return parsedPath.dir;
37
+ }
14
38
  }
15
39
  return undefined;
16
40
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAMzD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGzC,eAAO,MAAM,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,MAAyB,CAAC;AAyBnE,eAAO,MAAM,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,MAGxC,CAAC;AAEF,eAAO,MAAM,OAAO;IAClB;;;OAGG;;IAGH;;;;OAIG;;IAGH;;;OAGG;;IAGH;;;;;OAKG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAIH;;;OAGG;;IAIH;;;OAGG;;IAGH;;;O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G;;QAIH;;;WAGG;;QAGH;;;WAGG;;QAGH;;;WAGG;;QAGH;;;WAGG;;QAGH;;;WAGG;;QAGH;;;WAGG;;;;;;AA0EL,wBAKE;AAEF,OAAO,EACL,MAAM,EACN,KAAK,iBAAiB,EACtB,KAAK,8BAA8B,EACnC,KAAK,WAAW,GACjB,MAAM,iBAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -111,9 +111,7 @@ function createConfigsGetters(values) {
111
111
  {
112
112
  enumerable: true,
113
113
  get: () => {
114
- const candidateRootDir = (0, getTSConfigRootDirFromStack_1.getTSConfigRootDirFromStack)(
115
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
116
- new Error().stack);
114
+ const candidateRootDir = (0, getTSConfigRootDirFromStack_1.getTSConfigRootDirFromStack)();
117
115
  if (candidateRootDir) {
118
116
  (0, typescript_estree_1.addCandidateTSConfigRootDir)(candidateRootDir);
119
117
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typescript-eslint",
3
- "version": "8.37.1-alpha.4",
3
+ "version": "8.37.1-alpha.5",
4
4
  "description": "Tooling which enables you to use TypeScript with ESLint",
5
5
  "files": [
6
6
  "dist",
@@ -50,10 +50,10 @@
50
50
  "typecheck": "yarn run -BT nx typecheck"
51
51
  },
52
52
  "dependencies": {
53
- "@typescript-eslint/eslint-plugin": "8.37.1-alpha.4",
54
- "@typescript-eslint/parser": "8.37.1-alpha.4",
55
- "@typescript-eslint/typescript-estree": "8.37.1-alpha.4",
56
- "@typescript-eslint/utils": "8.37.1-alpha.4"
53
+ "@typescript-eslint/eslint-plugin": "8.37.1-alpha.5",
54
+ "@typescript-eslint/parser": "8.37.1-alpha.5",
55
+ "@typescript-eslint/typescript-estree": "8.37.1-alpha.5",
56
+ "@typescript-eslint/utils": "8.37.1-alpha.5"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "eslint": "^8.57.0 || ^9.0.0",