@rslint/core 0.6.4 → 0.6.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.
- package/bin/rslint.js +23 -0
- package/dist/770.js +18 -0
- package/dist/cli.d.ts +10 -0
- package/dist/cli.js +904 -4
- package/dist/eslint-plugin/index.js +31 -2
- package/dist/index.d.ts +13 -1
- package/dist/index.js +4 -1
- package/dist/internal.js +1 -17
- package/package.json +14 -14
- package/bin/rslint.cjs +0 -48
- package/dist/207.js +0 -897
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Worker } from "node:worker_threads";
|
|
2
2
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
3
3
|
import { StringDecoder } from "node:string_decoder";
|
|
4
|
-
import
|
|
4
|
+
import node_path from "node:path";
|
|
5
|
+
import node_module, { createRequire } from "node:module";
|
|
5
6
|
import { readFileSync } from "node:fs";
|
|
6
7
|
import { execSync } from "node:child_process";
|
|
7
|
-
import node_path from "node:path";
|
|
8
8
|
import { __webpack_require__ } from "./612.js";
|
|
9
9
|
__webpack_require__.add({
|
|
10
10
|
"../../node_modules/.pnpm/esrecurse@4.3.0/node_modules/esrecurse/esrecurse.js" (__unused_rspack_module, exports, __webpack_require__) {
|
|
@@ -20396,6 +20396,34 @@ class CancelFlagPool {
|
|
|
20396
20396
|
let testWorkerEntry;
|
|
20397
20397
|
const resolveWorkerFile = ()=>testWorkerEntry ?? fileURLToPath(new URL('./lint-worker.js', import.meta.url));
|
|
20398
20398
|
const WORKER_EXIT_GRACE_MS = 5000;
|
|
20399
|
+
let nodeCompileCacheDir;
|
|
20400
|
+
let nodeCompileCacheDirResolved = false;
|
|
20401
|
+
function getNodeCompileCacheDir() {
|
|
20402
|
+
if (nodeCompileCacheDirResolved) return nodeCompileCacheDir;
|
|
20403
|
+
nodeCompileCacheDirResolved = true;
|
|
20404
|
+
if (process.env.NODE_DISABLE_COMPILE_CACHE) return;
|
|
20405
|
+
if (process.env.NODE_COMPILE_CACHE) {
|
|
20406
|
+
nodeCompileCacheDir = process.env.NODE_COMPILE_CACHE;
|
|
20407
|
+
return nodeCompileCacheDir;
|
|
20408
|
+
}
|
|
20409
|
+
const { enableCompileCache, getCompileCacheDir } = node_module;
|
|
20410
|
+
if (!enableCompileCache || !getCompileCacheDir) return;
|
|
20411
|
+
try {
|
|
20412
|
+
enableCompileCache();
|
|
20413
|
+
const cacheDirectory = getCompileCacheDir();
|
|
20414
|
+
nodeCompileCacheDir = cacheDirectory ? node_path.dirname(cacheDirectory) : void 0;
|
|
20415
|
+
return nodeCompileCacheDir;
|
|
20416
|
+
} catch {
|
|
20417
|
+
return;
|
|
20418
|
+
}
|
|
20419
|
+
}
|
|
20420
|
+
function workerEnvWithCompileCache() {
|
|
20421
|
+
const directory = getNodeCompileCacheDir();
|
|
20422
|
+
return directory ? {
|
|
20423
|
+
...process.env,
|
|
20424
|
+
NODE_COMPILE_CACHE: directory
|
|
20425
|
+
} : void 0;
|
|
20426
|
+
}
|
|
20399
20427
|
async function terminateWorker(worker) {
|
|
20400
20428
|
worker.stdout?.destroy();
|
|
20401
20429
|
worker.stderr?.destroy();
|
|
@@ -20590,6 +20618,7 @@ class WorkerPool {
|
|
|
20590
20618
|
cancelSab: this.cancelPool.sharedBuffer,
|
|
20591
20619
|
configs: this.opts.configs
|
|
20592
20620
|
},
|
|
20621
|
+
env: workerEnvWithCompileCache(),
|
|
20593
20622
|
stdout: true,
|
|
20594
20623
|
stderr: true
|
|
20595
20624
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference lib="esnext.disposable" />
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Type-safe config helper. Returns the config array as-is (identity function).
|
|
3
5
|
*/
|
|
@@ -194,7 +196,7 @@ export declare class Rslint {
|
|
|
194
196
|
}
|
|
195
197
|
|
|
196
198
|
/** Top-level rslint config: an array of entries. */
|
|
197
|
-
declare type RslintConfig = RslintConfigEntry[];
|
|
199
|
+
export declare type RslintConfig = RslintConfigEntry[];
|
|
198
200
|
|
|
199
201
|
/**
|
|
200
202
|
* A single entry in an rslint config array. Multiple entries may target
|
|
@@ -316,6 +318,16 @@ declare type RuleSeverity = 'off' | 'warn' | 'error';
|
|
|
316
318
|
*/
|
|
317
319
|
declare type RulesRecord = Record<string, RuleEntry>;
|
|
318
320
|
|
|
321
|
+
export declare function runCLI({ argv, }?: RunCLIOptions): Promise<void>;
|
|
322
|
+
|
|
323
|
+
export declare type RunCLIOptions = {
|
|
324
|
+
/**
|
|
325
|
+
* The command-line arguments to parse, matching the shape of Node.js `process.argv`
|
|
326
|
+
* @default process.argv
|
|
327
|
+
*/
|
|
328
|
+
argv?: string[];
|
|
329
|
+
};
|
|
330
|
+
|
|
319
331
|
export declare const ts: {
|
|
320
332
|
configs: {
|
|
321
333
|
base: RslintConfigEntry;
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import node_path from "node:path";
|
|
|
2
2
|
import { readFile, writeFile } from "node:fs/promises";
|
|
3
3
|
import { NodeRslintService } from "./internal.js";
|
|
4
4
|
import { loadConfigFile, normalizeConfig } from "./config-loader.js";
|
|
5
|
-
import { findJSConfigUp, glob } from "./
|
|
5
|
+
import { findJSConfigUp, glob } from "./cli.js";
|
|
6
6
|
import { RSLintService } from "./service.js";
|
|
7
7
|
const typescript_base = {
|
|
8
8
|
files: [
|
|
@@ -236,6 +236,7 @@ const promise_recommended = {
|
|
|
236
236
|
'promise/no-return-wrap': 'error',
|
|
237
237
|
'promise/param-names': 'error',
|
|
238
238
|
'promise/catch-or-return': 'error',
|
|
239
|
+
'promise/no-promise-in-callback': 'warn',
|
|
239
240
|
'promise/avoid-new': 'off',
|
|
240
241
|
'promise/valid-params': 'warn'
|
|
241
242
|
}
|
|
@@ -248,6 +249,7 @@ const jest_recommended = {
|
|
|
248
249
|
'jest/expect-expect': 'warn',
|
|
249
250
|
'jest/no-alias-methods': 'error',
|
|
250
251
|
'jest/no-commented-out-tests': 'warn',
|
|
252
|
+
'jest/no-conditional-expect': 'error',
|
|
251
253
|
'jest/no-deprecated-functions': 'error',
|
|
252
254
|
'jest/no-disabled-tests': 'warn',
|
|
253
255
|
'jest/no-done-callback': 'error',
|
|
@@ -749,4 +751,5 @@ function mergeFixes(fixes, sourceText) {
|
|
|
749
751
|
};
|
|
750
752
|
}
|
|
751
753
|
export { defineConfig, globalIgnores } from "./config-loader.js";
|
|
754
|
+
export { runCLI } from "./cli.js";
|
|
752
755
|
export { Rslint, importPlugin, jestPlugin, js, jsxA11yPlugin, promisePlugin, reactHooksPlugin, reactPlugin, ts, unicornPlugin };
|
package/dist/internal.js
CHANGED
|
@@ -1,23 +1,7 @@
|
|
|
1
1
|
import { spawn } from "child_process";
|
|
2
2
|
import { Socket } from "node:net";
|
|
3
|
-
import {
|
|
3
|
+
import { resolveRslintBinary } from "./770.js";
|
|
4
4
|
import { RSLintService } from "./service.js";
|
|
5
|
-
const node_require = createRequire(import.meta.url);
|
|
6
|
-
function resolveRslintBinary() {
|
|
7
|
-
const arch = process.arch;
|
|
8
|
-
const tuples = 'linux' === process.platform ? [
|
|
9
|
-
`linux-${arch}-gnu`,
|
|
10
|
-
`linux-${arch}-musl`
|
|
11
|
-
] : 'win32' === process.platform ? [
|
|
12
|
-
`win32-${arch}-msvc`
|
|
13
|
-
] : [
|
|
14
|
-
`${process.platform}-${arch}`
|
|
15
|
-
];
|
|
16
|
-
for (const tuple of tuples)try {
|
|
17
|
-
return node_require.resolve(`@rslint/native-${tuple}/bin`);
|
|
18
|
-
} catch {}
|
|
19
|
-
throw new Error(`rslint: no native binary for ${process.platform}-${arch} (looked for @rslint/native-{${tuples.join(',')}})`);
|
|
20
|
-
}
|
|
21
5
|
class NodeRslintService {
|
|
22
6
|
nextMessageId;
|
|
23
7
|
pendingMessages;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rslint/core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"@typescript/source": "./src/index.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@typescript/source": "./src/eslint-plugin/index.ts",
|
|
23
23
|
"default": "./dist/eslint-plugin/index.js"
|
|
24
24
|
},
|
|
25
|
-
"./bin": "./bin/rslint.
|
|
25
|
+
"./bin": "./bin/rslint.js",
|
|
26
26
|
"./package.json": "./package.json"
|
|
27
27
|
},
|
|
28
28
|
"type": "module",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"url": "https://github.com/web-infra-dev/rslint"
|
|
32
32
|
},
|
|
33
33
|
"files": [
|
|
34
|
-
"bin/rslint.
|
|
34
|
+
"bin/rslint.js",
|
|
35
35
|
"dist/"
|
|
36
36
|
],
|
|
37
37
|
"bin": {
|
|
38
|
-
"rslint": "./bin/rslint.
|
|
38
|
+
"rslint": "./bin/rslint.js"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
"eslint-visitor-keys": "5.0.1",
|
|
62
62
|
"espree": "11.2.0",
|
|
63
63
|
"esquery": "1.7.0",
|
|
64
|
-
"globals": "17.
|
|
64
|
+
"globals": "17.7.0",
|
|
65
65
|
"tinyglobby": "0.2.15",
|
|
66
66
|
"typescript": "5.9.3",
|
|
67
|
-
"@rslint/api": "0.6.
|
|
67
|
+
"@rslint/api": "0.6.5"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"jiti": "^2.0.0"
|
|
@@ -75,14 +75,14 @@
|
|
|
75
75
|
}
|
|
76
76
|
},
|
|
77
77
|
"optionalDependencies": {
|
|
78
|
-
"@rslint/native-darwin-arm64": "0.6.
|
|
79
|
-
"@rslint/native-linux-arm64-gnu": "0.6.
|
|
80
|
-
"@rslint/native-
|
|
81
|
-
"@rslint/native-
|
|
82
|
-
"@rslint/native-linux-arm64-musl": "0.6.
|
|
83
|
-
"@rslint/native-
|
|
84
|
-
"@rslint/native-
|
|
85
|
-
"@rslint/native-win32-x64-msvc": "0.6.
|
|
78
|
+
"@rslint/native-darwin-arm64": "0.6.5",
|
|
79
|
+
"@rslint/native-linux-arm64-gnu": "0.6.5",
|
|
80
|
+
"@rslint/native-darwin-x64": "0.6.5",
|
|
81
|
+
"@rslint/native-linux-x64-gnu": "0.6.5",
|
|
82
|
+
"@rslint/native-linux-arm64-musl": "0.6.5",
|
|
83
|
+
"@rslint/native-linux-x64-musl": "0.6.5",
|
|
84
|
+
"@rslint/native-win32-arm64-msvc": "0.6.5",
|
|
85
|
+
"@rslint/native-win32-x64-msvc": "0.6.5"
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
88
|
"picomatch": "4.0.4"
|
package/bin/rslint.cjs
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const startTime = Date.now();
|
|
3
|
-
const path = require('node:path');
|
|
4
|
-
const { pathToFileURL } = require('node:url');
|
|
5
|
-
const os = require('node:os');
|
|
6
|
-
|
|
7
|
-
function getBinPath() {
|
|
8
|
-
// The Go binary lives in the @rslint/native-{tuple} platform package, reached
|
|
9
|
-
// via its `./bin` export. Resolution is identical in dev and prod: `pnpm build`
|
|
10
|
-
// drops the host binary into npm/rslint/{tuple}/, and npm installs only the
|
|
11
|
-
// subpackage matching the host os/cpu/libc. On linux we just try gnu then musl
|
|
12
|
-
// and use whichever resolved — no libc sniffing (Go binaries are static, the
|
|
13
|
-
// gnu/musl distinction doesn't matter to them).
|
|
14
|
-
const arch = os.arch();
|
|
15
|
-
const tuples =
|
|
16
|
-
process.platform === 'linux'
|
|
17
|
-
? [`linux-${arch}-gnu`, `linux-${arch}-musl`]
|
|
18
|
-
: process.platform === 'win32'
|
|
19
|
-
? [`win32-${arch}-msvc`]
|
|
20
|
-
: [`${process.platform}-${arch}`];
|
|
21
|
-
for (const tuple of tuples) {
|
|
22
|
-
try {
|
|
23
|
-
return require.resolve(`@rslint/native-${tuple}/bin`);
|
|
24
|
-
} catch {}
|
|
25
|
-
}
|
|
26
|
-
throw new Error(
|
|
27
|
-
`rslint: no native binary for ${process.platform}-${arch} ` +
|
|
28
|
-
`(looked for @rslint/native-{${tuples.join(',')}})`,
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
async function main() {
|
|
33
|
-
const binPath = getBinPath();
|
|
34
|
-
const { run } = await import(
|
|
35
|
-
pathToFileURL(path.resolve(__dirname, '../dist/cli.js')).href
|
|
36
|
-
);
|
|
37
|
-
const exitCode = await run(binPath, process.argv.slice(2), startTime);
|
|
38
|
-
// process.exit() would tear down before async-buffered stdout writes (pipes,
|
|
39
|
-
// Windows TTYs) flush, truncating the lint tail. Setting exitCode lets the
|
|
40
|
-
// event loop drain naturally; run()'s cleanup guarantees nothing keeps it
|
|
41
|
-
// alive.
|
|
42
|
-
process.exitCode = exitCode;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
main().catch((err) => {
|
|
46
|
-
process.stderr.write(`rslint: ${err}\n`);
|
|
47
|
-
process.exitCode = 1;
|
|
48
|
-
});
|