@salesforce-ux/slds-linter 1.0.8-internal → 1.0.10-internal
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 +1 -1
- package/build/services/batch-processor.js +6 -0
- package/build/services/config.resolver.js +3 -157
- package/build/services/progress-handler.d.ts +25 -0
- package/build/services/progress-handler.js +56 -0
- package/build/utils/lintResultsUtil.js +33 -12
- package/build/workers/eslint.worker.d.ts +7 -1
- package/build/workers/eslint.worker.js +11 -5
- package/package.json +3 -2
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.0.
|
|
22
|
+
program.description("SLDS Linter CLI tool for linting styles and components").version("1.0.10-internal");
|
|
23
23
|
}
|
|
24
24
|
registerLintCommand(program);
|
|
25
25
|
registerReportCommand(program);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { Worker } from "worker_threads";
|
|
3
3
|
import os from "os";
|
|
4
4
|
import { Logger } from "../utils/logger.js";
|
|
5
|
+
import { ProgressHandler } from "./progress-handler.js";
|
|
5
6
|
var AVAILABLE_CPUS = os.cpus().length - 1;
|
|
6
7
|
var BatchProcessor = class {
|
|
7
8
|
static DEFAULT_MAX_WORKERS = Math.max(1, Math.min(4, AVAILABLE_CPUS));
|
|
@@ -22,6 +23,7 @@ var BatchProcessor = class {
|
|
|
22
23
|
const results = [];
|
|
23
24
|
const activeWorkers = /* @__PURE__ */ new Set();
|
|
24
25
|
let currentBatchIndex = 0;
|
|
26
|
+
const progress = new ProgressHandler({ total: batches.length });
|
|
25
27
|
try {
|
|
26
28
|
while (currentBatchIndex < batches.length || activeWorkers.size > 0) {
|
|
27
29
|
while (activeWorkers.size < maxWorkers && currentBatchIndex < batches.length) {
|
|
@@ -36,6 +38,7 @@ var BatchProcessor = class {
|
|
|
36
38
|
worker.on("message", (result) => {
|
|
37
39
|
results.push(result);
|
|
38
40
|
activeWorkers.delete(worker);
|
|
41
|
+
progress.increment();
|
|
39
42
|
Logger.debug(`Completed batch ${batchIndex} of ${batches.length}`);
|
|
40
43
|
}).on("error", (error) => {
|
|
41
44
|
results.push({
|
|
@@ -44,6 +47,7 @@ var BatchProcessor = class {
|
|
|
44
47
|
results: []
|
|
45
48
|
});
|
|
46
49
|
activeWorkers.delete(worker);
|
|
50
|
+
progress.increment();
|
|
47
51
|
Logger.error(`Worker error in batch ${batchIndex}: ${error.message}`);
|
|
48
52
|
}).on("exit", (code) => {
|
|
49
53
|
if (code !== 0) {
|
|
@@ -54,8 +58,10 @@ var BatchProcessor = class {
|
|
|
54
58
|
}
|
|
55
59
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
56
60
|
}
|
|
61
|
+
progress.stop();
|
|
57
62
|
return results;
|
|
58
63
|
} catch (error) {
|
|
64
|
+
progress.stop();
|
|
59
65
|
Logger.error(`Batch processing failed: ${error.message}`);
|
|
60
66
|
throw error;
|
|
61
67
|
} finally {
|
|
@@ -1,166 +1,12 @@
|
|
|
1
1
|
// src/services/config.resolver.ts
|
|
2
2
|
import { resolvePath } from "../utils/nodeVersionUtil.js";
|
|
3
|
-
|
|
4
|
-
// yaml-file:/Users/ritesh.kumar2/Documents/projects/stylelint-sds/packages/eslint-plugin-slds/src/config/rule-messages.yml
|
|
5
|
-
var rule_messages_default = {
|
|
6
|
-
"no-slds-class-overrides": {
|
|
7
|
-
"description": "Create new custom CSS classes instead of overriding SLDS selectors",
|
|
8
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-slds-class-overrides",
|
|
9
|
-
"type": "problem",
|
|
10
|
-
"messages": {
|
|
11
|
-
"sldsClassOverride": "Overriding .{{className}} isn't supported. To differentiate SLDS and custom classes, create a CSS class in your namespace. Examples: myapp-input, myapp-button."
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
"no-deprecated-slds-classes": {
|
|
15
|
-
"description": "Please replace the deprecated classes with a modern equivalent",
|
|
16
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-deprecated-slds-classes",
|
|
17
|
-
"type": "problem",
|
|
18
|
-
"messages": {
|
|
19
|
-
"deprecatedClass": "The class {{className}} is deprecated and not available in SLDS2. Please update to a supported class."
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
"no-deprecated-tokens-slds1": {
|
|
23
|
-
"description": "Update outdated design tokens to SLDS 2 styling hooks with similar values. For more information, see Styling Hooks on lightningdesignsystem.com.",
|
|
24
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-deprecated-tokens-slds1",
|
|
25
|
-
"type": "problem",
|
|
26
|
-
"messages": {
|
|
27
|
-
"deprecatedToken": "Consider removing {{oldValue}} or replacing it with {{newValue}}. Set the fallback to {{oldValue}}. For more info, see Styling Hooks on lightningdesignsystem.com.",
|
|
28
|
-
"noReplacement": "Update outdated design tokens to SLDS 2 styling hooks with similar values. For more information, see Styling Hooks on lightningdesignsystem.com."
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"enforce-sds-to-slds-hooks": {
|
|
32
|
-
"description": "Convert your existing --sds styling hooks to --slds styling hooks. See lightningdesignsystem.com for more info.",
|
|
33
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#enforce-sds-to-slds-hooks",
|
|
34
|
-
"type": "problem",
|
|
35
|
-
"messages": {
|
|
36
|
-
"replaceSdsWithSlds": "Replace {{oldValue}} with {{suggestedMatch}} styling hook."
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
"enforce-bem-usage": {
|
|
40
|
-
"description": "Replace BEM double-dash syntax in class names with single underscore syntax",
|
|
41
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#enforce-bem-usage",
|
|
42
|
-
"type": "problem",
|
|
43
|
-
"messages": {
|
|
44
|
-
"bemDoubleDash": "{{actual}} has been retired. Update it to the new name {{newValue}}.",
|
|
45
|
-
"fixBemNaming": "Update to correct BEM naming convention"
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
"modal-close-button-issue": {
|
|
49
|
-
"description": "Update component attributes or CSS classes for the modal close button to comply with the modal component blueprint",
|
|
50
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#modal-close-button-issue",
|
|
51
|
-
"type": "problem",
|
|
52
|
-
"messages": {
|
|
53
|
-
"modalCloseButtonIssue": "Update component attributes or CSS classes for the modal close button to comply with the modal component blueprint.",
|
|
54
|
-
"removeClass": "Remove the slds-button_icon-inverse class from the modal close button in components that use the SLDS modal blueprint.",
|
|
55
|
-
"changeVariant": "Change the variant attribute value from bare-inverse to bare in <lightning-button-icon> or <lightning-icon>.",
|
|
56
|
-
"removeVariant": "Remove the variant attribute from the <lightning-icon> component inside the <button> element.",
|
|
57
|
-
"ensureButtonClasses": "Add or move slds-button and slds-button_icon to the class attribute of the <button> element or <lightning-button-icon> component.",
|
|
58
|
-
"ensureSizeAttribute": "To size icons properly, set the size attribute \u200Cto large in the <lightning-icon> and <lightning-button-icon> components."
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
"no-deprecated-classes-slds2": {
|
|
62
|
-
"description": "Replace classes that aren't available with SLDS 2 classes",
|
|
63
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-deprecated-classes-slds2",
|
|
64
|
-
"type": "problem",
|
|
65
|
-
"messages": {
|
|
66
|
-
"deprecatedClass": "The class {{className}} isn't available in SLDS 2. Update it to a class supported in SLDS 2. See lightningdesignsystem.com for more information.",
|
|
67
|
-
"updateToModernClass": "Replace deprecated class with modern equivalent",
|
|
68
|
-
"checkDocumentation": "See lightningdesignsystem.com for SLDS 2 class alternatives"
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
"lwc-token-to-slds-hook": {
|
|
72
|
-
"description": "Replace the deprecated --lwc tokens with the latest --slds tokens. See lightningdesignsystem.com for more info.",
|
|
73
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#lwc-token-to-slds-hook",
|
|
74
|
-
"type": "problem",
|
|
75
|
-
"messages": {
|
|
76
|
-
"errorWithReplacement": "The '{{oldValue}}' design token is deprecated. Replace it with '{{newValue}}'. For more info, see Global Styling Hooks on lightningdesignsystem.com.",
|
|
77
|
-
"errorWithStyleHooks": "The '{{oldValue}}' design token is deprecated. Replace it with the SLDS 2 '{{newValue}}' styling hook and set the fallback to '{{oldValue}}'. For more info, see Global Styling Hooks on lightningdesignsystem.com.",
|
|
78
|
-
"errorWithNoRecommendation": "The '{{oldValue}}' design token is deprecated. For more info, see the New Global Styling Hook Guidance on lightningdesignsystem.com."
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
"no-sldshook-fallback-for-lwctoken": {
|
|
82
|
-
"description": "Avoid using --slds styling hooks as fallback values for --lwc tokens.",
|
|
83
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-sldshook-fallback-for-lwctoken",
|
|
84
|
-
"type": "problem",
|
|
85
|
-
"messages": {
|
|
86
|
-
"unsupportedFallback": "Remove the {{sldsToken}} styling hook that is used as a fallback value for {{lwcToken}}."
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
"no-unsupported-hooks-slds2": {
|
|
90
|
-
"description": "Identifies styling hooks that aren't present in SLDS 2. They must be replaced with styling hooks that have a similar effect, or they must be removed.",
|
|
91
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-unsupported-hooks-slds2",
|
|
92
|
-
"type": "problem",
|
|
93
|
-
"messages": {
|
|
94
|
-
"deprecated": "The {{token}} styling hook isn't present in SLDS 2 and there's no equivalent replacement. Remove it or replace it with a styling hook with a similar effect."
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
"no-slds-var-without-fallback": {
|
|
98
|
-
"description": "Add fallback values to SLDS styling hooks. The fallback values are used in Salesforce environments where styling hooks are unavailable.",
|
|
99
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-slds-var-without-fallback",
|
|
100
|
-
"type": "problem",
|
|
101
|
-
"messages": {
|
|
102
|
-
"varWithoutFallback": "Your code uses the {{cssVar}} styling hook without a fallback value. Styling hooks are unavailable in some Salesforce environments. To render your component correctly in all environments, add this fallback value: var({{cssVar}}, {{recommendation}}). To make this fallback value brand-aware, use a branded design token instead of a static value. See Design Tokens on v1.lightningdesignsystem.com."
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
"no-slds-namespace-for-custom-hooks": {
|
|
106
|
-
"description": "To differentiate custom styling hooks from SLDS styling hooks, create custom styling hooks in your namespace.",
|
|
107
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-slds-namespace-for-custom-hooks",
|
|
108
|
-
"type": "problem",
|
|
109
|
-
"messages": {
|
|
110
|
-
"customHookNamespace": "Using the --slds namespace for {{token}} isn't supported. Create the custom styling hook in your namespace. Example: --myapp-{{tokenWithoutNamespace}}"
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
"no-slds-private-var": {
|
|
114
|
-
"description": "Some SLDS styling hooks are private and reserved only for internal Salesforce use. Private SLDS styling hooks have prefixes --_slds- and --slds-s-. For more information, look up private CSS in lightningdesignsystem.com.",
|
|
115
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-slds-private-var",
|
|
116
|
-
"type": "problem",
|
|
117
|
-
"messages": {
|
|
118
|
-
"privateVar": "This styling hook is reserved for internal Salesforce use. Remove the --_slds- or \u2013slds-s private variable within selector {{prop}}. For more information, look up private CSS in lightningdesignsystem.com."
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
"enforce-component-hook-naming-convention": {
|
|
122
|
-
"description": "Replace component styling hooks that use a deprecated naming convention.",
|
|
123
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#enforce-component-hook-naming-convention",
|
|
124
|
-
"type": "problem",
|
|
125
|
-
"messages": {
|
|
126
|
-
"replace": "Replace the deprecated {{oldValue}} component styling hook with {{suggestedMatch}}."
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
"no-hardcoded-values-slds1": {
|
|
130
|
-
"description": "Replace static values with SLDS 1 design tokens. For more information, look up design tokens on lightningdesignsystem.com.",
|
|
131
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-hardcoded-value",
|
|
132
|
-
"type": "suggestion",
|
|
133
|
-
"messages": {
|
|
134
|
-
"hardcodedValue": "Replace the {{oldValue}} static value with an SLDS 1 styling hook: {{newValue}}.",
|
|
135
|
-
"noReplacement": "There's no replacement styling hook for the {{oldValue}} static value. Remove the static value."
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
"no-hardcoded-values-slds2": {
|
|
139
|
-
"description": "Replace static values with SLDS 2 styling hooks. For more information, look up design tokens on lightningdesignsystem.com.",
|
|
140
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#no-hardcoded-values-slds2",
|
|
141
|
-
"type": "suggestion",
|
|
142
|
-
"messages": {
|
|
143
|
-
"hardcodedValue": "Consider replacing the {{oldValue}} static value with an SLDS 2 styling hook that has a similar value: {{newValue}}.",
|
|
144
|
-
"noReplacement": "There's no replacement styling hook for the {{oldValue}} static value. Remove the static value."
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
"reduce-annotations": {
|
|
148
|
-
"description": "Remove your annotations and update your code.",
|
|
149
|
-
"url": "https://developer.salesforce.com/docs/platform/slds-linter/guide/reference-rules.html#reduce-annotations",
|
|
150
|
-
"type": "problem",
|
|
151
|
-
"messages": {
|
|
152
|
-
"removeAnnotation": "Remove this annotation and update the code to SLDS best practices. For help, file an issue at https://github.com/salesforce-ux/slds-linter/"
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
// src/services/config.resolver.ts
|
|
3
|
+
import ruleMessages from "@salesforce-ux/eslint-plugin-slds/rule-messages";
|
|
158
4
|
var DEFAULT_ESLINT_CONFIG_PATH = resolvePath("@salesforce-ux/eslint-plugin-slds/config", import.meta);
|
|
159
5
|
var ESLINT_VERSION = "9.36.0";
|
|
160
|
-
var LINTER_CLI_VERSION = "1.0.
|
|
6
|
+
var LINTER_CLI_VERSION = "1.0.10-internal";
|
|
161
7
|
var getRuleDescription = (ruleId) => {
|
|
162
8
|
const ruleIdWithoutNameSpace = `${ruleId}`.replace(/\@salesforce-ux\//, "").replace(/^slds\//, "");
|
|
163
|
-
return
|
|
9
|
+
return ruleMessages[ruleIdWithoutNameSpace]?.description || "--";
|
|
164
10
|
};
|
|
165
11
|
export {
|
|
166
12
|
DEFAULT_ESLINT_CONFIG_PATH,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface ProgressHandlerOptions {
|
|
2
|
+
total: number;
|
|
3
|
+
format?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class ProgressHandler {
|
|
6
|
+
private progressBar;
|
|
7
|
+
private completed;
|
|
8
|
+
constructor(options: ProgressHandlerOptions);
|
|
9
|
+
/**
|
|
10
|
+
* Increment progress by one unit
|
|
11
|
+
*/
|
|
12
|
+
increment(): void;
|
|
13
|
+
/**
|
|
14
|
+
* Update progress to a specific value
|
|
15
|
+
*/
|
|
16
|
+
update(value: number): void;
|
|
17
|
+
/**
|
|
18
|
+
* Stop and cleanup the progress bar
|
|
19
|
+
*/
|
|
20
|
+
stop(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Get current progress value
|
|
23
|
+
*/
|
|
24
|
+
getCompleted(): number;
|
|
25
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// src/services/progress-handler.ts
|
|
2
|
+
import cliProgress from "cli-progress";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
var ProgressHandler = class {
|
|
5
|
+
progressBar = null;
|
|
6
|
+
completed = 0;
|
|
7
|
+
constructor(options) {
|
|
8
|
+
const format = options.format || `Processing [{bar}] {percentage}% ({value}/{total})`;
|
|
9
|
+
const isCI = String(process.env.CI || "").toLowerCase() === "true" || process.env.CI === "1";
|
|
10
|
+
const isTTY = Boolean(process.stdout.isTTY);
|
|
11
|
+
if (!isTTY || isCI) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
this.progressBar = new cliProgress.SingleBar({
|
|
15
|
+
format,
|
|
16
|
+
barCompleteChar: "\u2588",
|
|
17
|
+
barIncompleteChar: "\u2591",
|
|
18
|
+
hideCursor: true,
|
|
19
|
+
formatBar: (progress, options2) => {
|
|
20
|
+
const completeSize = Math.round(progress * options2.barsize);
|
|
21
|
+
const incompleteSize = options2.barsize - completeSize;
|
|
22
|
+
return chalk.cyan(options2.barCompleteChar.repeat(completeSize)) + chalk.cyanBright(options2.barIncompleteChar.repeat(incompleteSize));
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
this.progressBar.start(options.total, 0);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Increment progress by one unit
|
|
29
|
+
*/
|
|
30
|
+
increment() {
|
|
31
|
+
this.completed++;
|
|
32
|
+
this.progressBar?.update(this.completed);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Update progress to a specific value
|
|
36
|
+
*/
|
|
37
|
+
update(value) {
|
|
38
|
+
this.completed = value;
|
|
39
|
+
this.progressBar?.update(value);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Stop and cleanup the progress bar
|
|
43
|
+
*/
|
|
44
|
+
stop() {
|
|
45
|
+
this.progressBar?.stop();
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Get current progress value
|
|
49
|
+
*/
|
|
50
|
+
getCompleted() {
|
|
51
|
+
return this.completed;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
ProgressHandler
|
|
56
|
+
};
|
|
@@ -16,6 +16,34 @@ function parseText(text) {
|
|
|
16
16
|
}
|
|
17
17
|
return safeText.endsWith(".") ? safeText : `${safeText}.`;
|
|
18
18
|
}
|
|
19
|
+
function printTotalViolationsSummary(totalErrors, totalWarnings) {
|
|
20
|
+
const totalProblems = totalErrors + totalWarnings;
|
|
21
|
+
let totalProblemsText = `${totalProblems} SLDS Violation${totalProblems !== 1 ? "s" : ""}`;
|
|
22
|
+
if (totalErrors > 0) {
|
|
23
|
+
totalProblemsText = Colors.error(`\u2716 ${totalProblemsText}`);
|
|
24
|
+
} else {
|
|
25
|
+
totalProblemsText = Colors.warning(`\u26A0 ${totalProblemsText}`);
|
|
26
|
+
}
|
|
27
|
+
const totalBreakdown = [
|
|
28
|
+
Colors.error(`${totalErrors} error${totalErrors !== 1 ? "s" : ""}`),
|
|
29
|
+
Colors.warning(`${totalWarnings} warning${totalWarnings !== 1 ? "s" : ""}`)
|
|
30
|
+
];
|
|
31
|
+
console.log(`${totalProblemsText} (${totalBreakdown.join(", ")})`);
|
|
32
|
+
}
|
|
33
|
+
function printFixableViolationsSummary(fixableErrors, fixableWarnings) {
|
|
34
|
+
const fixableTotal = fixableErrors + fixableWarnings;
|
|
35
|
+
if (!fixableTotal) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const fixableBreakdown = [];
|
|
39
|
+
if (fixableErrors > 0) {
|
|
40
|
+
fixableBreakdown.push(Colors.error(`${fixableErrors} error${fixableErrors !== 1 ? "s" : ""}`));
|
|
41
|
+
}
|
|
42
|
+
if (fixableWarnings > 0) {
|
|
43
|
+
fixableBreakdown.push(Colors.warning(`${fixableWarnings} warning${fixableWarnings !== 1 ? "s" : ""}`));
|
|
44
|
+
}
|
|
45
|
+
console.log(` ${fixableBreakdown.join(" and ")} potentially fixable with the \`--fix\` option.`);
|
|
46
|
+
}
|
|
19
47
|
function printLintResults(results, editor) {
|
|
20
48
|
let totalErrors = 0;
|
|
21
49
|
let totalWarnings = 0;
|
|
@@ -53,19 +81,12 @@ ${Colors.info.underline(relativeFile)}
|
|
|
53
81
|
});
|
|
54
82
|
}
|
|
55
83
|
});
|
|
56
|
-
|
|
57
|
-
if (
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const problemsText = `\u2716 ${totalProblems} SLDS Violation${totalProblems !== 1 ? "s" : ""} (${totalErrors} error${totalErrors !== 1 ? "s" : ""}, ${totalWarnings} warning${totalWarnings !== 1 ? "s" : ""})`;
|
|
61
|
-
console.log(chalkColorFn(problemsText));
|
|
62
|
-
const fixableTotal = fixableErrors + fixableWarnings;
|
|
63
|
-
if (fixableTotal > 0) {
|
|
64
|
-
const fixableText = ` ${fixableErrors} error${fixableErrors !== 1 ? "s" : ""} and ${fixableWarnings} warning${fixableWarnings !== 1 ? "s" : ""} potentially fixable with the \`--fix\` option.`;
|
|
65
|
-
console.log(chalkColorFn(fixableText));
|
|
66
|
-
}
|
|
84
|
+
Logger.newLine();
|
|
85
|
+
if (totalErrors > 0 || totalWarnings > 0) {
|
|
86
|
+
printTotalViolationsSummary(totalErrors, totalWarnings);
|
|
87
|
+
printFixableViolationsSummary(fixableErrors, fixableWarnings);
|
|
67
88
|
} else {
|
|
68
|
-
Logger.
|
|
89
|
+
Logger.success("No SLDS Violations found.");
|
|
69
90
|
}
|
|
70
91
|
return { totalErrors, totalWarnings, fixableErrors, fixableWarnings };
|
|
71
92
|
}
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { BaseWorker } from './base.worker';
|
|
2
|
+
import { WorkerConfig, WorkerResult } from '../types';
|
|
3
|
+
export declare class ESLintWorker extends BaseWorker<WorkerConfig, WorkerResult> {
|
|
4
|
+
private eslint;
|
|
5
|
+
constructor();
|
|
6
|
+
protected processFile(filePath: string): Promise<WorkerResult>;
|
|
7
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/workers/eslint.worker.ts
|
|
2
2
|
import { ESLint } from "eslint";
|
|
3
|
+
import { isMainThread } from "worker_threads";
|
|
3
4
|
import { BaseWorker } from "./base.worker.js";
|
|
4
5
|
var ESLintWorker = class extends BaseWorker {
|
|
5
6
|
eslint;
|
|
@@ -29,8 +30,13 @@ var ESLintWorker = class extends BaseWorker {
|
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
};
|
|
32
|
-
|
|
33
|
-
worker
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
if (!isMainThread) {
|
|
34
|
+
const worker = new ESLintWorker();
|
|
35
|
+
worker.process().catch((error) => {
|
|
36
|
+
console.error("Worker failed:", error);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
ESLintWorker
|
|
42
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce-ux/slds-linter",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10-internal",
|
|
4
4
|
"description": "SLDS Linter CLI tool for linting styles and components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lightning design system linter",
|
|
@@ -29,10 +29,11 @@
|
|
|
29
29
|
],
|
|
30
30
|
"bin": "build/index.js",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@salesforce-ux/eslint-plugin-slds": "1.0.
|
|
32
|
+
"@salesforce-ux/eslint-plugin-slds": "1.0.10-internal",
|
|
33
33
|
"@typescript-eslint/eslint-plugin": "^8.36.0",
|
|
34
34
|
"@typescript-eslint/parser": "^8.36.0",
|
|
35
35
|
"chalk": "^4.1.2",
|
|
36
|
+
"cli-progress": "^3.12.0",
|
|
36
37
|
"commander": "^13.1.0",
|
|
37
38
|
"eslint": "^9.0.0",
|
|
38
39
|
"export-to-csv": "^1.4.0",
|