@jpeakai/mermaidjs-lint 0.6.2 → 0.6.3

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/dist/bin.js CHANGED
@@ -9,7 +9,7 @@ import { parseArgs } from "node:util";
9
9
  // package.json
10
10
  var package_default = {
11
11
  name: "@jpeakai/mermaidjs-lint",
12
- version: "0.6.2",
12
+ version: "0.6.3",
13
13
  type: "module",
14
14
  description: "Deterministic lint gates and verified fixers for Mermaid diagrams in markdown",
15
15
  license: "MIT",
@@ -2828,7 +2828,7 @@ var setUp = async ({
2828
2828
  // src/cli.ts
2829
2829
  var SYNOPSIS = `usage: mermaidjs-lint <path...> [--fix] [--json] [--preset NAME] [--profile NAME] [--config FILE]
2830
2830
  [--canvas-light COLOUR] [--canvas-dark COLOUR] [--no-plugins | --lenient-plugins]
2831
- mermaidjs-lint --list-rules
2831
+ mermaidjs-lint --list-rules [--config FILE] [--no-plugins | --lenient-plugins]
2832
2832
  mermaidjs-lint --validate-plugins [--json] [--config FILE]
2833
2833
  mermaidjs-lint --version | -h, --help`;
2834
2834
  var ruleRow = (r, width) => `${`${r.id}${r.fix ? "*" : ""}`.padEnd(width)} ${r.summary}`;
@@ -2869,7 +2869,7 @@ Plugins load on their own from .mermaidjs-lint/rules, from dependencies named me
2869
2869
  --lenient-plugins skips a plugin that fails to load and says so, instead of stopping the run.
2870
2870
  --validate-plugins imports and checks every plugin, reports every failure, and runs no check or fix.
2871
2871
  --list-rules prints every active rule by category, including plugin rules, and where each plugin came from.
2872
- It imports the plugins to list them.
2872
+ It imports the plugins to list them, and takes no path or other flag.
2873
2873
  --version prints the version, to quote in a bug report.
2874
2874
  Exits 0 when no findings remain, 1 when findings remain, a plugin fails to load or the run fails (a lenient run
2875
2875
  skips a broken plugin, so it alone does not exit 1), and 2 on a usage error.`;
@@ -3004,6 +3004,15 @@ var run = async (argv, cwd) => {
3004
3004
  if (validating && (values["no-plugins"] || values.fix || listing)) {
3005
3005
  throw new FlagError("--validate-plugins", "--validate-plugins takes no --no-plugins, --fix or --list-rules");
3006
3006
  }
3007
+ if (listing && !validating) {
3008
+ const ignored = [
3009
+ ...["fix", "json", "preset", "profile", "canvas-light", "canvas-dark"].filter((name) => values[name] !== undefined && values[name] !== false).map((name) => `--${name}`),
3010
+ ...positionals.length > 0 ? ["a path"] : []
3011
+ ];
3012
+ if (ignored.length > 0) {
3013
+ throw new FlagError("--list-rules", `--list-rules takes only --config and --no-plugins or --lenient-plugins, not ${ignored.join(", ")}`);
3014
+ }
3015
+ }
3007
3016
  if (validating && positionals.length > 0) {
3008
3017
  throw new FlagError("files", "--validate-plugins runs no check, so it takes no files");
3009
3018
  }
package/dist/index.js CHANGED
@@ -2023,7 +2023,7 @@ import { parseArgs } from "node:util";
2023
2023
  // package.json
2024
2024
  var package_default = {
2025
2025
  name: "@jpeakai/mermaidjs-lint",
2026
- version: "0.6.2",
2026
+ version: "0.6.3",
2027
2027
  type: "module",
2028
2028
  description: "Deterministic lint gates and verified fixers for Mermaid diagrams in markdown",
2029
2029
  license: "MIT",
@@ -2828,7 +2828,7 @@ var setUp = async ({
2828
2828
  // src/cli.ts
2829
2829
  var SYNOPSIS = `usage: mermaidjs-lint <path...> [--fix] [--json] [--preset NAME] [--profile NAME] [--config FILE]
2830
2830
  [--canvas-light COLOUR] [--canvas-dark COLOUR] [--no-plugins | --lenient-plugins]
2831
- mermaidjs-lint --list-rules
2831
+ mermaidjs-lint --list-rules [--config FILE] [--no-plugins | --lenient-plugins]
2832
2832
  mermaidjs-lint --validate-plugins [--json] [--config FILE]
2833
2833
  mermaidjs-lint --version | -h, --help`;
2834
2834
  var ruleRow = (r, width) => `${`${r.id}${r.fix ? "*" : ""}`.padEnd(width)} ${r.summary}`;
@@ -2869,7 +2869,7 @@ Plugins load on their own from .mermaidjs-lint/rules, from dependencies named me
2869
2869
  --lenient-plugins skips a plugin that fails to load and says so, instead of stopping the run.
2870
2870
  --validate-plugins imports and checks every plugin, reports every failure, and runs no check or fix.
2871
2871
  --list-rules prints every active rule by category, including plugin rules, and where each plugin came from.
2872
- It imports the plugins to list them.
2872
+ It imports the plugins to list them, and takes no path or other flag.
2873
2873
  --version prints the version, to quote in a bug report.
2874
2874
  Exits 0 when no findings remain, 1 when findings remain, a plugin fails to load or the run fails (a lenient run
2875
2875
  skips a broken plugin, so it alone does not exit 1), and 2 on a usage error.`;
@@ -3004,6 +3004,15 @@ var run = async (argv, cwd) => {
3004
3004
  if (validating && (values["no-plugins"] || values.fix || listing)) {
3005
3005
  throw new FlagError("--validate-plugins", "--validate-plugins takes no --no-plugins, --fix or --list-rules");
3006
3006
  }
3007
+ if (listing && !validating) {
3008
+ const ignored = [
3009
+ ...["fix", "json", "preset", "profile", "canvas-light", "canvas-dark"].filter((name) => values[name] !== undefined && values[name] !== false).map((name) => `--${name}`),
3010
+ ...positionals.length > 0 ? ["a path"] : []
3011
+ ];
3012
+ if (ignored.length > 0) {
3013
+ throw new FlagError("--list-rules", `--list-rules takes only --config and --no-plugins or --lenient-plugins, not ${ignored.join(", ")}`);
3014
+ }
3015
+ }
3007
3016
  if (validating && positionals.length > 0) {
3008
3017
  throw new FlagError("files", "--validate-plugins runs no check, so it takes no files");
3009
3018
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jpeakai/mermaidjs-lint",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "type": "module",
5
5
  "description": "Deterministic lint gates and verified fixers for Mermaid diagrams in markdown",
6
6
  "license": "MIT",
package/src/cli.ts CHANGED
@@ -22,7 +22,7 @@ import { CATEGORIES, type Finding, type Rule } from "./rules/types.ts";
22
22
  // buried, and first in --help.
23
23
  const SYNOPSIS = `usage: mermaidjs-lint <path...> [--fix] [--json] [--preset NAME] [--profile NAME] [--config FILE]
24
24
  [--canvas-light COLOUR] [--canvas-dark COLOUR] [--no-plugins | --lenient-plugins]
25
- mermaidjs-lint --list-rules
25
+ mermaidjs-lint --list-rules [--config FILE] [--no-plugins | --lenient-plugins]
26
26
  mermaidjs-lint --validate-plugins [--json] [--config FILE]
27
27
  mermaidjs-lint --version | -h, --help`;
28
28
 
@@ -68,7 +68,7 @@ Plugins load on their own from .mermaidjs-lint/rules, from dependencies named me
68
68
  --lenient-plugins skips a plugin that fails to load and says so, instead of stopping the run.
69
69
  --validate-plugins imports and checks every plugin, reports every failure, and runs no check or fix.
70
70
  --list-rules prints every active rule by category, including plugin rules, and where each plugin came from.
71
- It imports the plugins to list them.
71
+ It imports the plugins to list them, and takes no path or other flag.
72
72
  --version prints the version, to quote in a bug report.
73
73
  Exits 0 when no findings remain, 1 when findings remain, a plugin fails to load or the run fails (a lenient run
74
74
  skips a broken plugin, so it alone does not exit 1), and 2 on a usage error.`;
@@ -246,6 +246,22 @@ const run = async (argv: string[], cwd: string): Promise<number> => {
246
246
  if (validating && (values["no-plugins"] || values.fix || listing)) {
247
247
  throw new FlagError("--validate-plugins", "--validate-plugins takes no --no-plugins, --fix or --list-rules");
248
248
  }
249
+ // --list-rules prints the rules the config and the plugin flags leave
250
+ // active. Any other flag or a path would be silently ignored, so it is refused.
251
+ if (listing && !validating) {
252
+ const ignored = [
253
+ ...(["fix", "json", "preset", "profile", "canvas-light", "canvas-dark"] as const)
254
+ .filter((name) => values[name] !== undefined && values[name] !== false)
255
+ .map((name) => `--${name}`),
256
+ ...(positionals.length > 0 ? ["a path"] : []),
257
+ ];
258
+ if (ignored.length > 0) {
259
+ throw new FlagError(
260
+ "--list-rules",
261
+ `--list-rules takes only --config and --no-plugins or --lenient-plugins, not ${ignored.join(", ")}`,
262
+ );
263
+ }
264
+ }
249
265
  if (validating && positionals.length > 0) {
250
266
  throw new FlagError("files", "--validate-plugins runs no check, so it takes no files");
251
267
  }