@salesforce-ux/slds-linter 0.1.2 → 0.1.3-alpha.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/README.md +87 -62
- package/build/commands/emit.js +0 -1
- package/build/commands/lint-components.js +0 -1
- package/build/commands/lint-styles.js +0 -1
- package/build/commands/lint.js +0 -1
- package/build/commands/report.js +0 -1
- package/build/index.js +1 -78
- package/build/services/__tests__/file-scanner.test.js +0 -1
- package/build/services/batch-processor.js +0 -1
- package/build/services/config.resolver.js +6 -10
- package/build/services/file-patterns.js +0 -1
- package/build/services/file-scanner.js +10 -7
- package/build/services/lint-runner.js +0 -1
- package/build/services/report-generator.js +1 -2
- package/build/types/index.js +0 -1
- package/build/utils/cli-args.d.ts +3 -2
- package/build/utils/cli-args.js +11 -5
- package/build/utils/editorLinkUtil.js +0 -1
- package/build/utils/lintResultsUtil.js +0 -1
- package/build/utils/logger.js +0 -1
- package/build/utils/nodeVersionUtil.d.ts +2 -2
- package/build/utils/nodeVersionUtil.js +14 -12
- package/build/workers/base.worker.js +0 -1
- package/build/workers/eslint.worker.js +1 -2
- package/build/workers/stylelint.worker.js +0 -1
- package/package.json +4 -3
- package/build/commands/emit.js.map +0 -7
- package/build/commands/lint-components.js.map +0 -7
- package/build/commands/lint-styles.js.map +0 -7
- package/build/commands/lint.js.map +0 -7
- package/build/commands/report.js.map +0 -7
- package/build/index.js.map +0 -7
- package/build/services/__tests__/file-scanner.test.js.map +0 -7
- package/build/services/batch-processor.js.map +0 -7
- package/build/services/config.resolver.js.map +0 -7
- package/build/services/file-patterns.js.map +0 -7
- package/build/services/file-scanner.js.map +0 -7
- package/build/services/lint-runner.js.map +0 -7
- package/build/services/report-generator.js.map +0 -7
- package/build/types/index.js.map +0 -7
- package/build/utils/cli-args.js.map +0 -7
- package/build/utils/editorLinkUtil.js.map +0 -7
- package/build/utils/lintResultsUtil.js.map +0 -7
- package/build/utils/logger.js.map +0 -7
- package/build/utils/nodeVersionUtil.js.map +0 -7
- package/build/workers/base.worker.js.map +0 -7
- package/build/workers/eslint.worker.js.map +0 -7
- package/build/workers/stylelint.worker.js.map +0 -7
package/README.md
CHANGED
|
@@ -2,48 +2,45 @@
|
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
5
|
-
SLDS Linter provides custom linting rules
|
|
5
|
+
SLDS Linter provides custom linting rules built for Salesforce Lightning Design System 2 (SLDS 2 beta). Lint your components against SLDS 2 best practices to ensure they adhere to the latest styling standards.
|
|
6
|
+
|
|
7
|
+
SLDS Linter checks your Aura and Lightning web components’ CSS and markup files to identify styling issues that you can fix for SLDS 2 compatibility. SLDS Linter helps you maintain consistent styling and identify common issues with custom Lightning components.
|
|
6
8
|
|
|
7
9
|
## Features
|
|
8
10
|
|
|
9
|
-
-
|
|
10
|
-
The utility supports linting for two types of Salesforce Lightning components:
|
|
11
|
+
SLDS Linter is a custom-built linting solution based on open source [Stylelint](https://stylelint.io/) and [ESLint](https://eslint.org/) projects. It supports linting for both types of Lightning components.
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
- LWC Components (.html): Linting is applied to Lightning Web Components.
|
|
14
|
-
- Aura Components (.cmp): Linting is applied to Aura Components.
|
|
13
|
+
SLDS Linter runs on these types of files.
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
- Lightning web component *.html markup and Cascading Style Sheet (CSS) files
|
|
16
|
+
- Aura component *.cmp markup and CSS files
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
You can run SLDS Linter in a terminal window or in Visual Studio (VS) Code. We recommend running in VS Code.
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
Follow these instructions to integrate SLDS Linter into your project.
|
|
22
21
|
|
|
23
|
-
|
|
22
|
+
---
|
|
24
23
|
|
|
25
|
-
|
|
24
|
+
## Prerequisites
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
Install these items if they aren't installed already.
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
- The
|
|
28
|
+
- [VS Code](https://code.visualstudio.com/)
|
|
29
|
+
- [SARIF Viewer](https://marketplace.visualstudio.com/items?itemName=MS-SarifVSCode.sarif-viewer) VS Code extension. This extension enables you to view SLDS Linter violation reports.
|
|
30
|
+
- [Node.js](https://nodejs.org/)
|
|
31
|
+
- The minimum supported version is **v18.4.0**
|
|
32
|
+
- We recommend using the latest [Active LTS](https://nodejs.org/en/about/previous-releases) version of Node.js.
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
To enhance your linting and error analysis experience, consider installing the following VSCode extensions:
|
|
34
|
+
## Install SLDS Linter
|
|
36
35
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
These extensions will significantly improve your development workflow and make it easier to navigate and address linting issues.
|
|
36
|
+
1. Open your project in VS Code.
|
|
37
|
+
2. In a VS Code terminal, enter `npx @salesforce-ux/slds-linter@latest lint` to run the installer.
|
|
38
|
+
3. To install the SLDS Linter package, type `y` .
|
|
41
39
|
|
|
40
|
+
The SLDS Linter package installs in a temporary location on your system.
|
|
42
41
|
|
|
43
|
-
|
|
42
|
+
For more information about `slds-linter` commands, run `npx @salesforce-ux/slds-linter@latest --help`.
|
|
44
43
|
|
|
45
|
-
To see what all options does slds-linter provide please run `npx @salesforce-ux/slds-linter@latest --help` which gives the below output.
|
|
46
|
-
For the first time, it will ask to install the package. Please reply with `y` as yes to install the package.
|
|
47
44
|
|
|
48
45
|
```
|
|
49
46
|
Usage: npx @salesforce-ux/slds-linter@latest [options] [command]
|
|
@@ -63,42 +60,70 @@ Commands:
|
|
|
63
60
|
help [command] display help for command
|
|
64
61
|
```
|
|
65
62
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
63
|
+
## Run SLDS Linter
|
|
64
|
+
|
|
65
|
+
Run SLDS Linter against your project in the VS Code terminal to check for any violations and generate a SARIF report. This report helps you identify the components you need to update.
|
|
66
|
+
|
|
67
|
+
In your project root directory, follow these steps.
|
|
68
|
+
|
|
69
|
+
1. In your project in VS Code, open Terminal.
|
|
70
|
+
2. Run `npx @salesforce-ux/slds-linter lint`.
|
|
71
|
+
The linting output displayed in the console includes the row and column numbers on the left. Navigate to specific lines in your source code by clicking on the displayed numbers (Command + Click on Mac).
|
|
72
|
+
|
|
73
|
+
3. (Optional) To see lint errors only on CSS files, run `npx @salesforce-ux/slds-linter lint:styles` .
|
|
74
|
+
4. (Optional) To see lint errors only on component markup files (componentName.html or componentName.cmp files), run `npx @salesforce-ux/slds-linter lint:components` .
|
|
75
|
+
5. (Optional) To run SLDS Linter on a specific folder, add the `-d` option to specify the directory to be linted: `npx @salesforce-ux/slds-linter -d [directory name]` . This option accepts directories or folders using glob patterns, enabling flexible and efficient matching of multiple paths. For example, run `npx @salesforce-ux/slds-linter lint -d "com/CORE/**"` gives the lint output for all the files under `com/CORE`.
|
|
76
|
+
6. To produce a SARIF report in your project root directory and specify an output directory, run `npx @salesforce-ux/slds-linter report -o [output directory]`. The output file is named as `slds-linter-report.sarif`.
|
|
77
|
+
7. Open the generated `.sarif` report file.
|
|
78
|
+
8. Make a note of how many components SLDS Linter has identified that you must update.
|
|
79
|
+
9. (Optional) To automatically fix validation errors in bulk, run the `lint` command with the `fix` option, `npx @salesforce-ux/slds-linter lint --fix`.
|
|
80
|
+
7. (Optional) To emit the configuration files used by `slds-linter`, run `npx @salesforce-ux/slds-linter emit` in your component source directory. Note that this command defaults to current working directory. These configuration files are discovered by your VS Code ESLint and Stylelint extensions to display squiggly lines in CSS and HTML files when opened in your code editor.
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
### Troubleshoot SARIF Viewer Navigation
|
|
84
|
+
|
|
85
|
+
If the SARIF viewer doesn’t automatically go to the line of code when you click on an error or warning, follow these steps.
|
|
86
|
+
|
|
87
|
+
1. In the SARIF viewer pop-up window, click Locate.
|
|
88
|
+
2. In the file explorer or code editor, locate the file.
|
|
89
|
+
3. Click on the errors in the SARIF viewer, and it navigates directly to the relevant line of code.
|
|
90
|
+
|
|
72
91
|
|
|
73
|
-
|
|
92
|
+
### SLDS Linter Commands and Options
|
|
74
93
|
|
|
75
|
-
|
|
94
|
+
Use these commands to run SLDS Linter rules. Review the output violations and fix any issues to uplift your code to SLDS best practices.
|
|
95
|
+
|
|
96
|
+
- `npx @salesforce-ux/slds-linter lint`. Runs ESlint and Stylelint rules on HTML, CSS, and CMP files.
|
|
97
|
+
- `npx @salesforce-ux/slds-linter lint:styles`. Runs the Stylelint rules on your CSS files.
|
|
98
|
+
- `npx @salesforce-ux/slds-linter lint:components`. Runs the ESlint rules on your HTML/CMP files.
|
|
99
|
+
- `npx @salesforce-ux/slds-linter report`. Generates a SARIF report for static analysis.
|
|
100
|
+
- `npx @salesforce-ux/slds-linter emit`. Emits the configuration files used by `slds-linter`. Defaults to current directory.
|
|
101
|
+
|
|
102
|
+
These options are available on SLDS Linter commands.
|
|
103
|
+
|
|
104
|
+
| **Option** | **Description** | **Availability** |
|
|
76
105
|
| ------------------------ | ---------------------------------------------------------------------------- | ------------------------------------------ |
|
|
77
|
-
| `-d, --directory <path>` | Target directory to scan (defaults to current directory) | lint
|
|
78
|
-
| `-o, --output <path>` | Output directory for reports (defaults to current directory) | report |
|
|
79
|
-
| `--fix` | Automatically fix problems | lint
|
|
80
|
-
| `--config <path>` | Path to eslint/stylelint config file' | lint:styles
|
|
81
|
-
| `--config-style <path>` | Path to stylelint config file' | lint |
|
|
82
|
-
| `--config-eslint <path>` | Path to eslint config file' | lint |
|
|
83
|
-
| `--editor <editor>` | Editor to open files with (e.g., vscode, atom, sublime). Defaults to vscode | lint
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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.
|
|
103
|
-
|
|
104
|
-
For any questions or issues, feel free to reach out to the maintainers or open an issue in the repository.
|
|
106
|
+
| `-d, --directory <path>` | Target directory to scan (defaults to current directory). Accepts glob patterns. | `lint`, `lint:styles`, `lint:components`, `report` |
|
|
107
|
+
| `-o, --output <path>` | Output directory for reports (defaults to current directory) | `report` |
|
|
108
|
+
| `--fix` | Automatically fix problems | `lint`, `lint:styles`, `lint:components` |
|
|
109
|
+
| `--config <path>` | Path to eslint/stylelint config file' | `lint:styles`, `lint:components` |
|
|
110
|
+
| `--config-style <path>` | Path to stylelint config file' | `lint` |
|
|
111
|
+
| `--config-eslint <path>` | Path to eslint config file' | `lint` |
|
|
112
|
+
| `--editor <editor>` | Editor to open files with (e.g., vscode, atom, sublime). Defaults to vscode | `lint`, `lint:styles`, `lint:components` |
|
|
113
|
+
|
|
114
|
+
To view help for these options, add `--help` to each command. For example, run `npx @salesforce-ux/slds-linter lint --help` to see which options you can use with `lint`.
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
## Extensions
|
|
118
|
+
|
|
119
|
+
To enhance your linting and error analysis experience, we recommend that you install these VS Code extensions. These extensions significantly improve your development workflow and make it easier to navigate and address linting issues.
|
|
120
|
+
|
|
121
|
+
- *[ESLint Extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)*: Essential for JavaScript and TypeScript linting, it checks your code and flags any violations of the ESLint rules with squiggly lines to show you what to fix.
|
|
122
|
+
- *[Stylelint Extension](https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint)*: When linting CSS, SCSS, or other stylesheets, this tool highlights errors with squiggly lines.
|
|
123
|
+
|
|
124
|
+
## Best Practices
|
|
125
|
+
|
|
126
|
+
- Run `npx @salesforce-ux/slds-linter lint` to see the lint output on Terminal.
|
|
127
|
+
- To run SLDS Linter on a specific folder, add option `-d` For example, `npx @salesforce-ux/slds-linter lint -d`
|
|
128
|
+
|
|
129
|
+
For any questions or issues, open an issue in this repository.
|
package/build/commands/emit.js
CHANGED
package/build/commands/lint.js
CHANGED
package/build/commands/report.js
CHANGED
package/build/index.js
CHANGED
|
@@ -1,75 +1,4 @@
|
|
|
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.1.2-alpha.0",
|
|
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.1.2-alpha.0",
|
|
40
|
-
"@salesforce-ux/stylelint-plugin-slds": "0.1.2-alpha.0",
|
|
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
|
-
});
|
|
73
2
|
|
|
74
3
|
// src/index.ts
|
|
75
4
|
import { Command } from "commander";
|
|
@@ -92,12 +21,7 @@ process.on("uncaughtException", (error) => {
|
|
|
92
21
|
var program = new Command();
|
|
93
22
|
program.name("npx @salesforce-ux/slds-linter@latest").showHelpAfterError();
|
|
94
23
|
function registerVersion() {
|
|
95
|
-
|
|
96
|
-
try {
|
|
97
|
-
pkg = require_package();
|
|
98
|
-
} catch (e) {
|
|
99
|
-
}
|
|
100
|
-
program.description(pkg.description).version(pkg.version);
|
|
24
|
+
program.description("SLDS Linter CLI tool for linting styles and components").version("0.1.3-alpha.1");
|
|
101
25
|
}
|
|
102
26
|
registerLintStylesCommand(program);
|
|
103
27
|
registerLintComponentsCommand(program);
|
|
@@ -106,4 +30,3 @@ registerReportCommand(program);
|
|
|
106
30
|
registerEmitCommand(program);
|
|
107
31
|
registerVersion();
|
|
108
32
|
program.parse(process.argv);
|
|
109
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
// src/services/config.resolver.ts
|
|
2
|
-
import { fileURLToPath } from "url";
|
|
3
|
-
import stylelintPackage from "stylelint/package.json" with { type: "json" };
|
|
4
|
-
import eslintPackage from "eslint/package.json" with { type: "json" };
|
|
5
|
-
import cliPackage from "../../package.json" with { type: "json" };
|
|
6
2
|
import { ruleMetadata } from "@salesforce-ux/stylelint-plugin-slds";
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
3
|
+
import { resolvePath } from "../utils/nodeVersionUtil.js";
|
|
4
|
+
var DEFAULT_ESLINT_CONFIG_PATH = resolvePath("@salesforce-ux/eslint-plugin-slds/.eslintrc.yml", import.meta);
|
|
5
|
+
var DEFAULT_STYLELINT_CONFIG_PATH = resolvePath("@salesforce-ux/stylelint-plugin-slds/.stylelintrc.yml", import.meta);
|
|
6
|
+
var STYLELINT_VERSION = "16.14.1";
|
|
7
|
+
var ESLINT_VERSION = "8.57.1";
|
|
8
|
+
var LINTER_CLI_VERSION = "0.1.3-alpha.1";
|
|
12
9
|
var getRuleDescription = (ruleId) => {
|
|
13
10
|
const ruleIdWithoutNameSpace = `${ruleId}`.replace(/\@salesforce-ux\//, "");
|
|
14
11
|
return ruleMetadata(ruleIdWithoutNameSpace)?.ruleDesc || "--";
|
|
@@ -21,4 +18,3 @@ export {
|
|
|
21
18
|
STYLELINT_VERSION,
|
|
22
19
|
getRuleDescription
|
|
23
20
|
};
|
|
24
|
-
//# sourceMappingURL=config.resolver.js.map
|
|
@@ -16,22 +16,26 @@ var FileScanner = class {
|
|
|
16
16
|
Logger.debug(`Include patterns: ${options.patterns.include.join(", ")}`);
|
|
17
17
|
const allFiles = [];
|
|
18
18
|
for (const pattern of options.patterns.include) {
|
|
19
|
-
const files = await glob(pattern
|
|
20
|
-
cwd:
|
|
19
|
+
const files = await glob(`${directory}/${pattern}`, {
|
|
20
|
+
cwd: process.cwd(),
|
|
21
21
|
ignore: options.patterns.exclude,
|
|
22
22
|
withFileTypes: true,
|
|
23
23
|
dot: true
|
|
24
24
|
// Include .dot files
|
|
25
|
-
}).then(
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
}).then(
|
|
26
|
+
(matches) => matches.filter((match) => match.isFile()).map((match) => {
|
|
27
|
+
return match.fullpath();
|
|
28
|
+
})
|
|
29
|
+
);
|
|
28
30
|
allFiles.push(...files);
|
|
29
31
|
}
|
|
30
32
|
const uniqueFiles = [...new Set(allFiles)];
|
|
31
33
|
const validFiles = await this.validateFiles(uniqueFiles);
|
|
32
34
|
const batchSize = options.batchSize || this.DEFAULT_BATCH_SIZE;
|
|
33
35
|
const batches = this.createBatches(validFiles, batchSize);
|
|
34
|
-
Logger.debug(
|
|
36
|
+
Logger.debug(
|
|
37
|
+
`Found ${validFiles.length} files, split into ${batches.length} batches`
|
|
38
|
+
);
|
|
35
39
|
return batches;
|
|
36
40
|
} catch (error) {
|
|
37
41
|
Logger.error(`Failed to scan files: ${error.message}`);
|
|
@@ -67,4 +71,3 @@ var FileScanner = class {
|
|
|
67
71
|
export {
|
|
68
72
|
FileScanner
|
|
69
73
|
};
|
|
70
|
-
//# sourceMappingURL=file-scanner.js.map
|
|
@@ -17,7 +17,7 @@ var ReportGenerator = class {
|
|
|
17
17
|
const runBuilder = new SarifRunBuilder().initSimple({
|
|
18
18
|
toolDriverName: options.toolName,
|
|
19
19
|
toolDriverVersion: options.toolVersion,
|
|
20
|
-
url:
|
|
20
|
+
url: "https://github.com/salesforce-ux/slds-linter"
|
|
21
21
|
});
|
|
22
22
|
const rules = this.extractRules(results);
|
|
23
23
|
for (const rule of rules) {
|
|
@@ -115,4 +115,3 @@ var ReportGenerator = class {
|
|
|
115
115
|
export {
|
|
116
116
|
ReportGenerator
|
|
117
117
|
};
|
|
118
|
-
//# sourceMappingURL=report-generator.js.map
|
package/build/types/index.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { CliOptions } from
|
|
2
|
-
export declare function
|
|
1
|
+
import { CliOptions } from "../types";
|
|
2
|
+
export declare function validateAndNormalizeDirPath(inputPath?: string): string;
|
|
3
|
+
export declare function validateAndNormalizeOutputPath(inputPath?: string): string;
|
|
3
4
|
export declare function normalizeCliOptions(options: CliOptions, defultOptions?: Partial<CliOptions>): Required<CliOptions>;
|
package/build/utils/cli-args.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
// src/utils/cli-args.ts
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { accessSync } from "fs";
|
|
4
|
-
function
|
|
4
|
+
function validateAndNormalizeDirPath(inputPath) {
|
|
5
|
+
if (!inputPath) {
|
|
6
|
+
return process.cwd();
|
|
7
|
+
}
|
|
8
|
+
return inputPath;
|
|
9
|
+
}
|
|
10
|
+
function validateAndNormalizeOutputPath(inputPath) {
|
|
5
11
|
if (!inputPath) {
|
|
6
12
|
return process.cwd();
|
|
7
13
|
}
|
|
@@ -22,12 +28,12 @@ function normalizeCliOptions(options, defultOptions = {}) {
|
|
|
22
28
|
configEslint: "",
|
|
23
29
|
...defultOptions,
|
|
24
30
|
...options,
|
|
25
|
-
directory:
|
|
26
|
-
output:
|
|
31
|
+
directory: validateAndNormalizeDirPath(options.directory),
|
|
32
|
+
output: validateAndNormalizeOutputPath(options.output)
|
|
27
33
|
};
|
|
28
34
|
}
|
|
29
35
|
export {
|
|
30
36
|
normalizeCliOptions,
|
|
31
|
-
|
|
37
|
+
validateAndNormalizeDirPath,
|
|
38
|
+
validateAndNormalizeOutputPath
|
|
32
39
|
};
|
|
33
|
-
//# sourceMappingURL=cli-args.js.map
|
package/build/utils/logger.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const REQUIRED_NODE_VERSION = "
|
|
1
|
+
export declare const REQUIRED_NODE_VERSION = ">=18.4.0";
|
|
2
2
|
/**
|
|
3
3
|
* Checks if the current Node.js version meets the required version.
|
|
4
4
|
* @param {string} requiredVersion - The required Node.js version.
|
|
@@ -16,4 +16,4 @@ export declare function validateNodeVersion(): void;
|
|
|
16
16
|
* @returns
|
|
17
17
|
*/
|
|
18
18
|
export declare function resolveDirName(importMeta: ImportMeta): string;
|
|
19
|
-
export declare function resolvePath(specifier: string,
|
|
19
|
+
export declare function resolvePath(specifier: string, importMeta: ImportMeta): string;
|
|
@@ -2,23 +2,20 @@
|
|
|
2
2
|
import semver from "semver";
|
|
3
3
|
import { fileURLToPath } from "url";
|
|
4
4
|
import { dirname } from "path";
|
|
5
|
+
import { resolve } from "import-meta-resolve";
|
|
5
6
|
import { Logger } from "./logger.js";
|
|
6
|
-
var REQUIRED_NODE_VERSION = "
|
|
7
|
+
var REQUIRED_NODE_VERSION = ">=18.4.0";
|
|
7
8
|
function checkNodeVersion(requiredVersion) {
|
|
8
9
|
return semver.satisfies(process.version, requiredVersion);
|
|
9
10
|
}
|
|
10
11
|
function validateNodeVersion() {
|
|
11
12
|
if (!checkNodeVersion(REQUIRED_NODE_VERSION)) {
|
|
12
|
-
if (checkNodeVersion("
|
|
13
|
-
Logger.
|
|
14
|
-
`
|
|
15
|
-
|
|
16
|
-
} else if (checkNodeVersion("^20.x") || checkNodeVersion("^19.x")) {
|
|
17
|
-
Logger.error(
|
|
18
|
-
`Node.js version ${process.version} is not supported. Please upgrade to v20.10.0 or later.`
|
|
13
|
+
if (checkNodeVersion("<18.4.x")) {
|
|
14
|
+
Logger.warning(
|
|
15
|
+
`SLDS Linter CLI works best with Node.js version v18.4.0 or later.
|
|
16
|
+
We recommend using the latest [Active LTS](https://nodejs.org/en/about/previous-releases) version of Node.js.`
|
|
19
17
|
);
|
|
20
18
|
}
|
|
21
|
-
process.exit(1);
|
|
22
19
|
}
|
|
23
20
|
}
|
|
24
21
|
function resolveDirName(importMeta) {
|
|
@@ -27,8 +24,14 @@ function resolveDirName(importMeta) {
|
|
|
27
24
|
}
|
|
28
25
|
return dirname(fileURLToPath(importMeta.url));
|
|
29
26
|
}
|
|
30
|
-
function resolvePath(specifier,
|
|
31
|
-
|
|
27
|
+
function resolvePath(specifier, importMeta) {
|
|
28
|
+
let fileUrl = "";
|
|
29
|
+
if ("resolve" in importMeta) {
|
|
30
|
+
fileUrl = importMeta.resolve(specifier);
|
|
31
|
+
} else {
|
|
32
|
+
fileUrl = resolve(specifier, importMeta.url);
|
|
33
|
+
}
|
|
34
|
+
return fileURLToPath(fileUrl);
|
|
32
35
|
}
|
|
33
36
|
export {
|
|
34
37
|
REQUIRED_NODE_VERSION,
|
|
@@ -37,4 +40,3 @@ export {
|
|
|
37
40
|
resolvePath,
|
|
38
41
|
validateNodeVersion
|
|
39
42
|
};
|
|
40
|
-
//# sourceMappingURL=nodeVersionUtil.js.map
|
|
@@ -6,7 +6,7 @@ var ESLintWorker = class extends BaseWorker {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
super();
|
|
8
8
|
this.eslint = new ESLint({
|
|
9
|
-
useEslintrc:
|
|
9
|
+
useEslintrc: false,
|
|
10
10
|
fix: this.task.config.fix,
|
|
11
11
|
overrideConfigFile: this.task.config.configPath
|
|
12
12
|
});
|
|
@@ -48,4 +48,3 @@ worker.process().catch((error) => {
|
|
|
48
48
|
console.error("Worker failed:", error);
|
|
49
49
|
process.exit(1);
|
|
50
50
|
});
|
|
51
|
-
//# sourceMappingURL=eslint.worker.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce-ux/slds-linter",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3-alpha.1",
|
|
4
4
|
"description": "SLDS Linter CLI tool for linting styles and components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lightning design system linter",
|
|
@@ -20,14 +20,15 @@
|
|
|
20
20
|
"slds-linter": "./build/index.js"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@salesforce-ux/eslint-plugin-slds": "0.1.
|
|
24
|
-
"@salesforce-ux/stylelint-plugin-slds": "0.1.
|
|
23
|
+
"@salesforce-ux/eslint-plugin-slds": "0.1.3-alpha.1",
|
|
24
|
+
"@salesforce-ux/stylelint-plugin-slds": "0.1.3-alpha.1",
|
|
25
25
|
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
|
26
26
|
"@typescript-eslint/parser": "^5.0.0",
|
|
27
27
|
"chalk": "^4.1.2",
|
|
28
28
|
"commander": "^13.1.0",
|
|
29
29
|
"eslint": "^8.0.0",
|
|
30
30
|
"glob": "^11.0.0",
|
|
31
|
+
"import-meta-resolve": "^4.1.0",
|
|
31
32
|
"json-stream-stringify": "^3.1.6",
|
|
32
33
|
"node-sarif-builder": "^3.2.0",
|
|
33
34
|
"ora": "^5.4.1",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/commands/emit.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from \"commander\";\nimport chalk from \"chalk\";\nimport { CliOptions } from \"../types\";\nimport { Logger } from \"../utils/logger\";\nimport { normalizeCliOptions } from \"../utils/cli-args\";\nimport {\n DEFAULT_ESLINT_CONFIG_PATH,\n DEFAULT_STYLELINT_CONFIG_PATH,\n} from \"../services/config.resolver\";\nimport path from \"path\";\nimport { copyFile } from 'fs/promises';\n\nexport function registerEmitCommand(program: Command): void {\n program\n .command(\"emit\")\n .description(\"Emits the configuration files used by slds-linter cli\")\n .option(\n \"-d, --directory <path>\",\n \"Target directory to emit (defaults to current directory)\"\n )\n .action(async (options: CliOptions) => {\n try {\n Logger.info(chalk.blue(\"Emitting configuration files...\"));\n const normalizedOptions = normalizeCliOptions(options, {\n configStyle: DEFAULT_STYLELINT_CONFIG_PATH,\n configEslint: DEFAULT_ESLINT_CONFIG_PATH,\n });\n\n const destStyleConfigPath = path.join(\n normalizedOptions.directory,\n path.basename(normalizedOptions.configStyle)\n );\n await copyFile(normalizedOptions.configStyle, destStyleConfigPath);\n Logger.success(chalk.green(`Stylelint configuration created at:\\n${destStyleConfigPath}\\n`));\n\n const destESLintConfigPath = path.join(\n normalizedOptions.directory,\n path.basename(normalizedOptions.configEslint)\n );\n await copyFile(normalizedOptions.configEslint, destESLintConfigPath);\n Logger.success(chalk.green(`ESLint configuration created at:\\n${destESLintConfigPath}\\n`));\n } catch (error: any) {\n Logger.error(\n chalk.red(`Failed to emit configuration: ${error.message}`)\n );\n process.exit(1);\n }\n });\n}\n"],
|
|
5
|
-
"mappings": ";AACA,OAAO,WAAW;AAElB,SAAS,cAAc;AACvB,SAAS,2BAA2B;AACpC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,OAAO,UAAU;AACjB,SAAS,gBAAgB;AAElB,SAAS,oBAAoB,SAAwB;AAC1D,UACG,QAAQ,MAAM,EACd,YAAY,uDAAuD,EACnE;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,OAAO,OAAO,YAAwB;AACrC,QAAI;AACF,aAAO,KAAK,MAAM,KAAK,iCAAiC,CAAC;AACzD,YAAM,oBAAoB,oBAAoB,SAAS;AAAA,QACrD,aAAa;AAAA,QACb,cAAc;AAAA,MAChB,CAAC;AAED,YAAM,sBAAsB,KAAK;AAAA,QAC/B,kBAAkB;AAAA,QAClB,KAAK,SAAS,kBAAkB,WAAW;AAAA,MAC7C;AACA,YAAM,SAAS,kBAAkB,aAAa,mBAAmB;AACjE,aAAO,QAAQ,MAAM,MAAM;AAAA,EAAwC,mBAAmB;AAAA,CAAI,CAAC;AAE3F,YAAM,uBAAuB,KAAK;AAAA,QAChC,kBAAkB;AAAA,QAClB,KAAK,SAAS,kBAAkB,YAAY;AAAA,MAC9C;AACA,YAAM,SAAS,kBAAkB,cAAc,oBAAoB;AACnE,aAAO,QAAQ,MAAM,MAAM;AAAA,EAAqC,oBAAoB;AAAA,CAAI,CAAC;AAAA,IAC3F,SAAS,OAAY;AACnB,aAAO;AAAA,QACL,MAAM,IAAI,iCAAiC,MAAM,OAAO,EAAE;AAAA,MAC5D;AACA,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AACL;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/commands/lint-components.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport chalk from 'chalk';\nimport path from 'path';\nimport { CliOptions } from '../types';\nimport { printLintResults } from '../utils/lintResultsUtil';\nimport { getEditorLink, createClickableLineCol } from '../utils/editorLinkUtil';\nimport { normalizeCliOptions } from '../utils/cli-args';\nimport { Logger } from '../utils/logger';\nimport { FileScanner } from '../services/file-scanner';\nimport { ComponentFilePatterns } from '../services/file-patterns';\nimport { LintRunner } from '../services/lint-runner';\nimport { DEFAULT_ESLINT_CONFIG_PATH } from '../services/config.resolver';\n\nexport function registerLintComponentsCommand(program: Command): void {\n program\n .command('lint:components')\n .description('Run eslint on all markup files')\n .option('-d, --directory <path>', 'Target directory to scan (defaults to current directory)')\n .option('--fix', 'Automatically fix problems')\n .option('--config <path>', 'Path to eslint config file')\n .option('--editor <editor>', 'Editor to open files with (vscode, atom, sublime). Defaults to vscode', 'vscode')\n .action(async (options: CliOptions) => {\n const startTime = Date.now();\n try {\n Logger.info(chalk.blue('Starting linting of component files...'));\n const normalizedOptions = normalizeCliOptions(options, {\n config: DEFAULT_ESLINT_CONFIG_PATH\n });\n\n Logger.info(chalk.blue('Scanning for files...'));\n const fileBatches = await FileScanner.scanFiles(normalizedOptions.directory, {\n patterns: ComponentFilePatterns,\n batchSize: 100,\n });\n const totalFiles = fileBatches.reduce((sum, batch) => sum + batch.length, 0);\n Logger.info(chalk.blue(`Scanned ${totalFiles} file(s).`));\n\n Logger.info(chalk.blue(`Running linting${normalizedOptions.fix?' with autofix':''}...`));\n const results = await LintRunner.runLinting(fileBatches, 'component', {\n fix: normalizedOptions.fix,\n configPath: normalizedOptions.config,\n });\n\n // Print results only for files with issues\n printLintResults(results, normalizedOptions.editor);\n\n const errorCount = results.reduce((sum, r) => sum + r.errors.length, 0);\n const warningCount = results.reduce((sum, r) => sum + r.warnings.length, 0);\n\n Logger.info(\n chalk.blue(\n `\\nSummary: Processed ${totalFiles} file(s) with ${chalk.red(\n errorCount.toString()\n )} error(s) and ${chalk.yellow(warningCount.toString())} warning(s).`\n )\n );\n\n const elapsedTime = ((Date.now() - startTime) / 1000).toFixed(2);\n Logger.success(chalk.green(`Component files linting completed in ${elapsedTime} seconds.`));\n process.exit(errorCount > 0 ? 1 : 0);\n } catch (error: any) {\n Logger.error(chalk.red(`Error during linting: ${error.message}`));\n process.exit(1);\n }\n });\n}\n"],
|
|
5
|
-
"mappings": ";AACA,OAAO,WAAW;AAGlB,SAAS,wBAAwB;AAEjC,SAAS,2BAA2B;AACpC,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAC5B,SAAS,6BAA6B;AACtC,SAAS,kBAAkB;AAC3B,SAAS,kCAAkC;AAEpC,SAAS,8BAA8B,SAAwB;AACpE,UACG,QAAQ,iBAAiB,EACzB,YAAY,gCAAgC,EAC5C,OAAO,0BAA0B,0DAA0D,EAC3F,OAAO,SAAS,4BAA4B,EAC5C,OAAO,mBAAmB,4BAA4B,EACtD,OAAO,qBAAqB,yEAAyE,QAAQ,EAC7G,OAAO,OAAO,YAAwB;AACrC,UAAM,YAAY,KAAK,IAAI;AAC3B,QAAI;AAC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Q,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AACL;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/commands/lint-styles.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport chalk from 'chalk';\nimport path from 'path';\nimport { CliOptions } from '../types';\nimport { printLintResults } from '../utils/lintResultsUtil';\nimport { getEditorLink, createClickableLineCol } from '../utils/editorLinkUtil';\nimport { normalizeCliOptions } from '../utils/cli-args';\nimport { Logger } from '../utils/logger';\nimport { FileScanner } from '../services/file-scanner';\nimport { StyleFilePatterns } from '../services/file-patterns';\nimport { LintRunner } from '../services/lint-runner';\nimport { DEFAULT_STYLELINT_CONFIG_PATH } from '../services/config.resolver';\n\nexport function registerLintStylesCommand(program: Command): void {\n program\n .command('lint:styles')\n .description('Run stylelint on all style files')\n .option('-d, --directory <path>', 'Target directory to scan (defaults to current directory)')\n .option('--fix', 'Automatically fix problems')\n .option('--config <path>', 'Path to stylelint config file')\n .option('--editor <editor>', 'Editor to open files with (vscode, atom, sublime). Defaults to vscode', 'vscode')\n .action(async (options: CliOptions) => {\n const startTime = Date.now();\n try {\n Logger.info(chalk.blue('Starting linting of style files...'));\n const normalizedOptions = normalizeCliOptions(options, {\n config: DEFAULT_STYLELINT_CONFIG_PATH\n });\n\n Logger.info(chalk.blue('Scanning for style files...'));\n const fileBatches = await FileScanner.scanFiles(normalizedOptions.directory, {\n patterns: StyleFilePatterns,\n batchSize: 100,\n });\n const totalFiles = fileBatches.reduce((sum, batch) => sum + batch.length, 0);\n Logger.info(chalk.blue(`Scanned ${totalFiles} file(s).`));\n\n Logger.info(chalk.blue(`Running stylelint${normalizedOptions.fix?' with autofix':''}...`));\n const results = await LintRunner.runLinting(fileBatches, 'style', {\n fix: normalizedOptions.fix,\n configPath: normalizedOptions.config,\n });\n\n // Print detailed lint results only for files with issues\n printLintResults(results, normalizedOptions.editor);\n\n const errorCount = results.reduce((sum, r) => sum + r.errors.length, 0);\n const warningCount = results.reduce((sum, r) => sum + r.warnings.length, 0);\n\n Logger.info(\n chalk.blue(\n `\\nSummary: Processed ${totalFiles} file(s) with ${chalk.red(\n errorCount.toString()\n )} error(s) and ${chalk.yellow(warningCount.toString())} warning(s).`\n )\n );\n const elapsedTime = ((Date.now() - startTime) / 1000).toFixed(2);\n Logger.success(chalk.green(`Style files linting completed in ${elapsedTime} seconds.`));\n process.exit(errorCount > 0 ? 1 : 0);\n } catch (error: any) {\n Logger.error(chalk.red(`Error during linting: ${error.message}`));\n process.exit(1);\n }\n });\n}\n"],
|
|
5
|
-
"mappings": ";AACA,OAAO,WAAW;AAGlB,SAAS,wBAAwB;AAEjC,SAAS,2BAA2B;AACpC,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAC3B,SAAS,qCAAqC;AAEvC,SAAS,0BAA0B,SAAwB;AAChE,UACG,QAAQ,aAAa,EACrB,YAAY,kCAAkC,EAC9C,OAAO,0BAA0B,0DAA0D,EAC3F,OAAO,SAAS,4BAA4B,EAC5C,OAAO,mBAAmB,+BAA+B,EACzD,OAAO,qBAAqB,yEAAyE,QAAQ,EAC7G,OAAO,OAAO,YAAwB;AACrC,UAAM,YAAY,KAAK,IAAI;AAC3B,QAAI;AACF,aAAO,KAAK,MAAM,KAAK,oCAAoC,CAAC;AAC5D,YAAM,oBAAoB,oBAAoB,SAAS;AAAA,QACrD,QAAQ;AAAA,MACV,CAAC;AAED,aAAO,KAAK,MAAM,KAAK,6BAA6B,CAAC;AACrD,YAAM,cAAc,MAAM,YAAY,UAAU,kBAAkB,WAAW;AAAA,QAC3E,UAAU;AAAA,QACV,WAAW;AAAA,MACb,CAAC;AACD,YAAM,aAAa,YAAY,OAAO,CAAC,KAAK,UAAU,MAAM,MAAM,QAAQ,CAAC;AAC3E,aAAO,KAAK,MAAM,KAAK,WAAW,UAAU,WAAW,CAAC;AAExD,aAAO,KAAK,MAAM,KAAK,oBAAoB,kBAAkB,MAAI,kBAAgB,EAAE,KAAK,CAAC;AACzF,YAAM,UAAU,MAAM,WAAW,WAAW,aAAa,SAAS;AAAA,QAChE,KAAK,kBAAkB;AAAA,QACvB,YAAY,kBAAkB;AAAA,MAChC,CAAC;AAGD,uBAAiB,SAAS,kBAAkB,MAAM;AAElD,YAAM,aAAa,QAAQ,OAAO,CAAC,KAAK,MAAM,MAAM,EAAE,OAAO,QAAQ,CAAC;AACtE,YAAM,eAAe,QAAQ,OAAO,CAAC,KAAK,MAAM,MAAM,EAAE,SAAS,QAAQ,CAAC;AAE1E,aAAO;AAAA,QACL,MAAM;AAAA,UACJ;AAAA,qBAAwB,UAAU,iBAAiB,MAAM;AAAA,YACvD,WAAW,SAAS;AAAA,UACtB,CAAC,iBAAiB,MAAM,OAAO,aAAa,SAAS,CAAC,CAAC;AAAA,QACzD;AAAA,MACF;AACA,YAAM,gBAAgB,KAAK,IAAI,IAAI,aAAa,KAAM,QAAQ,CAAC;AAC/D,aAAO,QAAQ,MAAM,MAAM,oCAAoC,WAAW,WAAW,CAAC;AACtF,cAAQ,KAAK,aAAa,IAAI,IAAI,CAAC;AAAA,IACrC,SAAS,OAAY;AACnB,aAAO,MAAM,MAAM,IAAI,yBAAyB,MAAM,OAAO,EAAE,CAAC;AAChE,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AACL;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/commands/lint.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport chalk from 'chalk';\nimport path from 'path';\nimport { CliOptions } from '../types';\nimport { getEditorLink, createClickableLineCol } from '../utils/editorLinkUtil';\nimport { printLintResults } from '../utils/lintResultsUtil';\nimport { normalizeCliOptions } from '../utils/cli-args';\nimport { Logger } from '../utils/logger';\nimport { FileScanner } from '../services/file-scanner';\nimport { StyleFilePatterns, ComponentFilePatterns } from '../services/file-patterns';\nimport { LintRunner } from '../services/lint-runner';\nimport { DEFAULT_ESLINT_CONFIG_PATH, DEFAULT_STYLELINT_CONFIG_PATH } from '../services/config.resolver';\n\nexport function registerLintCommand(program: Command): void {\n program\n .command('lint')\n .description('Run both style and component linting')\n .option('-d, --directory <path>', 'Target directory to scan (defaults to current directory)')\n .option('--fix', 'Automatically fix problems')\n .option('--config-style <path>', 'Path to stylelint config file')\n .option('--config-eslint <path>', 'Path to eslint config file')\n .option('--editor <editor>', 'Editor to open files with (e.g., vscode, atom, sublime). Defaults to vscode', 'vscode')\n .action(async (options: CliOptions) => {\n const startTime = Date.now();\n try {\n Logger.info(chalk.blue('Starting lint process...'));\n const normalizedOptions = normalizeCliOptions(options, {\n configStyle: DEFAULT_STYLELINT_CONFIG_PATH,\n configEslint: DEFAULT_ESLINT_CONFIG_PATH\n });\n\n // 1) STYLE LINT\n Logger.info(chalk.blue('\\nScanning style files...'));\n const styleFileBatches = await FileScanner.scanFiles(normalizedOptions.directory, {\n patterns: StyleFilePatterns,\n batchSize: 100,\n });\n const totalStyleFiles = styleFileBatches.reduce((sum, batch) => sum + batch.length, 0);\n Logger.info(chalk.blue(`Found ${totalStyleFiles} style file(s). Running stylelint...\\n`));\n\n Logger.info(chalk.blue(`Running stylelint${normalizedOptions.fix?' with autofix':''}...`));\n const styleResults = await LintRunner.runLinting(styleFileBatches, 'style', {\n fix: normalizedOptions.fix,\n configPath: normalizedOptions.configStyle,\n });\n\n // Print detailed lint results only for files with issues\n printLintResults(styleResults, normalizedOptions.editor);\n\n const styleErrorCount = styleResults.reduce((sum, r) => sum + r.errors.length, 0);\n const styleWarningCount = styleResults.reduce((sum, r) => sum + r.warnings.length, 0);\n\n // 2) COMPONENT LINT\n Logger.info(chalk.blue('\\nScanning component files...'));\n const componentFileBatches = await FileScanner.scanFiles(normalizedOptions.directory, {\n patterns: ComponentFilePatterns,\n batchSize: 100,\n });\n const totalComponentFiles = componentFileBatches.reduce((sum, batch) => sum + batch.length, 0);\n Logger.info(chalk.blue(`Found ${totalComponentFiles} component file(s). Running eslint...\\n`));\n\n Logger.info(chalk.blue(`Running linting${normalizedOptions.fix?' with autofix':''}...`));\n const componentResults = await LintRunner.runLinting(componentFileBatches, 'component', {\n fix: normalizedOptions.fix,\n configPath: normalizedOptions.configEslint,\n });\n\n // Print component lint issues (only for files with issues)\n printLintResults(componentResults, normalizedOptions.editor);\n\n const componentErrorCount = componentResults.reduce((sum, r) => sum + r.errors.length, 0);\n const componentWarningCount = componentResults.reduce((sum, r) => sum + r.warnings.length, 0);\n\n // Final summary\n const totalErrors = styleErrorCount + componentErrorCount;\n const totalWarnings = styleWarningCount + componentWarningCount;\n Logger.info(\n `\\n${chalk.red(`${totalErrors} error${totalErrors !== 1 ? 's' : ''}`)}` +\n ` ${chalk.yellow(`${totalWarnings} warning${totalWarnings !== 1 ? 's' : ''}`)}`\n );\n const elapsedTime = ((Date.now() - startTime) / 1000).toFixed(2);\n Logger.success(chalk.green(`\\nFull linting completed in ${elapsedTime} seconds.`));\n process.exit(totalErrors > 0 ? 1 : 0);\n } catch (error: any) {\n Logger.error(chalk.red(`Failed to complete linting: ${error.message}`));\n process.exit(1);\n }\n });\n}\n"],
|
|
5
|
-
"mappings": ";AACA,OAAO,WAAW;AAIlB,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AACpC,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB,6BAA6B;AACzD,SAAS,kBAAkB;AAC3B,SAAS,4BAA4B,qCAAqC;AAEnE,SAAS,oBAAoB,SAAwB;AAC1D,UACG,QAAQ,MAAM,EACd,YAAY,sCAAsC,EAClD,OAAO,0BAA0B,0DAA0D,EAC3F,OAAO,SAAS,4BAA4B,EAC5C,OAAO,yBAAyB,+BAA+B,EAC/D,OAAO,0BAA0B,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F,aAAO,KAAK,MAAM,KAAK,kBAAkB,kBAAkB,MAAI,kBAAgB,EAAE,KAAK,CAAC;AACvF,YAAM,mBAAmB,MAAM,WAAW,WAAW,sBAAsB,aAAa;AAAA,QACtF,KAAK,kBAAkB;AAAA,QACvB,YAAY,kBAAkB;AAAA,MAChC,CAAC;AAGD,uBAAiB,kBAAkB,kBAAkB,MAAM;AAE3D,YAAM,sBAAsB,iBAAiB,OAAO,CAAC,KAAK,MAAM,MAAM,EAAE,OAAO,QAAQ,CAAC;AACxF,YAAM,wBAAwB,iBAAiB,OAAO,CAAC,KAAK,MAAM,MAAM,EAAE,SAAS,QAAQ,CAAC;AAG5F,YAAM,cAAc,kBAAkB;AACtC,YAAM,gBAAgB,oBAAoB;AAC1C,aAAO;AAAA,QACL;AAAA,EAAK,MAAM,IAAI,GAAG,WAAW,SAAS,gBAAgB,IAAI,MAAM,EAAE,EAAE,CAAC,KAChE,MAAM,OAAO,GAAG,aAAa,WAAW,kBAAkB,IAAI,MAAM,EAAE,EAAE,CAAC;AAAA,MAChF;AACA,YAAM,gBAAgB,KAAK,IAAI,IAAI,aAAa,KAAM,QAAQ,CAAC;AAC/D,aAAO,QAAQ,MAAM,MAAM;AAAA,4BAA+B,WAAW,WAAW,CAAC;AACjF,cAAQ,KAAK,cAAc,IAAI,IAAI,CAAC;AAAA,IACtC,SAAS,OAAY;AACnB,aAAO,MAAM,MAAM,IAAI,+BAA+B,MAAM,OAAO,EAAE,CAAC;AACtE,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AACL;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/commands/report.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport path from 'path';\nimport ora from 'ora';\nimport { CliOptions } from '../types';\nimport { normalizeCliOptions } from '../utils/cli-args';\nimport { Logger } from '../utils/logger';\nimport { FileScanner } from '../services/file-scanner';\nimport { StyleFilePatterns, ComponentFilePatterns } from '../services/file-patterns';\nimport { LintRunner } from '../services/lint-runner';\nimport { ReportGenerator } from '../services/report-generator';\nimport { DEFAULT_ESLINT_CONFIG_PATH, DEFAULT_STYLELINT_CONFIG_PATH, ESLINT_VERSION, LINTER_CLI_VERSION, STYLELINT_VERSION } from '../services/config.resolver';\n\nexport function registerReportCommand(program: Command): void {\n program\n .command('report')\n .description('Generate SARIF report from linting results')\n .option('-d, --directory <path>', 'Target directory to scan (defaults to current directory)')\n .option('-o, --output <path>', 'Output directory for reports (defaults to current directory)')\n .option('--config-style <path>', 'Path to stylelint config file')\n .option('--config-eslint <path>', 'Path to eslint config file')\n .action(async (options: CliOptions) => {\n const spinner = ora('Starting report generation...').start();\n try { \n const normalizedOptions = normalizeCliOptions(options, {\n configStyle: DEFAULT_STYLELINT_CONFIG_PATH,\n configEslint: DEFAULT_ESLINT_CONFIG_PATH\n });\n \n // Run styles linting\n spinner.text = 'Running styles linting...';\n const styleFileBatches = await FileScanner.scanFiles(normalizedOptions.directory, {\n patterns: StyleFilePatterns,\n batchSize: 100\n });\n \n const styleResults = await LintRunner.runLinting(styleFileBatches, 'style', {\n configPath: normalizedOptions.configStyle\n });\n\n // Run components linting\n spinner.text = 'Running components linting...';\n const componentFileBatches = await FileScanner.scanFiles(normalizedOptions.directory, {\n patterns: ComponentFilePatterns,\n batchSize: 100\n });\n \n const componentResults = await LintRunner.runLinting(componentFileBatches, 'component', {\n configPath: normalizedOptions.configEslint\n });\n\n /* \n // TODO: Enable only if dedicated report per linter is needed\n // Generate styles report\n const styleReportPath = path.join(normalizedOptions.output, 'stylelint-report.sarif');\n await ReportGenerator.generateSarifReport(styleResults, {\n outputPath: styleReportPath,\n toolName: 'stylelint',\n toolVersion: STYLELINT_VERSION\n }); */\n\n /* \n // TODO: Enable only if dedicated report per linter is needed\n // Generate components report\n const componentReportPath = path.join(normalizedOptions.output, 'eslint-report.sarif');\n await ReportGenerator.generateSarifReport(componentResults, {\n outputPath: componentReportPath,\n toolName: 'eslint',\n toolVersion: ESLINT_VERSION\n }); */\n\n // Generate combined report\n spinner.text = 'Generating combined report...';\n const combinedReportPath = path.join(normalizedOptions.output, 'slds-linter-report.sarif');\n await ReportGenerator.generateSarifReport([...styleResults, ...componentResults], {\n outputPath: combinedReportPath,\n toolName: 'slds-linter',\n toolVersion: LINTER_CLI_VERSION\n });\n\n spinner.succeed('Report generation completed');\n process.exit(0);\n } catch (error: any) {\n spinner?.fail('Report generation failed');\n Logger.error(`Failed to generate report: ${error.message}`);\n process.exit(1);\n }\n });\n} "],
|
|
5
|
-
"mappings": ";AACA,OAAO,UAAU;AACjB,OAAO,SAAS;AAEhB,SAAS,2BAA2B;AACpC,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB,6BAA6B;AACzD,SAAS,kBAAkB;AAC3B,SAAS,uBAAuB;AAChC,SAAS,4BAA4B,+BAA+C,0BAA6C;AAE1H,SAAS,sBAAsB,SAAwB;AAC5D,UACG,QAAQ,QAAQ,EAChB,YAAY,4CAA4C,EACxD,OAAO,0BAA0B,0DAA0D,EAC3F,OAAO,uBAAuB,8DAA8D,EAC5F,OAAO,yBAAyB,+BAA+B,EAC/D,OAAO,0BAA0B,4BAA4B,EAC7D,OAAO,OAAO,YAAwB;AACrC,UAAM,UAAU,IAAI,+BAA+B,EAAE,MAAM;AAC3D,QAAI;AACF,YAAM,oBAAoB,oBAAoB,SAAS;AAAA,QACrD,aAAa;AAAA,QACb,cAAc;AAAA,MAChB,CAAC;AAGD,cAAQ,OAAO;AACf,YAAM,mBAAmB,MAAM,YAAY,UAAU,kBAAkB,WAAW;AAAA,QAChF,UAAU;AAAA,QACV,WAAW;AAAA,MACb,CAAC;AAED,YAAM,eAAe,MAAM,WAAW,WAAW,kBAAkB,SAAS;AAAA,QAC1E,YAAY,kBAAkB;AAAA,MAChC,CAAC;AAGD,cAAQ,OAAO;AACf,YAAM,uBAAuB,MAAM,YAAY,UAAU,kBAAkB,WAAW;AAAA,QACpF,UAAU;AAAA,QACV,WAAW;AAAA,MACb,CAAC;AAED,YAAM,mBAAmB,MAAM,WAAW,WAAW,sBAAsB,aAAa;AAAA,QACtF,YAAY,kBAAkB;AAAA,MAChC,CAAC;AAuBD,cAAQ,OAAO;AACf,YAAM,qBAAqB,KAAK,KAAK,kBAAkB,QAAQ,0BAA0B;AACzF,YAAM,gBAAgB,oBAAoB,CAAC,GAAG,cAAc,GAAG,gBAAgB,GAAG;AAAA,QAChF,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,aAAa;AAAA,MACf,CAAC;AAED,cAAQ,QAAQ,6BAA6B;AAC7C,cAAQ,KAAK,CAAC;AAAA,IAChB,SAAS,OAAY;AACnB,eAAS,KAAK,0BAA0B;AACxC,aAAO,MAAM,8BAA8B,MAAM,OAAO,EAAE;AAC1D,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AACL;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/build/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../package.json", "../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["{\n \"name\": \"@salesforce-ux/slds-linter\",\n \"version\": \"0.1.2-alpha.0\",\n \"description\": \"SLDS Linter CLI tool for linting styles and components\",\n \"keywords\": [\n \"lightning design system linter\",\n \"SLDS Linter\",\n \"SLDS2 Linter\",\n \"SLDS Stylelint\",\n \"SLDS ESLint\"\n ],\n \"author\": \"UXF Tooling Team\",\n \"type\": \"module\",\n \"main\": \"build/index.js\",\n \"files\": [\n \"build/**\",\n \"README.md\"\n ],\n \"bin\": {\n \"slds-linter\": \"./build/index.js\"\n },\n \"scripts\": {\n \"prepublishOnly\": \"clean-pkg-json\",\n \"build\": \"gulp build\",\n \"dev\": \"gulp dev\",\n \"test\": \"NODE_OPTIONS=\\\"$NODE_OPTIONS --experimental-vm-modules\\\" npx jest\",\n \"lint\": \"eslint src/**/*.ts\"\n },\n \"dependencies\": {\n \"@salesforce-ux/eslint-plugin-slds\": \"0.1.2-alpha.0\",\n \"@salesforce-ux/stylelint-plugin-slds\": \"0.1.2-alpha.0\",\n \"@typescript-eslint/eslint-plugin\": \"^5.0.0\",\n \"@typescript-eslint/parser\": \"^5.0.0\",\n \"chalk\": \"^4.1.2\",\n \"commander\": \"^13.1.0\",\n \"eslint\": \"^8.0.0\",\n \"glob\": \"^11.0.0\",\n \"json-stream-stringify\": \"^3.1.6\",\n \"node-sarif-builder\": \"^3.2.0\",\n \"ora\": \"^5.4.1\",\n \"semver\": \"^7.7.1\",\n \"stylelint\": \"^16.10.0\"\n },\n \"devDependencies\": {\n \"@types/jest\": \"^29.5.14\",\n \"jest\": \"^29.7.0\",\n \"ts-jest\": \"^29.2.5\"\n },\n \"license\": \"ISC\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/salesforce-ux/slds-linter.git\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/salesforce-ux/slds-linter/issues\"\n },\n \"homepage\": \"https://github.com/salesforce-ux/slds-linter/tree/main/packages/cli#slds-linter\",\n \"publishConfig\": {\n \"registry\": \"https://registry.npmjs.org\"\n }\n}\n", "#!/usr/bin/env node\n\nimport { Command } from 'commander';\nimport { registerLintStylesCommand } from './commands/lint-styles';\nimport { registerLintComponentsCommand } from './commands/lint-components';\nimport { registerLintCommand } from './commands/lint';\nimport { registerReportCommand } from './commands/report';\nimport { registerEmitCommand } from './commands/emit';\nimport { Logger } from './utils/logger';\nimport { validateNodeVersion } from './utils/nodeVersionUtil';\n\n// Validate Node.js version before proceeding\nvalidateNodeVersion();\n\nprocess.on('unhandledRejection', (error) => {\n Logger.error(`Unhandled rejection: ${error}`);\n process.exit(1);\n});\n\nprocess.on('uncaughtException', (error) => {\n Logger.error(`Uncaught exception: ${error}`);\n process.exit(1);\n});\n\nconst program = new Command();\n\nprogram\n .name('npx @salesforce-ux/slds-linter@latest')\n .showHelpAfterError();\n\nfunction registerVersion(){\n //TODO: Not an optimised way of doing. will review later\n let pkg = {description:'', version:''};\n try{\n pkg = require(\"../package.json\")\n }catch(e){}\n program.description(pkg.description)\n .version(pkg.version);\n}\n\nregisterLintStylesCommand(program);\nregisterLintComponentsCommand(program);\nregisterLintCommand(program);\nregisterReportCommand(program);\nregisterEmitCommand(program);\nregisterVersion();\n\nprogram.parse(process.argv); "],
|
|
5
|
-
"mappings": ";;;;;;;AAAA;AAAA;AAAA;AAAA,MACE,MAAQ;AAAA,MACR,SAAW;AAAA,MACX,aAAe;AAAA,MACf,UAAY;AAAA,QACV;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACA,QAAU;AAAA,MACV,MAAQ;AAAA,MACR,MAAQ;AAAA,MACR,OAAS;AAAA,QACP;AAAA,QACA;AAAA,MACF;AAAA,MACA,KAAO;AAAA,QACL,eAAe;AAAA,MACjB;AAAA,MACA,SAAW;AAAA,QACT,gBAAkB;AAAA,QAClB,OAAS;AAAA,QACT,KAAO;AAAA,QACP,MAAQ;AAAA,QACR,MAAQ;AAAA,MACV;AAAA,MACA,cAAgB;AAAA,QACd,qCAAqC;AAAA,QACrC,wCAAwC;AAAA,QACxC,oCAAoC;AAAA,QACpC,6BAA6B;AAAA,QAC7B,OAAS;AAAA,QACT,WAAa;AAAA,QACb,QAAU;AAAA,QACV,MAAQ;AAAA,QACR,yBAAyB;AAAA,QACzB,sBAAsB;AAAA,QACtB,KAAO;AAAA,QACP,QAAU;AAAA,QACV,WAAa;AAAA,MACf;AAAA,MACA,iBAAmB;AAAA,QACjB,eAAe;AAAA,QACf,MAAQ;AAAA,QACR,WAAW;AAAA,MACb;AAAA,MACA,SAAW;AAAA,MACX,YAAc;AAAA,QACZ,MAAQ;AAAA,QACR,KAAO;AAAA,MACT;AAAA,MACA,MAAQ;AAAA,QACN,KAAO;AAAA,MACT;AAAA,MACA,UAAY;AAAA,MACZ,eAAiB;AAAA,QACf,UAAY;AAAA,MACd;AAAA,IACF;AAAA;AAAA;;;AC1DA,SAAS,eAAe;AACxB,SAAS,iCAAiC;AAC1C,SAAS,qCAAqC;AAC9C,SAAS,2BAA2B;AACpC,SAAS,6BAA6B;AACtC,SAAS,2BAA2B;AACpC,SAAS,cAAc;AACvB,SAAS,2BAA2B;AAGpC,oBAAoB;AAEpB,QAAQ,GAAG,sBAAsB,CAAC,UAAU;AAC1C,SAAO,MAAM,wBAAwB,KAAK,EAAE;AAC5C,UAAQ,KAAK,CAAC;AAChB,CAAC;AAED,QAAQ,GAAG,qBAAqB,CAAC,UAAU;AACzC,SAAO,MAAM,uBAAuB,KAAK,EAAE;AAC3C,UAAQ,KAAK,CAAC;AAChB,CAAC;AAED,IAAM,UAAU,IAAI,QAAQ;AAE5B,QACG,KAAK,uCAAuC,EAC5C,mBAAmB;AAEtB,SAAS,kBAAiB;AAExB,MAAI,MAAM,EAAC,aAAY,IAAI,SAAQ,GAAE;AACrC,MAAG;AACD,UAAM;AAAA,EACR,SAAO,GAAE;AAAA,EAAC;AACV,UAAQ,YAAY,IAAI,WAAW,EAClC,QAAQ,IAAI,OAAO;AACtB;AAEA,0BAA0B,OAAO;AACjC,8BAA8B,OAAO;AACrC,oBAAoB,OAAO;AAC3B,sBAAsB,OAAO;AAC7B,oBAAoB,OAAO;AAC3B,gBAAgB;AAEhB,QAAQ,MAAM,QAAQ,IAAI;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/services/__tests__/file-scanner.test.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\nimport { FileScanner, ScanOptions } from '../file-scanner';\nimport { StyleFilePatterns } from '../file-patterns';\nimport {mkdir, writeFile, rm} from \"fs/promises\";\nimport { fileURLToPath } from 'url';\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\ndescribe('FileScanner', () => {\n const testDir = path.join(__dirname , 'fixtures');\n\n beforeAll(async () => {\n // Create test directory and files for testing\n await mkdir(testDir, { recursive: true });\n await writeFile(\n path.join(testDir, 'test.css'),\n 'body { color: red; }'\n );\n await writeFile(\n path.join(testDir, 'test.scss'),\n '$color: red;'\n );\n });\n\n afterAll(async () => {\n // Clean up test files\n await rm(testDir, { recursive: true });\n });\n\n it('should scan and batch files correctly', async () => {\n const options: ScanOptions = {\n patterns: StyleFilePatterns,\n batchSize: 1\n };\n\n const batches = await FileScanner.scanFiles(testDir, options);\n \n expect(batches).toHaveLength(2);\n expect(batches[0]).toHaveLength(1);\n expect(batches[1]).toHaveLength(1);\n expect(batches[0][0]).toMatch(/test\\.(css|scss)$/);\n expect(batches[1][0]).toMatch(/test\\.(css|scss)$/);\n });\n\n it('should handle invalid files gracefully', async () => {\n const options: ScanOptions = {\n patterns: {\n include: ['**/*.nonexistent'],\n exclude: []\n }\n };\n\n const batches = await FileScanner.scanFiles(testDir, options);\n expect(batches).toHaveLength(0);\n });\n}); "],
|
|
5
|
-
"mappings": ";AAAA,OAAO,UAAU;AACjB,SAAS,mBAAgC;AACzC,SAAS,yBAAyB;AAClC,SAAQ,OAAO,WAAW,UAAS;AACnC,SAAS,qBAAqB;AAC9B,IAAM,aAAa,cAAc,YAAY,GAAG;AAChD,IAAM,YAAY,KAAK,QAAQ,UAAU;AAEzC,SAAS,eAAe,MAAM;AAC5B,QAAM,UAAU,KAAK,KAAK,WAAY,UAAU;AAEhD,YAAU,YAAY;AAEpB,UAAM,MAAM,SAAS,EAAE,WAAW,KAAK,CAAC;AACxC,UAAM;AAAA,MACJ,KAAK,KAAK,SAAS,UAAU;AAAA,MAC7B;AAAA,IACF;AACA,UAAM;AAAA,MACJ,KAAK,KAAK,SAAS,WAAW;AAAA,MAC9B;AAAA,IACF;AAAA,EACF,CAAC;AAED,WAAS,YAAY;AAEnB,UAAM,GAAG,SAAS,EAAE,WAAW,KAAK,CAAC;AAAA,EACvC,CAAC;AAED,KAAG,yCAAyC,YAAY;AACtD,UAAM,UAAuB;AAAA,MAC3B,UAAU;AAAA,MACV,WAAW;AAAA,IACb;AAEA,UAAM,UAAU,MAAM,YAAY,UAAU,SAAS,OAAO;AAE5D,WAAO,OAAO,EAAE,aAAa,CAAC;AAC9B,WAAO,QAAQ,CAAC,CAAC,EAAE,aAAa,CAAC;AACjC,WAAO,QAAQ,CAAC,CAAC,EAAE,aAAa,CAAC;AACjC,WAAO,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,mBAAmB;AACjD,WAAO,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,QAAQ,mBAAmB;AAAA,EACnD,CAAC;AAED,KAAG,0CAA0C,YAAY;AACvD,UAAM,UAAuB;AAAA,MAC3B,UAAU;AAAA,QACR,SAAS,CAAC,kBAAkB;AAAA,QAC5B,SAAS,CAAC;AAAA,MACZ;AAAA,IACF;AAEA,UAAM,UAAU,MAAM,YAAY,UAAU,SAAS,OAAO;AAC5D,WAAO,OAAO,EAAE,aAAa,CAAC;AAAA,EAChC,CAAC;AACH,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/services/batch-processor.ts"],
|
|
4
|
-
"sourcesContent": ["import { Worker } from 'worker_threads';\nimport path from 'path';\nimport os from \"os\";\nimport { Logger } from '../utils/logger';\n\nconst AVAILABLE_CPUS = os.cpus().length - 1;\n\nexport interface BatchProcessorOptions {\n maxWorkers?: number;\n timeoutMs?: number;\n}\n\nexport interface BatchTask<T> {\n files: string[];\n config: T;\n}\n\nexport interface BatchResult {\n success: boolean;\n error?: string;\n results: any[];\n}\n\nexport class BatchProcessor {\n private static DEFAULT_MAX_WORKERS = Math.max(1, Math.min(4, AVAILABLE_CPUS));\n private static DEFAULT_TIMEOUT_MS = 300000; // 5 minutes\n\n /**\n * Process batches of files in parallel using worker threads\n * @param batches Array of file batches to process\n * @param workerScript Path to the worker script\n * @param taskConfig Configuration to pass to each worker\n * @param options Processing options\n */\n static async processBatches<T>(\n batches: string[][],\n workerScript: string,\n taskConfig: T,\n options: BatchProcessorOptions = {}\n ): Promise<BatchResult[]> {\n const maxWorkers = options.maxWorkers || this.DEFAULT_MAX_WORKERS;\n const timeoutMs = options.timeoutMs || this.DEFAULT_TIMEOUT_MS;\n\n Logger.debug(`Starting batch processing with ${maxWorkers} workers`);\n Logger.debug(`Processing ${batches.length} batches`);\n\n const results: BatchResult[] = [];\n const activeWorkers = new Set<Worker>();\n let currentBatchIndex = 0;\n\n try {\n while (currentBatchIndex < batches.length || activeWorkers.size > 0) {\n // Start new workers if we have capacity and batches remaining\n while (\n activeWorkers.size < maxWorkers &&\n currentBatchIndex < batches.length\n ) {\n const batchIndex = currentBatchIndex++;\n const batch = batches[batchIndex];\n const worker = this.createWorker(\n workerScript,\n { files: batch, config: taskConfig },\n timeoutMs\n );\n activeWorkers.add(worker);\n\n // Handle worker completion\n worker\n .on('message', (result: BatchResult) => {\n results.push(result);\n activeWorkers.delete(worker);\n Logger.debug(`Completed batch ${batchIndex} of ${batches.length}`);\n })\n .on('error', (error) => {\n results.push({\n success: false,\n error: error.message,\n results: []\n });\n activeWorkers.delete(worker);\n Logger.error(`Worker error in batch ${batchIndex}: ${error.message}`);\n })\n .on('exit', (code) => {\n if (code !== 0) {\n Logger.warning(`Worker exited with code ${code}`);\n }\n activeWorkers.delete(worker);\n });\n }\n\n // Wait for any worker to complete\n await new Promise((resolve) => setTimeout(resolve, 100));\n }\n\n return results;\n } catch (error: any) {\n Logger.error(`Batch processing failed: ${error.message}`);\n throw error;\n } finally {\n // Cleanup any remaining workers\n for (const worker of activeWorkers) {\n worker.terminate();\n }\n }\n }\n\n /**\n * Creates a new worker with timeout handling\n */\n private static createWorker<T>(\n scriptPath: string,\n task: BatchTask<T>,\n timeoutMs: number\n ): Worker {\n const worker = new Worker(scriptPath, {\n workerData: task\n });\n\n // Set up timeout\n const timeoutId = setTimeout(() => {\n Logger.warning(`Worker timeout after ${timeoutMs}ms`);\n worker.terminate();\n }, timeoutMs);\n\n // Clear timeout when worker is done\n worker.once('exit', () => clearTimeout(timeoutId));\n\n return worker;\n }\n} "],
|
|
5
|
-
"mappings": ";AAAA,SAAS,cAAc;AAEvB,OAAO,QAAQ;AACf,SAAS,cAAc;AAEvB,IAAM,iBAAiB,GAAG,KAAK,EAAE,SAAS;AAkBnC,IAAM,iBAAN,MAAqB;AAAA,EAC1B,OAAe,sBAAsB,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,cAAc,CAAC;AAAA,EAC5E,OAAe,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASpC,aAAa,eACX,SACA,cACA,YACA,UAAiC,CAAC,GACV;AACxB,UAAM,aAAa,QAAQ,cAAc,KAAK;AAC9C,UAAM,YAAY,QAAQ,aAAa,KAAK;AAE5C,WAAO,MAAM,kCAAkC,UAAU,UAAU;AACnE,WAAO,MAAM,cAAc,QAAQ,MAAM,UAAU;AAEnD,UAAM,UAAyB,CAAC;AAChC,UAAM,gBAAgB,oBAAI,IAAY;AACtC,QAAI,oBAAoB;AAExB,QAAI;AACF,aAAO,oBAAoB,QAAQ,UAAU,cAAc,OAAO,GAAG;AAEnE,eACE,cAAc,OAAO,cACrB,oBAAoB,QAAQ,QAC5B;AACA,gBAAM,aAAa;AACnB,gBAAM,QAAQ,QAAQ,UAAU;AAChC,gBAAM,SAAS,KAAK;AAAA,YAClB;AAAA,YACA,EAAE,OAAO,OAAO,QAAQ,WAAW;AAAA,YACnC;AAAA,UACF;AACA,wBAAc,IAAI,MAAM;AAGxB,iBACG,GAAG,WAAW,CAAC,WAAwB;AACtC,oBAAQ,KAAK,MAAM;AACnB,0BAAc,OAAO,MAAM;AAC3B,mBAAO,MAAM,mBAAmB,UAAU,OAAO,QAAQ,MAAM,EAAE;AAAA,UACnE,CAAC,EACA,GAAG,SAAS,CAAC,UAAU;AACtB,oBAAQ,KAAK;AAAA,cACX,SAAS;AAAA,cACT,OAAO,MAAM;AAAA,cACb,SAAS,CAAC;AAAA,YACZ,CAAC;AACD,0BAAc,OAAO,MAAM;AAC3B,mBAAO,MAAM,yBAAyB,UAAU,KAAK,MAAM,OAAO,EAAE;AAAA,UACtE,CAAC,EACA,GAAG,QAAQ,CAAC,SAAS;AACpB,gBAAI,SAAS,GAAG;AACd,qBAAO,QAAQ,2BAA2B,IAAI,EAAE;AAAA,YAClD;AACA,0BAAc,OAAO,MAAM;AAAA,UAC7B,CAAC;AAAA,QACL;AAGA,cAAM,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,GAAG,CAAC;AAAA,MACzD;AAEA,aAAO;AAAA,IACT,SAAS,OAAY;AACnB,aAAO,MAAM,4BAA4B,MAAM,OAAO,EAAE;AACxD,YAAM;AAAA,IACR,UAAE;AAEA,iBAAW,UAAU,eAAe;AAClC,eAAO,UAAU;AAAA,MACnB;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,OAAe,aACb,YACA,MACA,WACQ;AACR,UAAM,SAAS,IAAI,OAAO,YAAY;AAAA,MACpC,YAAY;AAAA,IACd,CAAC;AAGD,UAAM,YAAY,WAAW,MAAM;AACjC,aAAO,QAAQ,wBAAwB,SAAS,IAAI;AACpD,aAAO,UAAU;AAAA,IACnB,GAAG,SAAS;AAGZ,WAAO,KAAK,QAAQ,MAAM,aAAa,SAAS,CAAC;AAEjD,WAAO;AAAA,EACT;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/services/config.resolver.ts"],
|
|
4
|
-
"sourcesContent": ["import { fileURLToPath } from \"url\";\nimport stylelintPackage from \"stylelint/package.json\" with {type:\"json\"};\nimport eslintPackage from \"eslint/package.json\" with {type:\"json\"};\nimport cliPackage from \"../../package.json\" with {type:\"json\"};\n// TODO:Move rule Meat to metada package\nimport {ruleMetadata} from '@salesforce-ux/stylelint-plugin-slds';\n\nexport const DEFAULT_ESLINT_CONFIG_PATH = fileURLToPath(import.meta.resolve('@salesforce-ux/eslint-plugin-slds/.eslintrc.yml'));\nexport const DEFAULT_STYLELINT_CONFIG_PATH = fileURLToPath(import.meta.resolve('@salesforce-ux/stylelint-plugin-slds/.stylelintrc.yml'));\nexport const STYLELINT_VERSION = stylelintPackage.version;\nexport const ESLINT_VERSION = eslintPackage.version;\nexport const LINTER_CLI_VERSION = cliPackage.version;\n\nexport const getRuleDescription = (ruleId:string)=>{\n const ruleIdWithoutNameSpace = `${ruleId}`.replace(/\\@salesforce-ux\\//, '');\n return ruleMetadata(ruleIdWithoutNameSpace)?.ruleDesc || '--';\n}"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,qBAAqB;AAC9B,OAAO,sBAAsB,yBAAyB,KAAK,EAAC,MAAK,OAAM;AACvE,OAAO,mBAAmB,sBAAsB,KAAK,EAAC,MAAK,OAAM;AACjE,OAAO,gBAAgB,qBAAqB,KAAK,EAAC,MAAK,OAAM;AAE7D,SAAQ,oBAAmB;AAEpB,IAAM,6BAA6B,cAAc,YAAY,QAAQ,iDAAiD,CAAC;AACvH,IAAM,gCAAgC,cAAc,YAAY,QAAQ,uDAAuD,CAAC;AAChI,IAAM,oBAAoB,iBAAiB;AAC3C,IAAM,iBAAiB,cAAc;AACrC,IAAM,qBAAqB,WAAW;AAEtC,IAAM,qBAAqB,CAAC,WAAgB;AAC/C,QAAM,yBAAyB,GAAG,MAAM,GAAG,QAAQ,qBAAqB,EAAE;AAC1E,SAAO,aAAa,sBAAsB,GAAG,YAAY;AAC7D;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/services/file-patterns.ts"],
|
|
4
|
-
"sourcesContent": ["import { FilePattern } from './file-scanner';\n\nexport const StyleFilePatterns: FilePattern = {\n include: [\n '**/*.css',\n '**/*.scss',\n '**/*.less',\n '**/*.sass'\n ],\n exclude: [\n '**/node_modules/**',\n '**/dist/**',\n '**/build/**'\n ]\n};\n\nexport const ComponentFilePatterns: FilePattern = {\n include: [\n '**/*.html',\n '**/*.cmp',\n '**/*.component',\n '**/*.app',\n '**/*.page',\n '**/*.interface'\n ],\n exclude: [\n '**/node_modules/**',\n '**/dist/**',\n '**/build/**'\n ]\n}; "],
|
|
5
|
-
"mappings": ";AAEO,IAAM,oBAAiC;AAAA,EAC5C,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEO,IAAM,wBAAqC;AAAA,EAChD,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/services/file-scanner.ts"],
|
|
4
|
-
"sourcesContent": ["import { promises as fs } from 'fs';\nimport path from 'path';\nimport { glob, Path } from 'glob';\nimport { Logger } from '../utils/logger';\n\nexport interface FilePattern {\n include: string[];\n exclude?: string[];\n}\n\nexport interface ScanOptions {\n patterns: FilePattern;\n batchSize?: number;\n}\n\nexport class FileScanner {\n private static DEFAULT_BATCH_SIZE = 100;\n\n /**\n * Scans directory for files matching the given patterns\n * @param directory Base directory to scan\n * @param options Scanning options including patterns and batch size\n * @returns Array of file paths in batches\n */\n static async scanFiles(directory: string, options: ScanOptions): Promise<string[][]> {\n try {\n Logger.debug(`Scanning directory: ${directory}`);\n Logger.debug(`Include patterns: ${options.patterns.include.join(', ')}`);\n \n const allFiles: string[] = [];\n \n // Process include patterns\n for (const pattern of options.patterns.include) {\n const files = await glob(pattern, {\n cwd: directory,\n ignore: options.patterns.exclude,\n withFileTypes: true,\n dot: true // Include .dot files\n }).then((matches: Path[]) => matches\n .filter(match => match.isFile())\n .map(match => {\n // Just use the fullpath directly as it's already relative to cwd\n return match.fullpath();\n }));\n\n allFiles.push(...files);\n }\n\n // Remove duplicates\n const uniqueFiles = [...new Set(allFiles)];\n \n // Validate files exist and are readable\n const validFiles = await this.validateFiles(uniqueFiles);\n \n // Split into batches\n const batchSize = options.batchSize || this.DEFAULT_BATCH_SIZE;\n const batches = this.createBatches(validFiles, batchSize);\n \n Logger.debug(`Found ${validFiles.length} files, split into ${batches.length} batches`);\n return batches;\n } catch (error: any) {\n Logger.error(`Failed to scan files: ${error.message}`);\n throw error;\n }\n }\n\n /**\n * Validates that files exist and are readable\n */\n private static async validateFiles(files: string[]): Promise<string[]> {\n const validFiles: string[] = [];\n \n for (const file of files) {\n try {\n await fs.access(file, fs.constants.R_OK);\n validFiles.push(file);\n } catch (error) {\n Logger.warning(`Skipping inaccessible file: ${file}`);\n }\n }\n \n return validFiles;\n }\n\n /**\n * Splits array of files into batches\n */\n private static createBatches(files: string[], batchSize: number): string[][] {\n const batches: string[][] = [];\n for (let i = 0; i < files.length; i += batchSize) {\n batches.push(files.slice(i, i + batchSize));\n }\n return batches;\n }\n} "],
|
|
5
|
-
"mappings": ";AAAA,SAAS,YAAY,UAAU;AAE/B,SAAS,YAAkB;AAC3B,SAAS,cAAc;AAYhB,IAAM,cAAN,MAAkB;AAAA,EACvB,OAAe,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQpC,aAAa,UAAU,WAAmB,SAA2C;AACnF,QAAI;AACF,aAAO,MAAM,uBAAuB,SAAS,EAAE;AAC/C,aAAO,MAAM,qBAAq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,cAAQ,KAAK,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;AAAA,IAC5C;AACA,WAAO;AAAA,EACT;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/services/lint-runner.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\nimport { BatchProcessor, BatchResult } from './batch-processor';\nimport { WorkerConfig, WorkerResult, LintResult } from '../types';\nimport { Logger } from '../utils/logger';\nimport { resolveDirName } from '../utils/nodeVersionUtil';\n\nexport interface LintOptions {\n fix?: boolean;\n configPath?: string;\n maxWorkers?: number;\n timeoutMs?: number;\n}\n\nexport class LintRunner {\n /**\n * Run linting on batches of files\n */\n static async runLinting(\n fileBatches: string[][],\n workerType: 'style' | 'component',\n options: LintOptions = {}\n ): Promise<LintResult[]> {\n try {\n const workerScript = path.resolve(\n resolveDirName(import.meta) ,\n '../workers',\n workerType === 'style' ? 'stylelint.worker.js' : 'eslint.worker.js'\n );\n\n const workerConfig: WorkerConfig = {\n configPath: options.configPath,\n fix: options.fix\n };\n\n const results = await BatchProcessor.processBatches(\n fileBatches,\n workerScript,\n workerConfig,\n {\n maxWorkers: options.maxWorkers,\n timeoutMs: options.timeoutMs\n }\n );\n\n return this.processResults(results);\n } catch (error: any) {\n Logger.error(`Linting failed: ${error.message}`);\n throw error;\n }\n }\n\n /**\n * Process and normalize worker results\n */\n private static processResults(batchResults: BatchResult[]): LintResult[] {\n const results: LintResult[] = [];\n\n for (const batch of batchResults) {\n if (!batch.success || !batch.results) {\n Logger.warning(`Batch failed: ${batch.error}`);\n continue;\n }\n\n for (const result of batch.results as WorkerResult[]) {\n if (result.error) {\n Logger.warning(`File processing failed: ${result.file} - ${result.error}`);\n continue;\n }\n\n results.push({\n filePath: result.file,\n errors: result.errors?.map(e => ({\n ...e,\n severity: 2\n })) || [],\n warnings: result.warnings?.map(w => ({\n ...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UAAU,OAAO,UAAU,IAAI,QAAM;AAAA,YACnC,GAAG;AAAA,YACH,UAAU;AAAA,UACZ,EAAE,KAAK,CAAC;AAAA,QACV,CAAC;AAAA,MACH;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/services/report-generator.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\nimport fs from 'fs/promises';\nimport { Logger } from '../utils/logger';\nimport { LintResult } from '../types';\nimport { SarifBuilder, SarifRunBuilder, SarifResultBuilder, SarifRuleBuilder } from 'node-sarif-builder';\nimport { createWriteStream } from 'fs';\nimport { JsonStreamStringify } from 'json-stream-stringify';\nimport {getRuleDescription} from \"./config.resolver\";\nimport { replaceNamespaceinRules } from '../utils/lintResultsUtil';\n\nexport interface ReportOptions {\n outputPath: string;\n toolName: string;\n toolVersion: string;\n}\n\nexport class ReportGenerator {\n /**\n * Generate SARIF report from lint results\n */\n static async generateSarifReport(\n results: LintResult[],\n options: ReportOptions\n ): Promise<void> {\n try {\n const builder = new SarifBuilder();\n const runBuilder = new SarifRunBuilder().initSimple({\n toolDriverName: options.toolName,\n toolDriverVersion: options.toolVersion,\n url: options.toolName === 'eslint' \n ? 'https://eslint.org' \n : 'https://stylelint.io'\n });\n\n // Add rules\n const rules = this.extractRules(results);\n for (const rule of rules) {\n const ruleBuilder = new SarifRuleBuilder().initSimple({\n ruleId: replaceNamespaceinRules(rule.id),\n shortDescriptionText: rule.shortDescription?.text,\n });\n runBuilder.addRule(ruleBuilder);\n }\n\n // Add results\n for (const result of results) {\n this.addResultsToSarif(runBuilder, result);\n }\n\n // Add run to builder\n builder.addRun(runBuilder);\n\n // Generate the report\n const sarifReport = builder.buildSarifOutput();\n \n // Ensure output directory exists\n const outputDir = path.dirname(options.outputPath);\n await fs.mkdir(outputDir, { recursive: true });\n\n // Use JsonStreamStringify to write large JSON efficiently\n const writeStream = createWriteStream(options.outputPath);\n const jsonStream = new JsonStreamStringify(sarifReport, null, 2); // pretty print with 2 spaces\n \n // Write the report\n await new Promise<void>((resolve, reject) => {\n jsonStream\n .pipe(writeStream)\n .on('finish', resolve)\n .on('error', reject);\n });\n\n Logger.success(`SARIF report generated: ${options.outputPath}`);\n } catch (error: any) {\n Logger.error(`Failed to generate SARIF report: ${error.message}`);\n throw error;\n }\n }\n\n /**\n * Extract unique rules from results\n */\n private static extractRules(results: LintResult[]): any[] {\n const rules = new Map();\n\n for (const result of results) {\n // Process errors\n for (const error of result.errors) {\n if (!rules.has(error.ruleId)) {\n \n rules.set(error.ruleId, {\n id: replaceNamespaceinRules(error.ruleId),\n shortDescription: {\n text: getRuleDescription(replaceNamespaceinRules(error.ruleId))\n },\n properties: {\n category: 'Style'\n }\n });\n }\n }\n\n // Process warnings\n for (const warning of result.warnings) {\n if (!rules.has(warning.ruleId)) { \n rules.set(warning.ruleId, {\n id: replaceNamespaceinRules(warning.ruleId),\n shortDescription: {\n text: getRuleDescription(replaceNamespaceinRules(warning.ruleId))\n },\n properties: {\n category: 'Style'\n }\n });\n }\n }\n }\n\n return Array.from(rules.values());\n }\n\n /**\n * Add lint results to SARIF report\n */\n private static addResultsToSarif(\n runBuilder: SarifRunBuilder,\n lintResult: LintResult\n ): void {\n // Add errors\n for (const error of lintResult.errors) {\n\n const resultBuilder = new SarifResultBuilder().initSimple({\n ruleId: replaceNamespaceinRules(error.ruleId),\n level: 'error',\n messageText: error.message,\n fileUri: lintResult.filePath,\n startLine: error.line,\n startColumn: error.column,\n endLine: error.line,\n endColumn: error.endColumn\n });\n runBuilder.addResult(resultBuilder);\n }\n\n // Add warnings\n for (const warning of lintResult.warnings) {\n const resultBuilder = new SarifResultBuilder().initSimple({\n ruleId: replaceNamespaceinRules(warning.ruleId),\n level: 'warning',\n messageText: warning.message,\n fileUri: lintResult.filePath,\n startLine: warning.line,\n startColumn: warning.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AA,QACpB,WAAW,MAAM;AAAA,QACjB,aAAa,MAAM;AAAA,QACnB,SAAS,MAAM;AAAA,QACf,WAAW,MAAM;AAAA,MACnB,CAAC;AACD,iBAAW,UAAU,aAAa;AAAA,IACpC;AAGA,eAAW,WAAW,WAAW,UAAU;AACzC,YAAM,gBAAgB,IAAI,mBAAmB,EAAE,WAAW;AAAA,QACxD,QAAQ,wBAAwB,QAAQ,MAAM;AAAA,QAC9C,OAAO;AAAA,QACP,aAAa,QAAQ;AAAA,QACrB,SAAS,WAAW;AAAA,QACpB,WAAW,QAAQ;AAAA,QACnB,aAAa,QAAQ;AAAA,QACrB,SAAS,QAAQ;AAAA,QACjB,WAAW,QAAQ;AAAA,MACrB,CAAC;AACD,iBAAW,UAAU,aAAa;AAAA,IACpC;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/build/types/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/cli-args.ts"],
|
|
4
|
-
"sourcesContent": ["import { CliOptions } from '../types';\nimport path from 'path';\nimport { accessSync } from 'fs';\n\nexport function validateAndNormalizePath(inputPath?: string): string {\n if (!inputPath) {\n return process.cwd();\n }\n \n const normalizedPath = path.resolve(inputPath);\n \n try {\n // Check if path exists and is accessible\n accessSync(normalizedPath);\n return normalizedPath;\n } catch (error) {\n throw new Error(`Invalid path: ${inputPath}`);\n }\n}\n\nexport function normalizeCliOptions(options: CliOptions, defultOptions:Partial<CliOptions> = {}): Required<CliOptions> {\n return {\n fix: false,\n editor: 'vscode',\n config:'',\n configStyle:'',\n configEslint:'',\n ...defultOptions,\n ...options,\n directory: validateAndNormalizePath(options.directory),\n output: validateAndNormalizePath(options.output)\n };\n} "],
|
|
5
|
-
"mappings": ";AACA,OAAO,UAAU;AACjB,SAAS,kBAAkB;AAEpB,SAAS,yBAAyB,WAA4B;AACnE,MAAI,CAAC,WAAW;AACd,WAAO,QAAQ,IAAI;AAAA,EACrB;AAEA,QAAM,iBAAiB,KAAK,QAAQ,SAAS;AAE7C,MAAI;AAEF,eAAW,cAAc;AACzB,WAAO;AAAA,EACT,SAAS,OAAO;AACd,UAAM,IAAI,MAAM,iBAAiB,SAAS,EAAE;AAAA,EAC9C;AACF;AAEO,SAAS,oBAAoB,SAAqB,gBAAoC,CAAC,GAAyB;AACrH,SAAO;AAAA,IACL,KAAK;AAAA,IACL,QAAQ;AAAA,IACR,QAAO;AAAA,IACP,aAAY;AAAA,IACZ,cAAa;AAAA,IACb,GAAG;AAAA,IACH,GAAG;AAAA,IACH,WAAW,yBAAyB,QAAQ,SAAS;AAAA,IACrD,QAAQ,yBAAyB,QAAQ,MAAM;AAAA,EACjD;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/editorLinkUtil.ts"],
|
|
4
|
-
"sourcesContent": ["// src/utils/editorLinkUtil.ts\n\nimport chalk from 'chalk';\n\n/**\n * Returns an editor-specific link for opening a file at a given line and column.\n *\n * @param editor - The editor to use (e.g., 'vscode', 'atom', 'sublime').\n * @param absolutePath - The absolute path to the file.\n * @param line - The line number in the file.\n * @param column - The column number in the file.\n * @returns A URL string that can be used to open the file in the specified editor.\n */\nexport function getEditorLink(\n editor: string,\n absolutePath: string,\n line: number,\n column: number\n): string {\n if (editor === 'vscode') {\n return `vscode://file/${absolutePath}:${line}:${column}`;\n } else if (editor === 'atom') {\n return `atom://core/open/file?filename=${absolutePath}&line=${line}&column=${column}`;\n } else if (editor === 'sublime') {\n // Sublime Text does not have a standard URL scheme.\n return `file://${absolutePath}:${line}:${column}`;\n } else {\n // Fallback to a standard file URL.\n return `file://${absolutePath}:${line}:${column}`;\n }\n}\n\n/**\n * Creates an ANSI hyperlink (if supported) for the line:column text.\n *\n * @param lineCol - The line:column string (e.g., \"10:5\").\n * @param absolutePath - The absolute path to the file.\n * @param line - The line number in the file.\n * @param column - The column number in the file.\n * @param editor - The editor to use (e.g., 'vscode', 'atom', 'sublime').\n * @returns A string with ANSI escape sequences to create a clickable hyperlink.\n */\nexport function createClickableLineCol(\n lineCol: string,\n absolutePath: string,\n line: number,\n column: number,\n editor: string\n): string {\n const link = getEditorLink(editor, absolutePath, line, column);\n return `\\u001b]8;;${link}\\u0007${chalk.blueBright(lineCol)}\\u001b]8;;\\u0007`;\n}\n"],
|
|
5
|
-
"mappings": ";AAEA,OAAO,WAAW;AAWX,SAAS,cACd,QACA,cACA,MACA,QACQ;AACR,MAAI,WAAW,UAAU;AACvB,WAAO,iBAAiB,YAAY,IAAI,IAAI,IAAI,MAAM;AAAA,EACxD,WAAW,WAAW,QAAQ;AAC5B,WAAO,kCAAkC,YAAY,SAAS,IAAI,WAAW,MAAM;AAAA,EACrF,WAAW,WAAW,WAAW;AAE/B,WAAO,UAAU,YAAY,IAAI,IAAI,IAAI,MAAM;AAAA,EACjD,OAAO;AAEL,WAAO,UAAU,YAAY,IAAI,IAAI,IAAI,MAAM;AAAA,EACjD;AACF;AAYO,SAAS,uBACd,SACA,cACA,MACA,QACA,QACQ;AACR,QAAM,OAAO,cAAc,QAAQ,cAAc,MAAM,MAAM;AAC7D,SAAO,WAAa,IAAI,OAAS,MAAM,WAAW,OAAO,CAAC;AAC5D;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/lintResultsUtil.ts"],
|
|
4
|
-
"sourcesContent": ["// src/utils/lintResultsUtil.ts\n\nimport chalk from 'chalk';\nimport path from 'path';\nimport { createClickableLineCol } from './editorLinkUtil';\nimport { Logger } from '../utils/logger';\nimport { LintResult } from '../types';\n\n/**\n * \n * @param id - Rule id\n * @returns updated Rule id without the namespace @salesforce-ux\n */\nexport function replaceNamespaceinRules(id: string) {\n return id.includes(\"@salesforce-ux/\")\n ? id.replace(\"@salesforce-ux/\", \"\")\n : id;\n}\n\n/**\n * Prints detailed lint results for each file that has issues.\n *\n * @param results - Array of lint results.\n * @param editor - The chosen editor for clickable links (e.g., \"vscode\", \"atom\", \"sublime\").\n */\nexport function printLintResults(results: LintResult[], editor: string): void {\n results.forEach(result => {\n const hasErrors = result.errors && result.errors.length > 0;\n const hasWarnings = result.warnings && result.warnings.length > 0;\n if (!hasErrors && !hasWarnings) return;\n\n const absolutePath = result.filePath || '';\n const relativeFile = path.relative(process.cwd(), absolutePath) || 'Unknown file';\n // Print file name with a preceding new line for spacing.\n Logger.info(`\\n${chalk.bold(relativeFile)}`);\n\n if (hasErrors) {\n result.errors.forEach((error: any) => {\n if (error.line && error.column && absolutePath) {\n const lineCol = `${error.line}:${error.column}`;\n const clickable = createClickableLineCol(lineCol, absolutePath, error.line, error.column, editor);\n const ruleId = error.ruleId ? chalk.dim(replaceNamespaceinRules(error.ruleId)) : '';\n Logger.error(` ${clickable} ${error.message} ${ruleId}`);\n } else {\n Logger.error(` ${chalk.red('Error:')} ${error.message}`);\n }\n });\n }\n\n if (hasWarnings) {\n result.warnings.forEach((warn: any) => {\n if (warn.line && warn.column && absolutePath) {\n const lineCol = `${warn.line}:${warn.column}`;\n const clickable = createClickableLineCol(lineCol, absolutePath, warn.line, warn.column, editor);\n const ruleId = warn.ruleId ? chalk.dim(replaceNamespaceinRules(warn.ruleId)) : '';\n Logger.warning(` ${clickable} ${warn.message} ${ruleId}`);\n } else {\n Logger.warning(` ${chalk.yellow('Warning:')} ${warn.message}`);\n }\n });\n }\n });\n}\n"],
|
|
5
|
-
"mappings": ";AAEA,OAAO,WAAW;AAClB,OAAO,UAAU;AACjB,SAAS,8BAA8B;AACvC,SAAS,cAAc;AAQhB,SAAS,wBAAwB,IAAY;AAClD,SAAO,GAAG,SAAS,iBAAiB,IAChC,GAAG,QAAQ,mBAAmB,EAAE,IAChC;AACN;AAQO,SAAS,iBAAiB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iBAAO,QAAQ,KAAK,MAAM,OAAO,UAAU,CAAC,IAAI,KAAK,OAAO,EAAE;AAAA,QAChE;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACH;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/logger.ts"],
|
|
4
|
-
"sourcesContent": ["import chalk from 'chalk';\n\nexport class Logger {\n static info(message: string): void {\n console.log(chalk.blue('\u2139'), message);\n }\n\n static success(message: string): void {\n console.log(chalk.green('\u2713'), message);\n }\n\n static warning(message: string): void {\n console.warn(chalk.yellow('\u26A0'), message);\n }\n\n static error(message: string): void {\n console.error(chalk.red('\u2716'), message);\n }\n\n static debug(message: string): void {\n if (process.env.DEBUG) {\n console.debug(chalk.gray('\uD83D\uDD0D'), message);\n }\n }\n} "],
|
|
5
|
-
"mappings": ";AAAA,OAAO,WAAW;AAEX,IAAM,SAAN,MAAa;AAAA,EAClB,OAAO,KAAK,SAAuB;AACjC,YAAQ,IAAI,MAAM,KAAK,QAAG,GAAG,OAAO;AAAA,EACtC;AAAA,EAEA,OAAO,QAAQ,SAAuB;AACpC,YAAQ,IAAI,MAAM,MAAM,QAAG,GAAG,OAAO;AAAA,EACvC;AAAA,EAEA,OAAO,QAAQ,SAAuB;AACpC,YAAQ,KAAK,MAAM,OAAO,QAAG,GAAG,OAAO;AAAA,EACzC;AAAA,EAEA,OAAO,MAAM,SAAuB;AAClC,YAAQ,MAAM,MAAM,IAAI,QAAG,GAAG,OAAO;AAAA,EACvC;AAAA,EAEA,OAAO,MAAM,SAAuB;AAClC,QAAI,QAAQ,IAAI,OAAO;AACrB,cAAQ,MAAM,MAAM,KAAK,WAAI,GAAG,OAAO;AAAA,IACzC;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/utils/nodeVersionUtil.ts"],
|
|
4
|
-
"sourcesContent": ["import semver from 'semver';\nimport { fileURLToPath } from 'url';\nimport { dirname } from 'path';\nimport { Logger } from './logger'; // Ensure this path is correct\n\nexport const REQUIRED_NODE_VERSION = \"^18.20.0 || >=20.10.0\";\n\n/**\n * Checks if the current Node.js version meets the required version.\n * @param {string} requiredVersion - The required Node.js version.\n * @returns {boolean} - Returns true if the current version is valid.\n */\nexport function checkNodeVersion(requiredVersion) {\n return semver.satisfies(process.version, requiredVersion);\n}\n\n/**\n * Validates the Node.js version and exits if it does not meet the requirement.\n */\nexport function validateNodeVersion() {\n if (!checkNodeVersion(REQUIRED_NODE_VERSION)) {\n if(checkNodeVersion(\"<=^18.x\")){\n Logger.error(\n `Node.js version ${process.version} is not supported. Please upgrade to v18.20.0 or later.`\n );\n } else if(checkNodeVersion(\"^20.x\") || checkNodeVersion(\"^19.x\")){\n Logger.error(\n `Node.js version ${process.version} is not supported. Please upgrade to v20.10.0 or later.`\n );\n } \n process.exit(1);\n }\n}\n\n/**\n * Util to resolve dirName from import meta compatible with node v18\n * Letst version of node have import.meta.dirname\n * @param importMeta \n * @returns \n */\nexport function resolveDirName(importMeta:ImportMeta){\n if(\"dirname\" in importMeta){\n return importMeta.dirname;\n }\n return dirname(fileURLToPath((importMeta as ImportMeta).url));\n}\n\nexport function resolvePath(specifier:string, parentURL = import.meta.url) {\n return new URL(specifier, parentURL).href;\n};"],
|
|
5
|
-
"mappings": ";AAAA,OAAO,YAAY;AACnB,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AACxB,SAAS,cAAc;AAEhB,IAAM,wBAAwB;AAO9B,SAAS,iBAAiB,iBAAiB;AAChD,SAAO,OAAO,UAAU,QAAQ,SAAS,eAAe;AAC1D;AAKO,SAAS,sBAAsB;AACpC,MAAI,CAAC,iBAAiB,qBAAqB,GAAG;AAC5C,QAAG,iBAAiB,SAAS,GAAE;AAC7B,aAAO;AAAA,QACL,mBAAmB,QAAQ,OAAO;AAAA,MACpC;AAAA,IACF,WAAU,iBAAiB,OAAO,KAAK,iBAAiB,OAAO,GAAE;AAC/D,aAAO;AAAA,QACL,mBAAmB,QAAQ,OAAO;AAAA,MACpC;AAAA,IACF;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;AAQO,SAAS,eAAe,YAAsB;AACnD,MAAG,aAAa,YAAW;AACzB,WAAO,WAAW;AAAA,EACpB;AACA,SAAO,QAAQ,cAAe,WAA0B,GAAG,CAAC;AAC9D;AAEO,SAAS,YAAY,WAAkB,YAAY,YAAY,KAAK;AACzE,SAAO,IAAI,IAAI,WAAW,SAAS,EAAE;AACvC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/workers/base.worker.ts"],
|
|
4
|
-
"sourcesContent": ["import { parentPort, workerData } from 'worker_threads';\nimport { BatchTask, BatchResult } from '../services/batch-processor';\n\nexport abstract class BaseWorker<T, R> {\n protected task: BatchTask<T>;\n\n constructor() {\n this.task = workerData as BatchTask<T>;\n }\n\n /**\n * Process a single file\n * @param filePath Path to the file to process\n * @returns Processing result\n */\n protected abstract processFile(filePath: string): Promise<R>;\n\n /**\n * Start processing the batch of files\n */\n async process(): Promise<void> {\n try {\n const results: R[] = [];\n\n for (const file of this.task.files) {\n try {\n const result = await this.processFile(file);\n results.push(result);\n } catch (error: any) {\n results.push({\n file,\n error: error.message\n } as R);\n }\n }\n\n const batchResult: BatchResult = {\n success: true,\n results\n };\n\n parentPort?.postMessage(batchResult);\n } catch (error: any) {\n const errorResult: BatchResult = {\n success: false,\n error: error.message,\n results: []\n };\n \n parentPort?.postMessage(errorResult);\n } finally {\n process.exit(0);\n }\n }\n} "],
|
|
5
|
-
"mappings": ";AAAA,SAAS,YAAY,kBAAkB;AAGhC,IAAe,aAAf,MAAgC;AAAA,EAC3B;AAAA,EAEV,cAAc;AACZ,SAAK,OAAO;AAAA,EACd;AAAA;AAAA;AAAA;AAAA,EAYA,MAAM,UAAyB;AAC7B,QAAI;AACF,YAAM,UAAe,CAAC;AAEtB,iBAAW,QAAQ,KAAK,KAAK,OAAO;AAClC,YAAI;AACF,gBAAM,SAAS,MAAM,KAAK,YAAY,IAAI;AAC1C,kBAAQ,KAAK,MAAM;AAAA,QACrB,SAAS,OAAY;AACnB,kBAAQ,KAAK;AAAA,YACX;AAAA,YACA,OAAO,MAAM;AAAA,UACf,CAAM;AAAA,QACR;AAAA,MACF;AAEA,YAAM,cAA2B;AAAA,QAC/B,SAAS;AAAA,QACT;AAAA,MACF;AAEA,kBAAY,YAAY,WAAW;AAAA,IACrC,SAAS,OAAY;AACnB,YAAM,cAA2B;AAAA,QAC/B,SAAS;AAAA,QACT,OAAO,MAAM;AAAA,QACb,SAAS,CAAC;AAAA,MACZ;AAEA,kBAAY,YAAY,WAAW;AAAA,IACrC,UAAE;AACA,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/workers/eslint.worker.ts"],
|
|
4
|
-
"sourcesContent": ["import { ESLint } from 'eslint';\nimport { BaseWorker } from './base.worker';\nimport { WorkerConfig, WorkerResult } from '../types';\n\nclass ESLintWorker extends BaseWorker<WorkerConfig, WorkerResult> {\n private eslint: ESLint;\n\n constructor() {\n super();\n this.eslint = new ESLint({\n useEslintrc: true,\n fix: this.task.config.fix,\n overrideConfigFile: this.task.config.configPath\n });\n }\n\n protected async processFile(filePath: string): Promise<WorkerResult> {\n try {\n const results = await this.eslint.lintFiles([filePath]);\n const fileResult = results[0];\n\n // Apply fixes if requested\n if (this.task.config.fix && fileResult.output) {\n await ESLint.outputFixes(results);\n }\n return {\n file: filePath,\n warnings: fileResult.messages\n .filter(msg => msg.severity === 1)\n .map(warning => ({\n line: warning.line,\n column: warning.column,\n endColumn: warning.endColumn,\n message: warning.message,\n ruleId: warning.ruleId || 'unknown'\n })),\n errors: fileResult.messages\n .filter(msg => msg.severity === 2)\n .map(error => ({\n line: error.line,\n column: error.column,\n endColumn: error.endColumn,\n message: error.message,\n ruleId: error.ruleId || 'unknown'\n }))\n };\n } catch (error: any) {\n return {\n file: filePath,\n error: error.message\n };\n }\n }\n}\n\n// Initialize and start the worker\nconst worker = new ESLintWorker();\nworker.process().catch(error => {\n console.error('Worker failed:', error);\n process.exit(1);\n}); "],
|
|
5
|
-
"mappings": ";AAAA,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAG3B,IAAM,eAAN,cAA2B,WAAuC;AAAA,EACxD;AAAA,EAER,cAAc;AACZ,UAAM;AACN,SAAK,SAAS,IAAI,OAAO;AAAA,MACvB,aAAa;AAAA,MACb,KAAK,KAAK,KAAK,OAAO;AAAA,MACtB,oBAAoB,KAAK,KAAK,OAAO;AAAA,IACvC,CAAC;AAAA,EACH;AAAA,EAEA,MAAgB,YAAY,UAAyC;AACnE,QAAI;AACF,YAAM,UAAU,MAAM,KAAK,OAAO,UAAU,CAAC,QAAQ,CAAC;AACtD,YAAM,aAAa,QAAQ,CAAC;AAG5B,UAAI,KAAK,KAAK,OAAO,OAAO,WAAW,QAAQ;AAC7C,cAAM,OAAO,YAAY,OAAO;AAAA,MAClC;AACA,aAAO;AAAA,QACL,MAAM;AAAA,QACN,UAAU,WAAW,SAClB,OAAO,SAAO,IAAI,aAAa,CAAC,EAChC,IAAI,cAAY;AAAA,UACf,MAAM,QAAQ;AAAA,UACd,QAAQ,QAAQ;AAAA,UAChB,WAAW,QAAQ;AAAA,UACnB,SAAS,QAAQ;AAAA,UACjB,QAAQ,QAAQ,UAAU;AAAA,QAC5B,EAAE;AAAA,QACJ,QAAQ,WAAW,SAChB,OAAO,SAAO,IAAI,aAAa,CAAC,EAChC,IAAI,YAAU;AAAA,UACb,MAAM,MAAM;AAAA,UACZ,QAAQ,MAAM;AAAA,UACd,WAAW,MAAM;AAAA,UACjB,SAAS,MAAM;AAAA,UACf,QAAQ,MAAM,UAAU;AAAA,QAC1B,EAAE;AAAA,MACN;AAAA,IACF,SAAS,OAAY;AACnB,aAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO,MAAM;AAAA,MACf;AAAA,IACF;AAAA,EACF;AACF;AAGA,IAAM,SAAS,IAAI,aAAa;AAChC,OAAO,QAAQ,EAAE,MAAM,WAAS;AAC9B,UAAQ,MAAM,kBAAkB,KAAK;AACrC,UAAQ,KAAK,CAAC;AAChB,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/workers/stylelint.worker.ts"],
|
|
4
|
-
"sourcesContent": ["import stylelint from 'stylelint';\nimport { BaseWorker } from './base.worker';\nimport { WorkerConfig, WorkerResult } from '../types';\n\nclass StylelintWorker extends BaseWorker<WorkerConfig, WorkerResult> {\n protected async processFile(filePath: string): Promise<WorkerResult> {\n try {\n const options: stylelint.LinterOptions = {\n files: filePath,\n fix: this.task.config.fix,\n };\n\n // Load custom config if provided\n if (this.task.config.configPath) {\n options.configFile = this.task.config.configPath;\n }\n\n const result = await stylelint.lint(options);\n const fileResult = result.results[0];\n\n // Convert stylelint results to our format\n return {\n file: filePath,\n warnings: fileResult.warnings.map(warning => ({\n line: warning.line,\n column: warning.column,\n endColumn: warning.endColumn,\n message: warning.text,\n ruleId: warning.rule\n })),\n errors: [] // Stylelint doesn't differentiate between warnings and errors\n };\n } catch (error: any) {\n return {\n file: filePath,\n error: error.message\n };\n }\n }\n}\n\n// Initialize and start the worker\nconst worker = new StylelintWorker();\nworker.process().catch(error => {\n console.error('Worker failed:', error);\n process.exit(1);\n}); "],
|
|
5
|
-
"mappings": ";AAAA,OAAO,eAAe;AACtB,SAAS,kBAAkB;AAG3B,IAAM,kBAAN,cAA8B,WAAuC;AAAA,EACnE,MAAgB,YAAY,UAAyC;AACnE,QAAI;AACF,YAAM,UAAmC;AAAA,QACvC,OAAO;AAAA,QACP,KAAK,KAAK,KAAK,OAAO;AAAA,MACxB;AAGA,UAAI,KAAK,KAAK,OAAO,YAAY;AAC/B,gBAAQ,aAAa,KAAK,KAAK,OAAO;AAAA,MACxC;AAEA,YAAM,SAAS,MAAM,UAAU,KAAK,OAAO;AAC3C,YAAM,aAAa,OAAO,QAAQ,CAAC;AAGnC,aAAO;AAAA,QACL,MAAM;AAAA,QACN,UAAU,WAAW,SAAS,IAAI,cAAY;AAAA,UAC5C,MAAM,QAAQ;AAAA,UACd,QAAQ,QAAQ;AAAA,UAChB,WAAW,QAAQ;AAAA,UACnB,SAAS,QAAQ;AAAA,UACjB,QAAQ,QAAQ;AAAA,QAClB,EAAE;AAAA,QACF,QAAQ,CAAC;AAAA;AAAA,MACX;AAAA,IACF,SAAS,OAAY;AACnB,aAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO,MAAM;AAAA,MACf;AAAA,IACF;AAAA,EACF;AACF;AAGA,IAAM,SAAS,IAAI,gBAAgB;AACnC,OAAO,QAAQ,EAAE,MAAM,WAAS;AAC9B,UAAQ,MAAM,kBAAkB,KAAK;AACrC,UAAQ,KAAK,CAAC;AAChB,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|