@salesforce-ux/slds-linter 1.1.0-internal → 1.1.1
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/build/index.js
CHANGED
|
@@ -19,7 +19,7 @@ process.on("uncaughtException", (error) => {
|
|
|
19
19
|
var program = new Command();
|
|
20
20
|
program.name("npx @salesforce-ux/slds-linter@latest").showHelpAfterError();
|
|
21
21
|
function registerVersion() {
|
|
22
|
-
program.description("SLDS Linter CLI tool for linting styles and components").version("1.1.
|
|
22
|
+
program.description("SLDS Linter CLI tool for linting styles and components").version("1.1.1");
|
|
23
23
|
}
|
|
24
24
|
registerLintCommand(program);
|
|
25
25
|
registerReportCommand(program);
|
|
@@ -3,7 +3,7 @@ import { resolvePath } from "../utils/nodeVersionUtil.js";
|
|
|
3
3
|
import ruleMessages from "@salesforce-ux/eslint-plugin-slds/rule-messages";
|
|
4
4
|
var DEFAULT_ESLINT_CONFIG_PATH = resolvePath("@salesforce-ux/eslint-plugin-slds/config", import.meta);
|
|
5
5
|
var ESLINT_VERSION = "9.36.0";
|
|
6
|
-
var LINTER_CLI_VERSION = "1.1.
|
|
6
|
+
var LINTER_CLI_VERSION = "1.1.1";
|
|
7
7
|
var getRuleDescription = (ruleId) => {
|
|
8
8
|
const ruleIdWithoutNameSpace = `${ruleId}`.replace(/\@salesforce-ux\//, "").replace(/^slds\//, "");
|
|
9
9
|
return ruleMessages[ruleIdWithoutNameSpace]?.description || "--";
|
|
@@ -6,7 +6,7 @@ import { SarifBuilder, SarifRunBuilder, SarifResultBuilder, SarifRuleBuilder } f
|
|
|
6
6
|
import { createWriteStream } from "fs";
|
|
7
7
|
import { JsonStreamStringify } from "json-stream-stringify";
|
|
8
8
|
import { getRuleDescription } from "./config.resolver.js";
|
|
9
|
-
import {
|
|
9
|
+
import { replaceNamespaceinRules, toCSVRow, toSarifResult } from "../utils/lintResultsUtil.js";
|
|
10
10
|
import { processArtifacts } from "./artifact-processor.js";
|
|
11
11
|
var ReportGenerator = class {
|
|
12
12
|
/**
|
|
@@ -97,7 +97,7 @@ var ReportGenerator = class {
|
|
|
97
97
|
*/
|
|
98
98
|
static addResultsToSarif(runBuilder, lintResult) {
|
|
99
99
|
lintResult.messages.forEach((message) => {
|
|
100
|
-
const resultBuilder = new SarifResultBuilder().initSimple(
|
|
100
|
+
const resultBuilder = new SarifResultBuilder().initSimple(toSarifResult(lintResult, message));
|
|
101
101
|
runBuilder.addResult(resultBuilder);
|
|
102
102
|
});
|
|
103
103
|
}
|
|
@@ -123,7 +123,6 @@ var CsvReportGenerator = class {
|
|
|
123
123
|
* Convert lint results to CSV-compatible data format
|
|
124
124
|
*/
|
|
125
125
|
static convertResultsToCsvData(results) {
|
|
126
|
-
const cwd = process.cwd();
|
|
127
126
|
const csvConfig = mkConfig({
|
|
128
127
|
fieldSeparator: ",",
|
|
129
128
|
quoteStrings: true,
|
|
@@ -132,24 +131,13 @@ var CsvReportGenerator = class {
|
|
|
132
131
|
useBom: true,
|
|
133
132
|
useKeysAsHeaders: true
|
|
134
133
|
});
|
|
135
|
-
const
|
|
134
|
+
const transformedResults = [];
|
|
136
135
|
results.forEach((result) => {
|
|
137
136
|
result.messages.forEach((message) => {
|
|
138
|
-
|
|
139
|
-
"File Path": path.relative(cwd, result.filePath),
|
|
140
|
-
"Message": parseText(message.message),
|
|
141
|
-
"Severity": "error",
|
|
142
|
-
"Rule ID": replaceNamespaceinRules(message.ruleId || "N/A"),
|
|
143
|
-
"Start Line": message.line,
|
|
144
|
-
"Start Column": message.column,
|
|
145
|
-
"End Line": message.endLine || message.line,
|
|
146
|
-
// Default to start line if missing
|
|
147
|
-
"End Column": message.endColumn || message.column
|
|
148
|
-
// Default to start column if missing
|
|
149
|
-
});
|
|
137
|
+
transformedResults.push(toCSVRow(result, message));
|
|
150
138
|
});
|
|
151
139
|
});
|
|
152
|
-
return generateCsv(csvConfig)(
|
|
140
|
+
return generateCsv(csvConfig)(transformedResults);
|
|
153
141
|
}
|
|
154
142
|
};
|
|
155
143
|
export {
|
package/build/types/index.d.ts
CHANGED
|
@@ -77,3 +77,13 @@ export interface PrintOptions {
|
|
|
77
77
|
editor?: string;
|
|
78
78
|
cwd?: string;
|
|
79
79
|
}
|
|
80
|
+
export interface CsvRowEntry {
|
|
81
|
+
"File Path": string;
|
|
82
|
+
"Message": string;
|
|
83
|
+
"Severity": string;
|
|
84
|
+
"Rule ID": string;
|
|
85
|
+
"Start Line": number;
|
|
86
|
+
"Start Column": number;
|
|
87
|
+
"End Line": number;
|
|
88
|
+
"End Column": number;
|
|
89
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LintResult, LintResultEntry, SarifResultEntry, LintResultSummary, PrintOptions } from '../types';
|
|
1
|
+
import { LintResult, LintResultEntry, SarifResultEntry, LintResultSummary, PrintOptions, CsvRowEntry } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
*
|
|
4
4
|
* @param id - Rule id
|
|
@@ -18,4 +18,5 @@ export declare function parseText(text: string): string;
|
|
|
18
18
|
* @param editor - The chosen editor for clickable links (e.g., "vscode", "atom", "sublime"). If not provided, will auto-detect.
|
|
19
19
|
*/
|
|
20
20
|
export declare function printLintResults(results: LintResult[], options?: PrintOptions): LintResultSummary;
|
|
21
|
-
export declare function
|
|
21
|
+
export declare function toSarifResult(lintResult: LintResult, entry: LintResultEntry): SarifResultEntry;
|
|
22
|
+
export declare function toCSVRow(lintResult: LintResult, entry: LintResultEntry): CsvRowEntry;
|
|
@@ -4,7 +4,7 @@ import { createClickableLineCol } from "./editorLinkUtil.js";
|
|
|
4
4
|
import { Logger } from "../utils/logger.js";
|
|
5
5
|
import { Colors } from "./colors.js";
|
|
6
6
|
function replaceNamespaceinRules(id) {
|
|
7
|
-
return id
|
|
7
|
+
return id?.replace("@salesforce-ux/", "") ?? "N/A";
|
|
8
8
|
}
|
|
9
9
|
function parseText(text) {
|
|
10
10
|
let safeText = text;
|
|
@@ -90,21 +90,37 @@ ${Colors.info.underline(relativeFile)}
|
|
|
90
90
|
}
|
|
91
91
|
return { totalErrors, totalWarnings, fixableErrors, fixableWarnings };
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function getLevel(severity) {
|
|
94
|
+
return severity === 2 ? "error" : "warning";
|
|
95
|
+
}
|
|
96
|
+
function toSarifResult(lintResult, entry) {
|
|
94
97
|
return {
|
|
95
98
|
ruleId: replaceNamespaceinRules(entry.ruleId),
|
|
96
|
-
level,
|
|
99
|
+
level: getLevel(entry.severity),
|
|
97
100
|
messageText: parseText(entry.message),
|
|
98
101
|
fileUri: path.relative(process.cwd(), lintResult.filePath),
|
|
99
102
|
startLine: entry.line,
|
|
100
103
|
startColumn: entry.column,
|
|
101
|
-
endLine: entry.line,
|
|
102
|
-
endColumn: entry.endColumn
|
|
104
|
+
endLine: entry.endLine || entry.line,
|
|
105
|
+
endColumn: entry.endColumn || entry.column
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function toCSVRow(lintResult, entry) {
|
|
109
|
+
return {
|
|
110
|
+
"File Path": path.relative(process.cwd(), lintResult.filePath),
|
|
111
|
+
"Message": parseText(entry.message),
|
|
112
|
+
"Severity": getLevel(entry.severity),
|
|
113
|
+
"Rule ID": replaceNamespaceinRules(entry.ruleId),
|
|
114
|
+
"Start Line": entry.line,
|
|
115
|
+
"Start Column": entry.column,
|
|
116
|
+
"End Line": entry.endLine || entry.line,
|
|
117
|
+
"End Column": entry.endColumn || entry.column
|
|
103
118
|
};
|
|
104
119
|
}
|
|
105
120
|
export {
|
|
106
121
|
parseText,
|
|
107
122
|
printLintResults,
|
|
108
123
|
replaceNamespaceinRules,
|
|
109
|
-
|
|
124
|
+
toCSVRow,
|
|
125
|
+
toSarifResult
|
|
110
126
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce-ux/slds-linter",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "SLDS Linter CLI tool for linting styles and components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lightning design system linter",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
],
|
|
30
30
|
"bin": "build/index.js",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@salesforce-ux/eslint-plugin-slds": "1.1.
|
|
32
|
+
"@salesforce-ux/eslint-plugin-slds": "1.1.1",
|
|
33
33
|
"@typescript-eslint/eslint-plugin": "^8.36.0",
|
|
34
34
|
"@typescript-eslint/parser": "^8.36.0",
|
|
35
35
|
"chalk": "^4.1.2",
|