uilint 0.2.4 → 0.2.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/dist/index.js +43 -22
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2923,10 +2923,34 @@ import { createRequire } from "module";
|
|
|
2923
2923
|
var __filename2 = fileURLToPath3(import.meta.url);
|
|
2924
2924
|
var __dirname2 = dirname8(__filename2);
|
|
2925
2925
|
var require2 = createRequire(import.meta.url);
|
|
2926
|
+
function findNodeModulesPackageRoot(pkgName, startDir) {
|
|
2927
|
+
let dir = startDir;
|
|
2928
|
+
while (true) {
|
|
2929
|
+
const candidate = join10(dir, "node_modules", pkgName);
|
|
2930
|
+
if (existsSync11(join10(candidate, "package.json"))) return candidate;
|
|
2931
|
+
const parent = dirname8(dir);
|
|
2932
|
+
if (parent === dir) break;
|
|
2933
|
+
dir = parent;
|
|
2934
|
+
}
|
|
2935
|
+
return null;
|
|
2936
|
+
}
|
|
2926
2937
|
function getUilintEslintPackageRoot() {
|
|
2927
|
-
const
|
|
2928
|
-
|
|
2929
|
-
|
|
2938
|
+
const fromCwd = findNodeModulesPackageRoot("uilint-eslint", process.cwd());
|
|
2939
|
+
if (fromCwd) return fromCwd;
|
|
2940
|
+
const fromHere = findNodeModulesPackageRoot("uilint-eslint", __dirname2);
|
|
2941
|
+
if (fromHere) return fromHere;
|
|
2942
|
+
try {
|
|
2943
|
+
const entry = require2.resolve("uilint-eslint");
|
|
2944
|
+
const entryDir = dirname8(entry);
|
|
2945
|
+
return dirname8(entryDir);
|
|
2946
|
+
} catch (e) {
|
|
2947
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
2948
|
+
throw new Error(
|
|
2949
|
+
`Unable to locate uilint-eslint in node_modules (searched upwards from cwd and uilint's install path).
|
|
2950
|
+
Resolver error: ${msg}
|
|
2951
|
+
Fix: ensure uilint-eslint is installed in the target project (or workspace) and try again.`
|
|
2952
|
+
);
|
|
2953
|
+
}
|
|
2930
2954
|
}
|
|
2931
2955
|
function getUilintEslintSrcDir() {
|
|
2932
2956
|
const devPath = join10(
|
|
@@ -3016,7 +3040,7 @@ function loadRule(ruleId, options = { typescript: true }) {
|
|
|
3016
3040
|
const implPath = join10(rulesDir, `${ruleId}.js`);
|
|
3017
3041
|
if (!existsSync11(implPath)) {
|
|
3018
3042
|
throw new Error(
|
|
3019
|
-
`Rule "${ruleId}" not found at ${implPath}.
|
|
3043
|
+
`Rule "${ruleId}" not found at ${implPath}. For JavaScript-only projects, uilint-eslint must be built to include compiled rule files in dist/rules/. If you're developing uilint-eslint, run 'pnpm build' in packages/uilint-eslint. If you're using a published package, ensure it includes the dist/ directory.`
|
|
3020
3044
|
);
|
|
3021
3045
|
}
|
|
3022
3046
|
const content = readFileSync7(implPath, "utf-8");
|
|
@@ -3264,28 +3288,25 @@ function createPlan(state, choices, options = {}) {
|
|
|
3264
3288
|
path: rulesDir
|
|
3265
3289
|
});
|
|
3266
3290
|
const isTypeScript = pkgInfo?.isTypeScript ?? true;
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3291
|
+
const ruleFiles = loadSelectedRules(
|
|
3292
|
+
selectedRules.map((r) => r.id),
|
|
3293
|
+
{
|
|
3294
|
+
typescript: isTypeScript
|
|
3295
|
+
}
|
|
3296
|
+
);
|
|
3297
|
+
for (const ruleFile of ruleFiles) {
|
|
3298
|
+
actions.push({
|
|
3299
|
+
type: "create_file",
|
|
3300
|
+
path: join11(rulesDir, ruleFile.implementation.relativePath),
|
|
3301
|
+
content: ruleFile.implementation.content
|
|
3302
|
+
});
|
|
3303
|
+
if (ruleFile.test && isTypeScript) {
|
|
3275
3304
|
actions.push({
|
|
3276
3305
|
type: "create_file",
|
|
3277
|
-
path: join11(rulesDir, ruleFile.
|
|
3278
|
-
content: ruleFile.
|
|
3306
|
+
path: join11(rulesDir, ruleFile.test.relativePath),
|
|
3307
|
+
content: ruleFile.test.content
|
|
3279
3308
|
});
|
|
3280
|
-
if (ruleFile.test && isTypeScript) {
|
|
3281
|
-
actions.push({
|
|
3282
|
-
type: "create_file",
|
|
3283
|
-
path: join11(rulesDir, ruleFile.test.relativePath),
|
|
3284
|
-
content: ruleFile.test.content
|
|
3285
|
-
});
|
|
3286
|
-
}
|
|
3287
3309
|
}
|
|
3288
|
-
} catch {
|
|
3289
3310
|
}
|
|
3290
3311
|
dependencies.push({
|
|
3291
3312
|
packagePath: pkgPath,
|