@salesforce-ux/slds-linter 0.5.1-internal → 0.5.2-internal-beta.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/build/index.js
CHANGED
|
@@ -19,7 +19,7 @@ process.on("uncaughtException", (error) => {
|
|
|
19
19
|
var program = new Command();
|
|
20
20
|
program.name("npx @salesforce-ux/slds-linter@latest").showHelpAfterError();
|
|
21
21
|
function registerVersion() {
|
|
22
|
-
program.description("SLDS Linter CLI tool for linting styles and components").version("0.5.
|
|
22
|
+
program.description("SLDS Linter CLI tool for linting styles and components").version("0.5.2-internal-beta.0");
|
|
23
23
|
}
|
|
24
24
|
registerLintCommand(program);
|
|
25
25
|
registerReportCommand(program);
|
|
@@ -5,7 +5,7 @@ var DEFAULT_ESLINT_CONFIG_PATH = resolvePath("@salesforce-ux/eslint-plugin-slds/
|
|
|
5
5
|
var DEFAULT_STYLELINT_CONFIG_PATH = resolvePath("@salesforce-ux/stylelint-plugin-slds/.stylelintrc.mjs", import.meta);
|
|
6
6
|
var STYLELINT_VERSION = "16.14.1";
|
|
7
7
|
var ESLINT_VERSION = "9.30.1";
|
|
8
|
-
var LINTER_CLI_VERSION = "0.5.
|
|
8
|
+
var LINTER_CLI_VERSION = "0.5.2-internal-beta.0";
|
|
9
9
|
var getRuleDescription = (ruleId) => {
|
|
10
10
|
const ruleIdWithoutNameSpace = `${ruleId}`.replace(/\@salesforce-ux\//, "");
|
|
11
11
|
return ruleMetadata(ruleIdWithoutNameSpace)?.ruleDesc || "--";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// src/services/file-scanner.ts
|
|
2
2
|
import { promises as fs } from "fs";
|
|
3
3
|
import { Logger } from "../utils/logger.js";
|
|
4
|
-
import { globby } from "globby";
|
|
4
|
+
import { globby, isDynamicPattern } from "globby";
|
|
5
5
|
import { extname } from "path";
|
|
6
|
+
import path from "path";
|
|
6
7
|
var FileScanner = class {
|
|
7
8
|
static DEFAULT_BATCH_SIZE = 100;
|
|
8
9
|
/**
|
|
@@ -14,16 +15,43 @@ var FileScanner = class {
|
|
|
14
15
|
static async scanFiles(directory, options) {
|
|
15
16
|
try {
|
|
16
17
|
Logger.debug(`Scanning directory: ${directory}`);
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const normalizedPath = directory.replace(/\\/g, "/");
|
|
19
|
+
let workingDirectory;
|
|
20
|
+
let globPattern;
|
|
21
|
+
if (!isDynamicPattern(normalizedPath)) {
|
|
22
|
+
const hasExtension = path.extname(normalizedPath) !== "";
|
|
23
|
+
if (hasExtension) {
|
|
24
|
+
const directory2 = path.dirname(normalizedPath);
|
|
25
|
+
workingDirectory = path.isAbsolute(directory2) ? directory2 : path.join(process.cwd(), directory2);
|
|
26
|
+
globPattern = path.basename(normalizedPath);
|
|
27
|
+
} else {
|
|
28
|
+
workingDirectory = path.isAbsolute(normalizedPath) ? normalizedPath : path.join(process.cwd(), normalizedPath);
|
|
29
|
+
const extensions = options.patterns.extensions.join(",");
|
|
30
|
+
globPattern = `**/*.{${extensions}}`;
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
const firstGlobIndex = normalizedPath.search(/[*?{}[\]!+@()]/);
|
|
34
|
+
const lastDirectoryIndex = normalizedPath.substring(0, firstGlobIndex).lastIndexOf("/");
|
|
35
|
+
if (lastDirectoryIndex === -1) {
|
|
36
|
+
workingDirectory = process.cwd();
|
|
37
|
+
globPattern = normalizedPath;
|
|
38
|
+
} else {
|
|
39
|
+
const basePath = normalizedPath.substring(0, lastDirectoryIndex);
|
|
40
|
+
workingDirectory = path.isAbsolute(basePath) ? basePath : path.join(process.cwd(), basePath);
|
|
41
|
+
globPattern = normalizedPath.substring(lastDirectoryIndex + 1);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const allFiles = await globby(globPattern, {
|
|
45
|
+
cwd: workingDirectory,
|
|
46
|
+
expandDirectories: false,
|
|
47
|
+
// Disable for optimum performance - avoid unintended file discovery
|
|
20
48
|
unique: true,
|
|
21
49
|
ignore: options.patterns.exclude,
|
|
22
50
|
onlyFiles: true,
|
|
23
51
|
dot: true,
|
|
24
52
|
// Include.dot files
|
|
25
53
|
absolute: true,
|
|
26
|
-
gitignore:
|
|
54
|
+
gitignore: options.gitignore !== false
|
|
27
55
|
}).then((matches) => matches.filter((match) => {
|
|
28
56
|
const fileExt = extname(match).substring(1);
|
|
29
57
|
return options.patterns.extensions.includes(fileExt);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce-ux/slds-linter",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2-internal-beta.0",
|
|
4
4
|
"description": "SLDS Linter CLI tool for linting styles and components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lightning design system linter",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
],
|
|
30
30
|
"bin": "build/index.js",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@salesforce-ux/eslint-plugin-slds": "0.5.
|
|
33
|
-
"@salesforce-ux/stylelint-plugin-slds": "0.5.
|
|
32
|
+
"@salesforce-ux/eslint-plugin-slds": "0.5.2-internal-beta.0",
|
|
33
|
+
"@salesforce-ux/stylelint-plugin-slds": "0.5.2-internal-beta.0",
|
|
34
34
|
"@typescript-eslint/eslint-plugin": "^8.36.0",
|
|
35
35
|
"@typescript-eslint/parser": "^8.36.0",
|
|
36
36
|
"chalk": "^4.1.2",
|