@@ -1990,7 +1990,31 @@ Generated by [AVA](https://avajs.dev).
1990
1990
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not construct dirname.␊
1991
1991
`
1992
1992
1993
- ## invalid(4): import { fileURLToPath } from "url"; const dirname = fileURLToPath(new URL(".", import.meta.url));
1993
+ ## invalid(4): import path from "path"; const not_dirname = path.dirname(new URL(import.meta.url).pathname);
1994
+
1995
+ > Input
1996
+
1997
+ `␊
1998
+ 1 | import path from "path";␊
1999
+ 2 | const not_dirname = path.dirname(new URL(import.meta.url).pathname);␊
2000
+ `
2001
+
2002
+ > Output
2003
+
2004
+ `␊
2005
+ 1 | import path from "path";␊
2006
+ 2 | const not_dirname = import.meta.dirname;␊
2007
+ `
2008
+
2009
+ > Error 1/1
2010
+
2011
+ `␊
2012
+ 1 | import path from "path";␊
2013
+ > 2 | const not_dirname = path.dirname(new URL(import.meta.url).pathname);␊
2014
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not construct dirname.␊
2015
+ `
2016
+
2017
+ ## invalid(5): import { fileURLToPath } from "url"; const dirname = fileURLToPath(new URL(".", import.meta.url));
1994
2018
1995
2019
> Input
1996
2020
@@ -2014,7 +2038,7 @@ Generated by [AVA](https://avajs.dev).
2014
2038
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not construct dirname.␊
2015
2039
`
2016
2040
2017
- ## invalid(5 ): import { fileURLToPath } from "url"; const dirname = fileURLToPath(new URL("./", import.meta.url));
2041
+ ## invalid(6 ): import { fileURLToPath } from "url"; const dirname = fileURLToPath(new URL("./", import.meta.url));
2018
2042
2019
2043
> Input
2020
2044
@@ -2038,7 +2062,7 @@ Generated by [AVA](https://avajs.dev).
2038
2062
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not construct dirname.␊
2039
2063
`
2040
2064
2041
- ## invalid(6 ): import { fileURLToPath } from "url"; const filename = fileURLToPath(import.meta.url);
2065
+ ## invalid(7 ): import { fileURLToPath } from "url"; const filename = fileURLToPath(import.meta.url);
2042
2066
2043
2067
> Input
2044
2068
@@ -2062,7 +2086,7 @@ Generated by [AVA](https://avajs.dev).
2062
2086
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not construct filename using \`fileURLToPath()\`.␊
2063
2087
`
2064
2088
2065
- ## invalid(7 ): import { fileURLToPath } from "url"; const filename = fileURLToPath(new URL(import.meta.url));
2089
+ ## invalid(8 ): import { fileURLToPath } from "url"; const filename = fileURLToPath(new URL(import.meta.url));
2066
2090
2067
2091
> Input
2068
2092
@@ -2086,7 +2110,7 @@ Generated by [AVA](https://avajs.dev).
2086
2110
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not construct filename using \`fileURLToPath()\`.␊
2087
2111
`
2088
2112
2089
- ## invalid(8 ): import path from "node: path "; import { fileURLToPath } from "node: url "; const dirname = path.dirname(fileURLToPath(import.meta.url));
2113
+ ## invalid(9 ): import path from "node: path "; import { fileURLToPath } from "node: url "; const dirname = path.dirname(fileURLToPath(import.meta.url));
2090
2114
2091
2115
> Input
2092
2116
@@ -2113,7 +2137,7 @@ Generated by [AVA](https://avajs.dev).
2113
2137
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not construct dirname.␊
2114
2138
`
2115
2139
2116
- ## invalid(9 ): import { fileURLToPath } from "node: url "; const filename = fileURLToPath(import.meta.url);
2140
+ ## invalid(10 ): import { fileURLToPath } from "node: url "; const filename = fileURLToPath(import.meta.url);
2117
2141
2118
2142
> Input
2119
2143
@@ -2137,7 +2161,7 @@ Generated by [AVA](https://avajs.dev).
2137
2161
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not construct filename using \`fileURLToPath()\`.␊
2138
2162
`
2139
2163
2140
- ## invalid(10 ): import * as path from "node: path "; import url from "node: url "; const dirname = path.dirname(url.fileURLToPath(import.meta.url));
2164
+ ## invalid(11 ): import * as path from "node: path "; import url from "node: url "; const dirname = path.dirname(url.fileURLToPath(import.meta.url));
2141
2165
2142
2166
> Input
2143
2167
@@ -2164,7 +2188,7 @@ Generated by [AVA](https://avajs.dev).
2164
2188
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not construct dirname.␊
2165
2189
`
2166
2190
2167
- ## invalid(11 ): import url from "node: url "; const filename = url.fileURLToPath(import.meta.url);
2191
+ ## invalid(12 ): import url from "node: url "; const filename = url.fileURLToPath(import.meta.url);
2168
2192
2169
2193
> Input
2170
2194
@@ -2188,7 +2212,7 @@ Generated by [AVA](https://avajs.dev).
2188
2212
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not construct filename using \`fileURLToPath()\`.␊
2189
2213
`
2190
2214
2191
- ## invalid(12 ): import path from "node: path "; import { fileURLToPath } from "node: url "; const __ filename = fileURLToPath(import.meta.url); const __ dirname = path.dirname(__ filename);
2215
+ ## invalid(13 ): import path from "node: path "; import { fileURLToPath } from "node: url "; const __ filename = fileURLToPath(import.meta.url); const __ dirname = path.dirname(__ filename);
2192
2216
2193
2217
> Input
2194
2218
@@ -2228,7 +2252,7 @@ Generated by [AVA](https://avajs.dev).
2228
2252
| ^^^^^^^^^^^^^^^^^^^^^^^^ Do not construct dirname.␊
2229
2253
`
2230
2254
2231
- ## invalid(13 ): import path from "node: path "; const __ filename = new URL(import.meta.url).pathname; const __ dirname = path.dirname(__ filename);
2255
+ ## invalid(14 ): import path from "node: path "; const __ filename = new URL(import.meta.url).pathname; const __ dirname = path.dirname(__ filename);
2232
2256
2233
2257
> Input
2234
2258
@@ -2255,7 +2279,7 @@ Generated by [AVA](https://avajs.dev).
2255
2279
| ^^^^^^^^^^^^^^^^^^^^^^^^ Do not construct dirname.␊
2256
2280
`
2257
2281
2258
- ## invalid(14 ): import path from "node: path "; const __ filename = import.meta.filename; const __ dirname = path.dirname(__ filename);
2282
+ ## invalid(15 ): import path from "node: path "; const __ filename = import.meta.filename; const __ dirname = path.dirname(__ filename);
2259
2283
2260
2284
> Input
2261
2285
@@ -2282,7 +2306,7 @@ Generated by [AVA](https://avajs.dev).
2282
2306
| ^^^^^^^^^^^^^^^^^^^^^^^^ Do not construct dirname.␊
2283
2307
`
2284
2308
2285
- ## invalid(15 ): const path = process.getBuiltinModule("node: path "); const { fileURLToPath } = process.getBuiltinModule("node: url "); const filename = fileURLToPath(import.meta.url); const dirname = path.dirname(filename);
2309
+ ## invalid(16 ): const path = process.getBuiltinModule("node: path "); const { fileURLToPath } = process.getBuiltinModule("node: url "); const filename = fileURLToPath(import.meta.url); const dirname = path.dirname(filename);
2286
2310
2287
2311
> Input
2288
2312
@@ -2322,7 +2346,7 @@ Generated by [AVA](https://avajs.dev).
2322
2346
| ^^^^^^^^^^^^^^^^^^^^^^ Do not construct dirname.␊
2323
2347
`
2324
2348
2325
- ## invalid(16 ): const { fileURLToPath: renamed } = process.getBuiltinModule("node: url "); const filename = renamed(import.meta.url);
2349
+ ## invalid(17 ): const { fileURLToPath: renamed } = process.getBuiltinModule("node: url "); const filename = renamed(import.meta.url);
2326
2350
2327
2351
> Input
2328
2352
@@ -2346,79 +2370,7 @@ Generated by [AVA](https://avajs.dev).
2346
2370
| ^^^^^^^^^^^^^^^^^^^^^^^^ Do not construct filename using \`fileURLToPath()\`.␊
2347
2371
`
2348
2372
2349
- ## invalid(17): const path = process.getBuiltinModule("path"); const { fileURLToPath } = process.getBuiltinModule("url"); const filename = fileURLToPath(import.meta.url); const dirname = path.dirname(filename);
2350
-
2351
- > Input
2352
-
2353
- `␊
2354
- 1 | const path = process.getBuiltinModule("path");␊
2355
- 2 | const { fileURLToPath } = process.getBuiltinModule("url");␊
2356
- 3 | const filename = fileURLToPath(import.meta.url);␊
2357
- 4 | const dirname = path.dirname(filename);␊
2358
- `
2359
-
2360
- > Output
2361
-
2362
- `␊
2363
- 1 | const path = process.getBuiltinModule("path");␊
2364
- 2 | const { fileURLToPath } = process.getBuiltinModule("url");␊
2365
- 3 | const filename = import.meta.filename;␊
2366
- 4 | const dirname = import.meta.dirname;␊
2367
- `
2368
-
2369
- > Error 1/2
2370
-
2371
- `␊
2372
- 1 | const path = process.getBuiltinModule("path");␊
2373
- 2 | const { fileURLToPath } = process.getBuiltinModule("url");␊
2374
- > 3 | const filename = fileURLToPath(import.meta.url);␊
2375
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not construct filename using \`fileURLToPath()\`.␊
2376
- 4 | const dirname = path.dirname(filename);␊
2377
- `
2378
-
2379
- > Error 2/2
2380
-
2381
- `␊
2382
- 1 | const path = process.getBuiltinModule("path");␊
2383
- 2 | const { fileURLToPath } = process.getBuiltinModule("url");␊
2384
- 3 | const filename = fileURLToPath(import.meta.url);␊
2385
- > 4 | const dirname = path.dirname(filename);␊
2386
- | ^^^^^^^^^^^^^^^^^^^^^^ Do not construct dirname.␊
2387
- `
2388
-
2389
- ## invalid(18): const filename = process.getBuiltinModule("node: url ").fileURLToPath(import.meta.url); const dirname = process.getBuiltinModule("node: path ").dirname(filename);
2390
-
2391
- > Input
2392
-
2393
- `␊
2394
- 1 | const filename = process.getBuiltinModule("node:url").fileURLToPath(import.meta.url);␊
2395
- 2 | const dirname = process.getBuiltinModule("node:path").dirname(filename);␊
2396
- `
2397
-
2398
- > Output
2399
-
2400
- `␊
2401
- 1 | const filename = import.meta.filename;␊
2402
- 2 | const dirname = import.meta.dirname;␊
2403
- `
2404
-
2405
- > Error 1/2
2406
-
2407
- `␊
2408
- > 1 | const filename = process.getBuiltinModule("node:url").fileURLToPath(import.meta.url);␊
2409
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not construct filename using \`fileURLToPath()\`.␊
2410
- 2 | const dirname = process.getBuiltinModule("node:path").dirname(filename);␊
2411
- `
2412
-
2413
- > Error 2/2
2414
-
2415
- `␊
2416
- 1 | const filename = process.getBuiltinModule("node:url").fileURLToPath(import.meta.url);␊
2417
- > 2 | const dirname = process.getBuiltinModule("node:path").dirname(filename);␊
2418
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not construct dirname.␊
2419
- `
2420
-
2421
- ## invalid(16): const path = process.getBuiltinModule("path"); const { fileURLToPath } = process.getBuiltinModule("url"); const filename = fileURLToPath(import.meta.url); const dirname = path.dirname(filename);
2373
+ ## invalid(18): const path = process.getBuiltinModule("path"); const { fileURLToPath } = process.getBuiltinModule("url"); const filename = fileURLToPath(import.meta.url); const dirname = path.dirname(filename);
2422
2374
2423
2375
> Input
2424
2376
@@ -2458,7 +2410,7 @@ Generated by [AVA](https://avajs.dev).
2458
2410
| ^^^^^^^^^^^^^^^^^^^^^^ Do not construct dirname.␊
2459
2411
`
2460
2412
2461
- ## invalid(17 ): const filename = process.getBuiltinModule("node: url ").fileURLToPath(import.meta.url); const dirname = process.getBuiltinModule("node: path ").dirname(filename);
2413
+ ## invalid(19 ): const filename = process.getBuiltinModule("node: url ").fileURLToPath(import.meta.url); const dirname = process.getBuiltinModule("node: path ").dirname(filename);
2462
2414
2463
2415
> Input
2464
2416
0 commit comments