@codacy/tools-stylelint-0 0.3.0 → 0.5.0
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 +20 -34
- package/dist/metadata.d.ts +13 -0
- package/dist/metadata.js +39 -0
- package/package.json +13 -3
package/dist/index.js
CHANGED
|
@@ -33,9 +33,10 @@ __export(index_exports, {
|
|
|
33
33
|
default: () => index_default
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(index_exports);
|
|
36
|
-
var
|
|
36
|
+
var import_tooling2 = require("@codacy/tooling");
|
|
37
37
|
|
|
38
38
|
// src/adapter.ts
|
|
39
|
+
var import_tooling = require("@codacy/tooling");
|
|
39
40
|
var import_path = __toESM(require("path"));
|
|
40
41
|
var import_fs = __toESM(require("fs"));
|
|
41
42
|
|
|
@@ -3221,6 +3222,18 @@ var patterns_default = [
|
|
|
3221
3222
|
}
|
|
3222
3223
|
];
|
|
3223
3224
|
|
|
3225
|
+
// src/metadata.ts
|
|
3226
|
+
var descriptor = {
|
|
3227
|
+
id: "Stylelint",
|
|
3228
|
+
displayName: "Stylelint",
|
|
3229
|
+
preferredVersion: "16.0.0",
|
|
3230
|
+
languages: ["CSS", "LESS", "SASS"],
|
|
3231
|
+
filePatterns: ["**/*.css", "**/*.scss", "**/*.less"],
|
|
3232
|
+
supportedOS: ["linux", "darwin", "win32"],
|
|
3233
|
+
supportedArch: ["x64", "arm64"],
|
|
3234
|
+
supportedRunners: ["local", "container"]
|
|
3235
|
+
};
|
|
3236
|
+
|
|
3224
3237
|
// src/adapter.ts
|
|
3225
3238
|
var TOOL_ID = "Stylelint";
|
|
3226
3239
|
var LOCAL_CONFIG_FILES = [
|
|
@@ -3287,16 +3300,9 @@ async function importStylelint() {
|
|
|
3287
3300
|
return mod.lint ? mod : mod.default;
|
|
3288
3301
|
}
|
|
3289
3302
|
var adapter = {
|
|
3290
|
-
|
|
3291
|
-
displayName: "Stylelint",
|
|
3292
|
-
preferredVersion: "16.0.0",
|
|
3303
|
+
...descriptor,
|
|
3293
3304
|
compatibleVersions: ">=16.0.0 <17.0.0",
|
|
3294
3305
|
website: "https://stylelint.io",
|
|
3295
|
-
languages: ["CSS", "LESS", "SASS"],
|
|
3296
|
-
filePatterns: ["**/*.css", "**/*.scss", "**/*.less"],
|
|
3297
|
-
supportedOS: ["linux", "darwin", "win32"],
|
|
3298
|
-
supportedArch: ["x64", "arm64"],
|
|
3299
|
-
supportedRunners: ["local", "container"],
|
|
3300
3306
|
prerequisites: [],
|
|
3301
3307
|
/**
|
|
3302
3308
|
* Verifies that the `stylelint` npm package is loadable and returns its version.
|
|
@@ -3366,7 +3372,7 @@ var adapter = {
|
|
|
3366
3372
|
const absoluteFiles = ctx.targetFiles.map((f) => import_path.default.resolve(ctx.repositoryRoot, f));
|
|
3367
3373
|
if (absoluteFiles.length === 0) {
|
|
3368
3374
|
const completedAt2 = /* @__PURE__ */ new Date();
|
|
3369
|
-
return buildResult(startedAt, completedAt2, issues, errors, ctx.targetFiles.length);
|
|
3375
|
+
return (0, import_tooling.buildResult)(TOOL_ID, startedAt, completedAt2, issues, errors, ctx.targetFiles.length);
|
|
3370
3376
|
}
|
|
3371
3377
|
let stylelint;
|
|
3372
3378
|
try {
|
|
@@ -3380,7 +3386,7 @@ var adapter = {
|
|
|
3380
3386
|
message: `Failed to load stylelint: ${err instanceof Error ? err.message : String(err)}`,
|
|
3381
3387
|
level: "error"
|
|
3382
3388
|
});
|
|
3383
|
-
return buildResult(startedAt, completedAt2, issues, errors, ctx.targetFiles.length);
|
|
3389
|
+
return (0, import_tooling.buildResult)(TOOL_ID, startedAt, completedAt2, issues, errors, ctx.targetFiles.length);
|
|
3384
3390
|
}
|
|
3385
3391
|
const lintOptions = { files: absoluteFiles };
|
|
3386
3392
|
if (codacyConfig.useLocalConfigurationFile && codacyConfig.localConfigurationFile) {
|
|
@@ -3391,7 +3397,7 @@ var adapter = {
|
|
|
3391
3397
|
ctx.logger.info("Skipping analysis: no local config and no patterns enabled", {
|
|
3392
3398
|
toolId: TOOL_ID
|
|
3393
3399
|
});
|
|
3394
|
-
return buildResult(startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
|
|
3400
|
+
return (0, import_tooling.buildResult)(TOOL_ID, startedAt, /* @__PURE__ */ new Date(), issues, errors, ctx.targetFiles.length);
|
|
3395
3401
|
}
|
|
3396
3402
|
try {
|
|
3397
3403
|
const result = await stylelint.lint(lintOptions);
|
|
@@ -3443,29 +3449,9 @@ var adapter = {
|
|
|
3443
3449
|
errorCount: errors.length,
|
|
3444
3450
|
durationMs: Date.now() - startMs
|
|
3445
3451
|
});
|
|
3446
|
-
return buildResult(startedAt, completedAt, issues, errors, ctx.targetFiles.length);
|
|
3452
|
+
return (0, import_tooling.buildResult)(TOOL_ID, startedAt, completedAt, issues, errors, ctx.targetFiles.length);
|
|
3447
3453
|
}
|
|
3448
3454
|
};
|
|
3449
|
-
function buildResult(startedAt, completedAt, issues, errors, filesAnalyzed) {
|
|
3450
|
-
const durationMs = completedAt.getTime() - startedAt.getTime();
|
|
3451
|
-
return {
|
|
3452
|
-
metadata: {
|
|
3453
|
-
startedAt: startedAt.toISOString(),
|
|
3454
|
-
completedAt: completedAt.toISOString(),
|
|
3455
|
-
durationMs
|
|
3456
|
-
},
|
|
3457
|
-
issues,
|
|
3458
|
-
errors,
|
|
3459
|
-
summary: {
|
|
3460
|
-
toolId: TOOL_ID,
|
|
3461
|
-
status: errors.some((e) => e.level === "error") ? "partial" : "success",
|
|
3462
|
-
issueCount: issues.length,
|
|
3463
|
-
errorCount: errors.length,
|
|
3464
|
-
durationMs,
|
|
3465
|
-
filesAnalyzed
|
|
3466
|
-
}
|
|
3467
|
-
};
|
|
3468
|
-
}
|
|
3469
3455
|
|
|
3470
3456
|
// src/index.ts
|
|
3471
|
-
var index_default = (0,
|
|
3457
|
+
var index_default = (0, import_tooling2.defineToolAdapter)(adapter);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AdapterDescriptor } from '@codacy/tooling';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Lightweight adapter descriptor for lazy loading.
|
|
5
|
+
*
|
|
6
|
+
* This module contains only plain-data metadata fields and has zero heavy
|
|
7
|
+
* imports (no patterns.json, no runtime utilities). The CLI imports this
|
|
8
|
+
* at startup for adapter registration without loading the full adapter module.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
declare const descriptor: AdapterDescriptor;
|
|
12
|
+
|
|
13
|
+
export { descriptor };
|
package/dist/metadata.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/metadata.ts
|
|
21
|
+
var metadata_exports = {};
|
|
22
|
+
__export(metadata_exports, {
|
|
23
|
+
descriptor: () => descriptor
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(metadata_exports);
|
|
26
|
+
var descriptor = {
|
|
27
|
+
id: "Stylelint",
|
|
28
|
+
displayName: "Stylelint",
|
|
29
|
+
preferredVersion: "16.0.0",
|
|
30
|
+
languages: ["CSS", "LESS", "SASS"],
|
|
31
|
+
filePatterns: ["**/*.css", "**/*.scss", "**/*.less"],
|
|
32
|
+
supportedOS: ["linux", "darwin", "win32"],
|
|
33
|
+
supportedArch: ["x64", "arm64"],
|
|
34
|
+
supportedRunners: ["local", "container"]
|
|
35
|
+
};
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
descriptor
|
|
39
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codacy/tools-stylelint-0",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Stylelint adapter — Library-mode CSS/SCSS/Less linter",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"stylelint": "^16.0.0",
|
|
12
12
|
"stylelint-config-standard": "^36.0.0",
|
|
13
|
-
"@codacy/tooling": "0.
|
|
13
|
+
"@codacy/tooling": "0.5.0"
|
|
14
14
|
},
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"author": "Codacy <support@codacy.com> (https://www.codacy.com)",
|
|
@@ -23,8 +23,18 @@
|
|
|
23
23
|
"engines": {
|
|
24
24
|
"node": ">=20.0.0"
|
|
25
25
|
},
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"default": "./dist/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./metadata": {
|
|
32
|
+
"types": "./dist/metadata.d.ts",
|
|
33
|
+
"default": "./dist/metadata.js"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
26
36
|
"scripts": {
|
|
27
|
-
"build": "tsup src/index.ts --format cjs --dts --clean",
|
|
37
|
+
"build": "tsup src/index.ts src/metadata.ts --format cjs --dts --clean",
|
|
28
38
|
"test": "vitest run",
|
|
29
39
|
"lint": "eslint src/",
|
|
30
40
|
"clean": "rm -rf dist",
|