@salesforce-ux/slds-linter 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -19,7 +19,7 @@ process.on("uncaughtException", (error) => {
19
19
  var program = new Command();
20
20
  program.name("npx @salesforce-ux/slds-linter@latest").showHelpAfterError();
21
21
  function registerVersion() {
22
- program.description("SLDS Linter CLI tool for linting styles and components").version("1.0.4");
22
+ program.description("SLDS Linter CLI tool for linting styles and components").version("1.0.5");
23
23
  }
24
24
  registerLintCommand(program);
25
25
  registerReportCommand(program);
@@ -1,8 +1,9 @@
1
1
  // src/services/config-loader.ts
2
2
  import { readFile, writeFile } from "fs/promises";
3
3
  import { createRequire } from "module";
4
- import { join } from "path";
5
- import { tmpdir } from "os";
4
+ import { join, resolve } from "path";
5
+ import { tmpdir, platform } from "os";
6
+ import { pathToFileURL } from "url";
6
7
  import { Logger } from "../utils/logger.js";
7
8
  var ConfigLoader = class {
8
9
  /**
@@ -25,29 +26,36 @@ var ConfigLoader = class {
25
26
  return configPath;
26
27
  }
27
28
  try {
28
- const userConfigUrl = `file://${configPath}`;
29
+ const absolutePath = resolve(configPath);
30
+ if (absolutePath.includes("eslint-plugin-slds") && absolutePath.includes("eslint.config.mjs")) {
31
+ Logger.debug("Using bundled config as-is");
32
+ return absolutePath;
33
+ }
34
+ const userConfigUrl = pathToFileURL(absolutePath).href;
29
35
  const pluginInstalled = this.isPackageInstalled("@salesforce-ux/eslint-plugin-slds", userConfigUrl);
30
36
  const eslintInstalled = this.isPackageInstalled("eslint", userConfigUrl);
31
37
  if (pluginInstalled && eslintInstalled) {
32
38
  Logger.debug("Dependencies already installed, using config as-is");
33
- return configPath;
39
+ return platform() === "win32" ? userConfigUrl : absolutePath;
34
40
  }
35
41
  Logger.debug("Dependencies not installed, rewriting imports");
36
- const configContent = await readFile(configPath, "utf-8");
42
+ const configContent = await readFile(absolutePath, "utf-8");
37
43
  const require2 = createRequire(import.meta.url);
38
44
  const pluginPath = require2.resolve("@salesforce-ux/eslint-plugin-slds");
39
45
  const eslintConfigPath = require2.resolve("eslint/config");
46
+ const pluginImport = platform() === "win32" ? pathToFileURL(pluginPath).href : pluginPath;
47
+ const eslintConfigImport = platform() === "win32" ? pathToFileURL(eslintConfigPath).href : eslintConfigPath;
40
48
  const rewritten = configContent.replace(
41
49
  /import\s+(\w+)\s+from\s+['"]@salesforce-ux\/eslint-plugin-slds['"]/g,
42
- `import $1 from '${pluginPath}'`
50
+ `import $1 from '${pluginImport}'`
43
51
  ).replace(
44
52
  /import\s+({[^}]+})\s+from\s+['"]eslint\/config['"]/g,
45
- `import $1 from '${eslintConfigPath}'`
53
+ `import $1 from '${eslintConfigImport}'`
46
54
  );
47
55
  const tempPath = join(tmpdir(), `slds-config-${Date.now()}.mjs`);
48
56
  await writeFile(tempPath, rewritten, "utf-8");
49
57
  Logger.debug(`Rewritten config: ${tempPath}`);
50
- return tempPath;
58
+ return platform() === "win32" ? pathToFileURL(tempPath).href : tempPath;
51
59
  } catch (error) {
52
60
  Logger.error(`Config processing failed: ${error.message}`);
53
61
  throw error;
@@ -157,7 +157,7 @@ var rule_messages_default = {
157
157
  // src/services/config.resolver.ts
158
158
  var DEFAULT_ESLINT_CONFIG_PATH = resolvePath("@salesforce-ux/eslint-plugin-slds/config", import.meta);
159
159
  var ESLINT_VERSION = "9.36.0";
160
- var LINTER_CLI_VERSION = "1.0.4";
160
+ var LINTER_CLI_VERSION = "1.0.5";
161
161
  var getRuleDescription = (ruleId) => {
162
162
  const ruleIdWithoutNameSpace = `${ruleId}`.replace(/\@salesforce-ux\//, "").replace(/^slds\//, "");
163
163
  return rule_messages_default[ruleIdWithoutNameSpace]?.description || "--";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce-ux/slds-linter",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "SLDS Linter CLI tool for linting styles and components",
5
5
  "keywords": [
6
6
  "lightning design system linter",
@@ -29,7 +29,7 @@
29
29
  ],
30
30
  "bin": "build/index.js",
31
31
  "dependencies": {
32
- "@salesforce-ux/eslint-plugin-slds": "1.0.4",
32
+ "@salesforce-ux/eslint-plugin-slds": "1.0.5",
33
33
  "@typescript-eslint/eslint-plugin": "^8.36.0",
34
34
  "@typescript-eslint/parser": "^8.36.0",
35
35
  "chalk": "^4.1.2",