@salesforce-ux/slds-linter 0.0.12-alpha.6 → 0.1.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/README.md CHANGED
@@ -9,8 +9,8 @@ SLDS Linter provides custom linting rules specifically built for Salesforce Ligh
9
9
  - Component Linting:
10
10
  The utility supports linting for two types of Salesforce Lightning components:
11
11
 
12
- - LWC and Aura components.
13
- LWC Components (.html): Linting is applied to Lightning Web Components.
12
+ LWC and Aura components.
13
+ - LWC Components (.html): Linting is applied to Lightning Web Components.
14
14
  - Aura Components (.cmp): Linting is applied to Aura Components.
15
15
 
16
16
  * Stylelint for CSS Files:
@@ -29,6 +29,15 @@ SLDS Linter CLI tool works best with the [Active LTS](https://nodejs.org/en/abou
29
29
  #### **Minimum Required Node.js Version**
30
30
  - The minimum supported Node.js version is **v20.18.3**.
31
31
  - We recommend using the latest **Active LTS** release for the best performance and compatibility.
32
+ - The tool verifies the Node.js version at the beginning of the process. If the Node.js requirements are met, the subsequent steps will proceed smoothly.
33
+
34
+ #### Extensions
35
+ To enhance your linting and error analysis experience, consider installing the following VSCode extensions:
36
+
37
+ - *[ESLint Extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)*: This extension is essential for JavaScript/TypeScript linting and will show squiggly lines over code that violates the ESLint rules.
38
+ - *[Stylelint Extension](https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint)*: For linting CSS, SCSS, and other stylesheets, this extension will highlight errors with squiggly lines.
39
+ - *[SARIF Viewer Extension](https://marketplace.visualstudio.com/items?itemName=MS-SarifVSCode.sarif-viewer)*: For better viewing and navigating through SARIF files.
40
+ These extensions will significantly improve your development workflow and make it easier to navigate and address linting issues.
32
41
 
33
42
 
34
43
  ### Command-Line Interface (CLI)
@@ -37,20 +46,21 @@ To see what all options does slds-linter provide please run `npx @salesforce-ux/
37
46
  For the first time, it will ask to install the package. Please reply with `y` as yes to install the package.
38
47
 
39
48
  ```
40
- Usage: npx @salesforce-ux/slds-linter@latest [options] [command]
49
+ Usage: npx @salesforce-ux/slds-linter@latest [options] [command]
41
50
 
42
- A CLI tool for linting styles and components
51
+ SLDS Linter CLI tool for linting styles and components
43
52
 
44
53
  Options:
45
- -V, --version output the version number
46
- -h, --help display help for command
54
+ -V, --version output the version number
55
+ -h, --help display help for command
47
56
 
48
57
  Commands:
49
- lint:styles [options] Run stylelint on all style files
50
- lint:components [options] Run eslint on all markup files
51
- lint [options] Run both style and component linting
52
- report [options] Generate SARIF report from linting results
53
- help [command] display help for command
58
+ lint:styles [options] Run stylelint on all style files
59
+ lint:components [options] Run eslint on all markup files
60
+ lint [options] Run both style and component linting
61
+ report [options] Generate SARIF report from linting results
62
+ emit [options] Emits the configuration files used by slds-linter cli
63
+ help [command] display help for command
54
64
  ```
55
65
 
56
66
  - `npx @salesforce-ux/slds-linter lint` - Runs the ESlint and Stylelint rules on your HTML/CSS/CMP files and outputs issues.
@@ -58,6 +68,7 @@ help [command] display help for command
58
68
  - `npx @salesforce-ux/slds-linter lint:components` - Runs the ESlint rules on your HTML/CMP files and outputs issues.
59
69
  - `npx @salesforce-ux/slds-linter fix`: Attempts to automatically fix violations.
60
70
  - `npx @salesforce-ux/slds-linter report`: Generates a SARIF report for static analysis.
71
+ - `npx @salesforce-ux/slds-linter emit`: Emits the configuration files used by slds-linter cli (defaults to current directory).
61
72
 
62
73
  #### Options available with each command
63
74
 
@@ -66,20 +77,28 @@ help [command] display help for command
66
77
  | `-d, --directory <path>` | Target directory to scan (defaults to current directory) | lint, lint:styles, lint:components, report |
67
78
  | `-o, --output <path>` | Output directory for reports (defaults to current directory) | report |
68
79
  | `--fix` | Automatically fix problems | lint, lint:styles, lint:components |
69
- | `--config <path>` | Path to eslint/stylelint config file', DEFAULT_ESLINT_CONFIG_PATH | lint:styles, lint:components |
70
- | `--config-style <path>` | PPath to stylelint config file', DEFAULT_STYLELINT_CONFIG_PATH | lint |
71
- | `--config-eslint <path>` | Path to eslint config file', DEFAULT_ESLINT_CONFIG_PATH | lint |
80
+ | `--config <path>` | Path to eslint/stylelint config file' | lint:styles, lint:components |
81
+ | `--config-style <path>` | Path to stylelint config file' | lint |
82
+ | `--config-eslint <path>` | Path to eslint config file' | lint |
72
83
  | `--editor <editor>` | Editor to open files with (e.g., vscode, atom, sublime). Defaults to vscode | lint,lint:styles, lint:components |
73
84
 
74
-
75
85
  These options can also be visualised by using `--help` with each command. For example: Running `slds-linter lint --help` will give the options which can be used along with `lint`.
76
86
 
77
87
  #### Detailed Steps
78
88
 
79
- 1. Run `npx @salesforce-ux/slds-linter lint` to see the lint output on terminal. For specific files, you can go ahead with either `npx @salesforce-ux/slds-linter lint:styles` for lint errors within css files or `npx @salesforce-ux/slds-linter lint:components` for lint errors within html/cmp files. To run the linting only on a specific folder, use the option `-d` to specify the directory to be linted.
80
- 2. To run SLDS Linter, in Terminal, run `npx @salesforce-ux/slds-linter report` to generate a Sarif report in the project root directory. To run it on a different directory, use `-d` to run the report on that directory. For output, `-o` can be used to specify a different output folder for the genreated sarif. It will be named as `slds-linter-report.sarif`.
81
- 3. Open the generated Sarif file.
82
- 4. Make a note of how many components SLDS Linter has identified that you must update.
83
- 5. Run `npx @salesforce-ux/slds-linter fix` to automatically fix validation errors in bulk.
89
+ 1. Run `npx @salesforce-ux/slds-linter lint` to see the lint output on terminal. For specific files, you can go ahead with either `npx @salesforce-ux/slds-linter lint:styles` for lint errors within css files or `npx @salesforce-ux/slds-linter lint:components` for lint errors within html/cmp files. To run the linting only on a specific folder, use the option `-d` to specify the directory to be linted.
90
+ 2. The linting output displayed in the console includes the row and column numbers on the left. Navigate to the specific line of concern in the source code by clicking on these numbers (Command + Click on Mac).
91
+ 3. To run SLDS Linter, in Terminal, run `npx @salesforce-ux/slds-linter report` to generate a Sarif report in the project root directory. To run it on a different directory, use `-d` to run the report on that directory. For output, `-o` can be used to specify a different output folder for the genreated sarif. It will be named as `slds-linter-report.sarif`.
92
+ 4. Open the generated Sarif file.
93
+ 5. Make a note of how many components SLDS Linter has identified that you must update.
94
+ 6. Run `npx @salesforce-ux/slds-linter fix` to automatically fix validation errors in bulk.
95
+ 7. Run `npx @salesforce-ux/slds-linter emit` to emit the configuration files used by slds-linter cli, defaults to current working directory. These configuration files will be discovered by VSCode ESLint/Stylelint extensions to display squiggly lines in css/html files when opened in editor. Please ensure ESLint and Stylelint extensions are enabled.
96
+
97
+ #### Troubleshooting SARIF Viewer Navigation
98
+ If the SARIF viewer is not automatically navigating you to the line of code when you click on an error/warning, follow these steps:
99
+
100
+ - Click on "Locate" in the popup that appears from the extension.
101
+ - Locate the file in the file explorer or editor.
102
+ - Once the file is located, you should be able to click on the errors in the SARIF viewer, and it will navigate you directly to the specific line of code.
84
103
 
85
104
  For any questions or issues, feel free to reach out to the maintainers or open an issue in the repository.
@@ -0,0 +1,2 @@
1
+ import { Command } from "commander";
2
+ export declare function registerEmitCommand(program: Command): void;
@@ -0,0 +1,50 @@
1
+ // src/commands/emit.ts
2
+ import chalk from "chalk";
3
+ import { Logger } from "../utils/logger.js";
4
+ import { normalizeCliOptions } from "../utils/cli-args.js";
5
+ import {
6
+ DEFAULT_ESLINT_CONFIG_PATH,
7
+ DEFAULT_STYLELINT_CONFIG_PATH
8
+ } from "../services/config.resolver.js";
9
+ import path from "path";
10
+ import { execSync } from "child_process";
11
+ function registerEmitCommand(program) {
12
+ program.command("emit").description("Emits the configuration files used by slds-linter cli").option(
13
+ "-d, --directory <path>",
14
+ "Target directory to emit (defaults to current directory)"
15
+ ).action(async (options) => {
16
+ try {
17
+ Logger.info(chalk.blue("Emitting configuration files..."));
18
+ const normalizedOptions = normalizeCliOptions(options, {
19
+ configStyle: DEFAULT_STYLELINT_CONFIG_PATH,
20
+ configEslint: DEFAULT_ESLINT_CONFIG_PATH
21
+ });
22
+ const destStyleConfigPath = path.join(
23
+ normalizedOptions.directory,
24
+ path.basename(normalizedOptions.configStyle)
25
+ );
26
+ execSync(`cp ${normalizedOptions.configStyle} ${destStyleConfigPath}`);
27
+ Logger.success(chalk.green(`Stylelint configuration created at:
28
+ ${destStyleConfigPath}
29
+ `));
30
+ const destESLintConfigPath = path.join(
31
+ normalizedOptions.directory,
32
+ path.basename(normalizedOptions.configEslint)
33
+ );
34
+ execSync(
35
+ `cp ${normalizedOptions.configEslint} ${destESLintConfigPath}`
36
+ );
37
+ Logger.success(chalk.green(`ESLint configuration created at:
38
+ ${destESLintConfigPath}
39
+ `));
40
+ } catch (error) {
41
+ Logger.error(
42
+ chalk.red(`Failed to emit configuration: ${error.message}`)
43
+ );
44
+ process.exit(1);
45
+ }
46
+ });
47
+ }
48
+ export {
49
+ registerEmitCommand
50
+ };
@@ -22,10 +22,10 @@ function registerLintComponentsCommand(program) {
22
22
  });
23
23
  const totalFiles = fileBatches.reduce((sum, batch) => sum + batch.length, 0);
24
24
  Logger.info(chalk.blue(`Scanned ${totalFiles} file(s).`));
25
- Logger.info(chalk.blue("Running linting..."));
25
+ Logger.info(chalk.blue(`Running linting${normalizedOptions.fix ? " with autofix" : ""}...`));
26
26
  const results = await LintRunner.runLinting(fileBatches, "component", {
27
- fix: options.fix,
28
- configPath: options.config
27
+ fix: normalizedOptions.fix,
28
+ configPath: normalizedOptions.config
29
29
  });
30
30
  printLintResults(results, normalizedOptions.editor);
31
31
  const errorCount = results.reduce((sum, r) => sum + r.errors.length, 0);
@@ -13,7 +13,7 @@ function registerLintStylesCommand(program) {
13
13
  try {
14
14
  Logger.info(chalk.blue("Starting linting of style files..."));
15
15
  const normalizedOptions = normalizeCliOptions(options, {
16
- configStyle: DEFAULT_STYLELINT_CONFIG_PATH
16
+ config: DEFAULT_STYLELINT_CONFIG_PATH
17
17
  });
18
18
  Logger.info(chalk.blue("Scanning for style files..."));
19
19
  const fileBatches = await FileScanner.scanFiles(normalizedOptions.directory, {
@@ -22,10 +22,10 @@ function registerLintStylesCommand(program) {
22
22
  });
23
23
  const totalFiles = fileBatches.reduce((sum, batch) => sum + batch.length, 0);
24
24
  Logger.info(chalk.blue(`Scanned ${totalFiles} file(s).`));
25
- Logger.info(chalk.blue("Running stylelint..."));
25
+ Logger.info(chalk.blue(`Running stylelint${normalizedOptions.fix ? " with autofix" : ""}...`));
26
26
  const results = await LintRunner.runLinting(fileBatches, "style", {
27
- fix: options.fix,
28
- configPath: options.config
27
+ fix: normalizedOptions.fix,
28
+ configPath: normalizedOptions.config
29
29
  });
30
30
  printLintResults(results, normalizedOptions.editor);
31
31
  const errorCount = results.reduce((sum, r) => sum + r.errors.length, 0);
@@ -1,7 +1,5 @@
1
1
  // src/commands/lint.ts
2
2
  import chalk from "chalk";
3
- import path from "path";
4
- import { createClickableLineCol } from "../utils/editorLinkUtil.js";
5
3
  import { printLintResults } from "../utils/lintResultsUtil.js";
6
4
  import { normalizeCliOptions } from "../utils/cli-args.js";
7
5
  import { Logger } from "../utils/logger.js";
@@ -13,7 +11,7 @@ function registerLintCommand(program) {
13
11
  program.command("lint").description("Run both style and component linting").option("-d, --directory <path>", "Target directory to scan (defaults to current directory)").option("--fix", "Automatically fix problems").option("--config-style <path>", "Path to stylelint config file").option("--config-eslint <path>", "Path to eslint config file").option("--editor <editor>", "Editor to open files with (e.g., vscode, atom, sublime). Defaults to vscode", "vscode").action(async (options) => {
14
12
  const startTime = Date.now();
15
13
  try {
16
- Logger.info(chalk.blue("Starting full linting process..."));
14
+ Logger.info(chalk.blue("Starting lint process..."));
17
15
  const normalizedOptions = normalizeCliOptions(options, {
18
16
  configStyle: DEFAULT_STYLELINT_CONFIG_PATH,
19
17
  configEslint: DEFAULT_ESLINT_CONFIG_PATH
@@ -26,31 +24,12 @@ function registerLintCommand(program) {
26
24
  const totalStyleFiles = styleFileBatches.reduce((sum, batch) => sum + batch.length, 0);
27
25
  Logger.info(chalk.blue(`Found ${totalStyleFiles} style file(s). Running stylelint...
28
26
  `));
27
+ Logger.info(chalk.blue(`Running stylelint${normalizedOptions.fix ? " with autofix" : ""}...`));
29
28
  const styleResults = await LintRunner.runLinting(styleFileBatches, "style", {
30
- fix: options.fix,
31
- configPath: options.configStyle
32
- });
33
- styleResults.forEach((result) => {
34
- const hasErrors = result.errors?.length > 0;
35
- const hasWarnings = result.warnings?.length > 0;
36
- if (!hasErrors && !hasWarnings) return;
37
- const absolutePath = result.filePath || "";
38
- const relativeFile = path.relative(process.cwd(), absolutePath) || "Unknown file";
39
- Logger.info(`
40
- ${chalk.bold(relativeFile)}`);
41
- result.errors?.forEach((err) => {
42
- const lineCol = `${err.line}:${err.column}`;
43
- const clickable = createClickableLineCol(lineCol, absolutePath, err.line, err.column, normalizedOptions.editor);
44
- const ruleId = err.ruleId ? chalk.dim(err.ruleId) : "";
45
- Logger.error(` ${clickable} ${err.message} ${ruleId}`);
46
- });
47
- result.warnings?.forEach((warn) => {
48
- const lineCol = `${warn.line}:${warn.column}`;
49
- const clickable = createClickableLineCol(lineCol, absolutePath, warn.line, warn.column, normalizedOptions.editor);
50
- const ruleId = warn.ruleId ? chalk.dim(warn.ruleId) : "";
51
- Logger.warning(` ${clickable} ${warn.message} ${ruleId}`);
52
- });
29
+ fix: normalizedOptions.fix,
30
+ configPath: normalizedOptions.configStyle
53
31
  });
32
+ printLintResults(styleResults, normalizedOptions.editor);
54
33
  const styleErrorCount = styleResults.reduce((sum, r) => sum + r.errors.length, 0);
55
34
  const styleWarningCount = styleResults.reduce((sum, r) => sum + r.warnings.length, 0);
56
35
  Logger.info(chalk.blue("\nScanning component files..."));
@@ -61,9 +40,10 @@ ${chalk.bold(relativeFile)}`);
61
40
  const totalComponentFiles = componentFileBatches.reduce((sum, batch) => sum + batch.length, 0);
62
41
  Logger.info(chalk.blue(`Found ${totalComponentFiles} component file(s). Running eslint...
63
42
  `));
43
+ Logger.info(chalk.blue(`Running linting${normalizedOptions.fix ? " with autofix" : ""}...`));
64
44
  const componentResults = await LintRunner.runLinting(componentFileBatches, "component", {
65
- fix: options.fix,
66
- configPath: options.configEslint
45
+ fix: normalizedOptions.fix,
46
+ configPath: normalizedOptions.configEslint
67
47
  });
68
48
  printLintResults(componentResults, normalizedOptions.editor);
69
49
  const componentErrorCount = componentResults.reduce((sum, r) => sum + r.errors.length, 0);
@@ -22,7 +22,7 @@ function registerReportCommand(program) {
22
22
  batchSize: 100
23
23
  });
24
24
  const styleResults = await LintRunner.runLinting(styleFileBatches, "style", {
25
- configPath: options.configStyle
25
+ configPath: normalizedOptions.configStyle
26
26
  });
27
27
  spinner.text = "Running components linting...";
28
28
  const componentFileBatches = await FileScanner.scanFiles(normalizedOptions.directory, {
@@ -30,7 +30,7 @@ function registerReportCommand(program) {
30
30
  batchSize: 100
31
31
  });
32
32
  const componentResults = await LintRunner.runLinting(componentFileBatches, "component", {
33
- configPath: options.configEslint
33
+ configPath: normalizedOptions.configEslint
34
34
  });
35
35
  spinner.text = "Generating combined report...";
36
36
  const combinedReportPath = path.join(normalizedOptions.output, "slds-linter-report.sarif");
package/build/index.js CHANGED
@@ -1,4 +1,75 @@
1
1
  #!/usr/bin/env node
2
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __commonJS = (cb, mod) => function __require() {
4
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
5
+ };
6
+
7
+ // package.json
8
+ var require_package = __commonJS({
9
+ "package.json"(exports, module) {
10
+ module.exports = {
11
+ name: "@salesforce-ux/slds-linter",
12
+ version: "0.0.13-alpha.1",
13
+ description: "SLDS Linter CLI tool for linting styles and components",
14
+ keywords: [
15
+ "lightning design system linter",
16
+ "SLDS Linter",
17
+ "SLDS2 Linter",
18
+ "SLDS Stylelint",
19
+ "SLDS ESLint"
20
+ ],
21
+ author: "UXF Tooling Team",
22
+ type: "module",
23
+ main: "build/index.js",
24
+ files: [
25
+ "build/**",
26
+ "README.md"
27
+ ],
28
+ bin: {
29
+ "slds-linter": "./build/index.js"
30
+ },
31
+ scripts: {
32
+ prepublishOnly: "clean-pkg-json",
33
+ build: "gulp build",
34
+ dev: "gulp dev",
35
+ test: 'NODE_OPTIONS="$NODE_OPTIONS --experimental-vm-modules" npx jest',
36
+ lint: "eslint src/**/*.ts"
37
+ },
38
+ dependencies: {
39
+ "@salesforce-ux/eslint-plugin-slds": "0.0.13-alpha.1",
40
+ "@salesforce-ux/stylelint-plugin-slds": "0.0.13-alpha.1",
41
+ "@typescript-eslint/eslint-plugin": "^5.0.0",
42
+ "@typescript-eslint/parser": "^5.0.0",
43
+ chalk: "^4.1.2",
44
+ commander: "^13.1.0",
45
+ eslint: "^8.0.0",
46
+ glob: "^11.0.0",
47
+ "json-stream-stringify": "^3.1.6",
48
+ "node-sarif-builder": "^3.2.0",
49
+ ora: "^5.4.1",
50
+ semver: "^7.7.1",
51
+ stylelint: "^16.10.0"
52
+ },
53
+ devDependencies: {
54
+ "@types/jest": "^29.5.14",
55
+ jest: "^29.7.0",
56
+ "ts-jest": "^29.2.5"
57
+ },
58
+ license: "ISC",
59
+ repository: {
60
+ type: "git",
61
+ url: "git+https://github.com/salesforce-ux/slds-linter.git"
62
+ },
63
+ bugs: {
64
+ url: "https://github.com/salesforce-ux/slds-linter/issues"
65
+ },
66
+ homepage: "https://github.com/salesforce-ux/slds-linter/tree/main/packages/cli#slds-linter",
67
+ publishConfig: {
68
+ registry: "https://registry.npmjs.org"
69
+ }
70
+ };
71
+ }
72
+ });
2
73
 
3
74
  // src/index.ts
4
75
  import { Command } from "commander";
@@ -6,8 +77,10 @@ import { registerLintStylesCommand } from "./commands/lint-styles.js";
6
77
  import { registerLintComponentsCommand } from "./commands/lint-components.js";
7
78
  import { registerLintCommand } from "./commands/lint.js";
8
79
  import { registerReportCommand } from "./commands/report.js";
80
+ import { registerEmitCommand } from "./commands/emit.js";
9
81
  import { Logger } from "./utils/logger.js";
10
- import pkg from "../package.json" with { type: "json" };
82
+ import { validateNodeVersion } from "./utils/nodeVersionUtil.js";
83
+ validateNodeVersion();
11
84
  process.on("unhandledRejection", (error) => {
12
85
  Logger.error(`Unhandled rejection: ${error}`);
13
86
  process.exit(1);
@@ -17,9 +90,19 @@ process.on("uncaughtException", (error) => {
17
90
  process.exit(1);
18
91
  });
19
92
  var program = new Command();
20
- program.name("npx @salesforce-ux/slds-linter@latest").description(pkg.description).version(pkg.version).showHelpAfterError();
93
+ program.name("npx @salesforce-ux/slds-linter@latest").showHelpAfterError();
94
+ function registerVersion() {
95
+ let pkg = { description: "", version: "" };
96
+ try {
97
+ pkg = require_package();
98
+ } catch (e) {
99
+ }
100
+ program.description(pkg.description).version(pkg.version);
101
+ }
21
102
  registerLintStylesCommand(program);
22
103
  registerLintComponentsCommand(program);
23
104
  registerLintCommand(program);
24
105
  registerReportCommand(program);
106
+ registerEmitCommand(program);
107
+ registerVersion();
25
108
  program.parse(process.argv);
@@ -22,8 +22,7 @@ var ReportGenerator = class {
22
22
  for (const rule of rules) {
23
23
  const ruleBuilder = new SarifRuleBuilder().initSimple({
24
24
  ruleId: rule.id,
25
- shortDescriptionText: rule.shortDescription?.text,
26
- helpUri: rule.helpUri
25
+ shortDescriptionText: rule.shortDescription?.text
27
26
  });
28
27
  runBuilder.addRule(ruleBuilder);
29
28
  }
@@ -58,7 +57,6 @@ var ReportGenerator = class {
58
57
  shortDescription: {
59
58
  text: getRuleDescription(error.ruleId)
60
59
  },
61
- helpUri: error.ruleId.startsWith("slds/") ? `https://github.com/salesforce/slds-linting-plugin/blob/main/docs/rules/${error.ruleId.replace("slds/", "")}.md` : `https://stylelint.io/user-guide/rules/${error.ruleId}`,
62
60
  properties: {
63
61
  category: "Style"
64
62
  }
@@ -72,7 +70,6 @@ var ReportGenerator = class {
72
70
  shortDescription: {
73
71
  text: getRuleDescription(warning.ruleId)
74
72
  },
75
- helpUri: warning.ruleId.startsWith("slds/") ? `https://github.com/salesforce/slds-linting-plugin/blob/main/docs/rules/${warning.ruleId.replace("slds/", "")}.md` : `https://stylelint.io/user-guide/rules/${warning.ruleId}`,
76
73
  properties: {
77
74
  category: "Style"
78
75
  }
@@ -21,6 +21,7 @@ function normalizeCliOptions(options, defultOptions = {}) {
21
21
  configStyle: "",
22
22
  configEslint: "",
23
23
  ...defultOptions,
24
+ ...options,
24
25
  directory: validateAndNormalizePath(options.directory),
25
26
  output: validateAndNormalizePath(options.output)
26
27
  };
@@ -1,7 +1,8 @@
1
+ import { LintResult } from '../types';
1
2
  /**
2
3
  * Prints detailed lint results for each file that has issues.
3
4
  *
4
5
  * @param results - Array of lint results.
5
6
  * @param editor - The chosen editor for clickable links (e.g., "vscode", "atom", "sublime").
6
7
  */
7
- export declare function printLintResults(results: any[], editor: string): void;
8
+ export declare function printLintResults(results: LintResult[], editor: string): void;
@@ -0,0 +1,11 @@
1
+ export declare const REQUIRED_NODE_VERSION = "20.18.3";
2
+ /**
3
+ * Checks if the current Node.js version meets the required version.
4
+ * @param {string} requiredVersion - The required Node.js version.
5
+ * @returns {boolean} - Returns true if the current version is valid.
6
+ */
7
+ export declare function checkNodeVersion(requiredVersion: any): boolean;
8
+ /**
9
+ * Validates the Node.js version and exits if it does not meet the requirement.
10
+ */
11
+ export declare function validateNodeVersion(): void;
@@ -0,0 +1,20 @@
1
+ // src/utils/nodeVersionUtil.ts
2
+ import semver from "semver";
3
+ import { Logger } from "./logger.js";
4
+ var REQUIRED_NODE_VERSION = "20.18.3";
5
+ function checkNodeVersion(requiredVersion) {
6
+ return semver.gte(process.version, requiredVersion);
7
+ }
8
+ function validateNodeVersion() {
9
+ if (!checkNodeVersion(REQUIRED_NODE_VERSION)) {
10
+ Logger.error(
11
+ `Node.js version ${process.version} is not supported. Please upgrade to ${REQUIRED_NODE_VERSION} or later.`
12
+ );
13
+ process.exit(1);
14
+ }
15
+ }
16
+ export {
17
+ REQUIRED_NODE_VERSION,
18
+ checkNodeVersion,
19
+ validateNodeVersion
20
+ };
package/package.json CHANGED
@@ -1,15 +1,13 @@
1
1
  {
2
2
  "name": "@salesforce-ux/slds-linter",
3
- "version": "0.0.12-alpha.6",
4
- "description": "SLDS CLI tool for linting styles and components",
3
+ "version": "0.1.0",
4
+ "description": "SLDS Linter CLI tool for linting styles and components",
5
5
  "keywords": [
6
- "lint",
7
- "eslint",
8
- "stylelint",
9
- "cli",
10
- "sarif",
11
- "parallel",
12
- "performance"
6
+ "lightning design system linter",
7
+ "SLDS Linter",
8
+ "SLDS2 Linter",
9
+ "SLDS Stylelint",
10
+ "SLDS ESLint"
13
11
  ],
14
12
  "author": "UXF Tooling Team",
15
13
  "type": "module",
@@ -22,8 +20,8 @@
22
20
  "slds-linter": "./build/index.js"
23
21
  },
24
22
  "dependencies": {
25
- "@salesforce-ux/eslint-plugin-slds": "0.0.12-alpha.6",
26
- "@salesforce-ux/stylelint-plugin-slds": "0.0.12-alpha.6",
23
+ "@salesforce-ux/eslint-plugin-slds": "0.1.0",
24
+ "@salesforce-ux/stylelint-plugin-slds": "0.1.0",
27
25
  "@typescript-eslint/eslint-plugin": "^5.0.0",
28
26
  "@typescript-eslint/parser": "^5.0.0",
29
27
  "chalk": "^4.1.2",
@@ -33,17 +31,18 @@
33
31
  "json-stream-stringify": "^3.1.6",
34
32
  "node-sarif-builder": "^3.2.0",
35
33
  "ora": "^5.4.1",
34
+ "semver": "^7.7.1",
36
35
  "stylelint": "^16.10.0"
37
36
  },
38
37
  "license": "ISC",
39
38
  "repository": {
40
39
  "type": "git",
41
- "url": "git+https://github.com/yourusername/linting-cli.git"
40
+ "url": "git+https://github.com/salesforce-ux/slds-linter.git"
42
41
  },
43
42
  "bugs": {
44
- "url": "https://github.com/yourusername/linting-cli/issues"
43
+ "url": "https://github.com/salesforce-ux/slds-linter/issues"
45
44
  },
46
- "homepage": "https://github.com/yourusername/linting-cli#readme",
45
+ "homepage": "https://github.com/salesforce-ux/slds-linter/tree/main/packages/cli#slds-linter",
47
46
  "publishConfig": {
48
47
  "registry": "https://registry.npmjs.org"
49
48
  }