@matrixai/lint 0.2.12 → 0.4.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.
Files changed (44) hide show
  1. package/AGENTS.md +23 -0
  2. package/README.md +151 -83
  3. package/dist/bin/lint.js +119 -136
  4. package/dist/bin/lint.js.map +1 -1
  5. package/dist/config.d.ts +15 -0
  6. package/dist/config.js +120 -0
  7. package/dist/config.js.map +1 -0
  8. package/dist/configs/{js.js → eslint.js} +5 -4
  9. package/dist/configs/eslint.js.map +1 -0
  10. package/dist/configs/{prettier.config.mjs → prettier.config.js} +1 -1
  11. package/dist/configs/prettier.config.js.map +1 -0
  12. package/dist/domains/engine.d.ts +72 -0
  13. package/dist/domains/engine.js +160 -0
  14. package/dist/domains/engine.js.map +1 -0
  15. package/dist/domains/eslint.d.ts +3 -0
  16. package/dist/domains/eslint.js +72 -0
  17. package/dist/domains/eslint.js.map +1 -0
  18. package/dist/domains/files.d.ts +4 -0
  19. package/dist/domains/files.js +95 -0
  20. package/dist/domains/files.js.map +1 -0
  21. package/dist/domains/index.d.ts +14 -0
  22. package/dist/domains/index.js +83 -0
  23. package/dist/domains/index.js.map +1 -0
  24. package/dist/domains/markdown.d.ts +5 -0
  25. package/dist/domains/markdown.js +103 -0
  26. package/dist/domains/markdown.js.map +1 -0
  27. package/dist/domains/shell.d.ts +5 -0
  28. package/dist/domains/shell.js +58 -0
  29. package/dist/domains/shell.js.map +1 -0
  30. package/dist/index.d.ts +2 -0
  31. package/dist/index.js +2 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/tsbuildinfo +1 -0
  34. package/dist/types.d.ts +31 -8
  35. package/dist/utils.d.ts +13 -18
  36. package/dist/utils.js +207 -94
  37. package/dist/utils.js.map +1 -1
  38. package/package.json +23 -13
  39. package/dist/configs/js.js.map +0 -1
  40. package/dist/configs/prettier.config.mjs.map +0 -1
  41. package/flake.lock +0 -78
  42. package/jest.config.mjs +0 -84
  43. /package/dist/configs/{js.d.ts → eslint.d.ts} +0 -0
  44. /package/dist/configs/{prettier.config.d.mts → prettier.config.d.ts} +0 -0
package/AGENTS.md ADDED
@@ -0,0 +1,23 @@
1
+ # AGENTS
2
+ - Read the repo profile selector at [`.matrixai/repo-profile.yml`](.matrixai/repo-profile.yml).
3
+ - Enforce the universal hotset [`.matrixai/matrixai-standards/standards/HOTSET.md`](.matrixai/matrixai-standards/standards/HOTSET.md).
4
+ - Enforce the profile doc under [`.matrixai/matrixai-standards/standards/profiles/`](.matrixai/matrixai-standards/standards/profiles) matching `profile:` in `.matrixai/repo-profile.yml` (e.g., `library-js`, `application-js`, `worker-js-cloudflare`, `docusaurus-js-cloudflare`).
5
+ - Profile index (for discovery): [`.matrixai/matrixai-standards/standards/profiles/README.md`](.matrixai/matrixai-standards/standards/profiles/README.md)
6
+ - Tooling contract reference: [`.matrixai/matrixai-standards/standards/coding/tooling/tooling-contract.md`](.matrixai/matrixai-standards/standards/coding/tooling/tooling-contract.md) (commands, artifacts, expectations per profile).
7
+ - Prefer ASCII punctuation/symbols when an equivalent exists (see [`.matrixai/matrixai-standards/standards/HOTSET.md`](.matrixai/matrixai-standards/standards/HOTSET.md) [MXS-GEN-006]).
8
+ - Ensure edits comply with [`.editorconfig`](.editorconfig) (LF line endings, 2-space indent, final newline, trim trailing whitespace).
9
+ - Line-reference policy (applies to all agent-generated repository content: Markdown, docs, templates, and code comments):
10
+ - Never emit `path:line` (e.g. `foo.ts:1`, `README.md:126`) into repository files.
11
+ - Do NOT put `:number` inside Markdown link destinations: `[x](path:123)` is banned.
12
+ - If a line reference is needed, use either:
13
+ - `[x](path#heading-anchor)` (if possible), or
14
+ - `[x](path) (line 123)` (preferred, portable), or
15
+ - `[x](path#L123)` only when explicitly targeting a renderer that supports `#L` anchors.
16
+ - If you would have emitted `:1`, drop it entirely: use `path` with no line info.
17
+ - Apply repo-local golden commands and overrides here (use `npm run lintfix` during active development; use `npm run lint` for non-mutating CI checks):
18
+ - build: npm run build
19
+ - test: npm test
20
+ - lintfix: npm run lintfix
21
+ - lint: npm run lint
22
+ - docs: npm run docs
23
+ - bench: (not defined in this repo)
package/README.md CHANGED
@@ -21,11 +21,13 @@ npm install --save-dev @matrixai/lint
21
21
 
22
22
  ## Usage
23
23
 
24
+ ### CLI
25
+
24
26
  ```sh
25
27
  matrixai-lint
26
28
  ```
27
29
 
28
- To run with autofix:
30
+ With autofix:
29
31
 
30
32
  ```sh
31
33
  matrixai-lint --fix
@@ -33,120 +35,186 @@ matrixai-lint --fix
33
35
 
34
36
  ### CLI Options
35
37
 
36
- | Flag | Description |
37
- | ----------------- | ---------------------------------------------------------------------------- |
38
- | _(no flag)_ | Uses built-in Matrix AI ESLint config |
39
- | `--fix` | Enables auto-fixing via ESLint and Prettier |
40
- | `--user-config` | Uses detected \`eslint.config.[js,mjs,cjs,ts] from the project root if found |
41
- | `--config <path>` | Explicitly use a custom ESLint config file |
42
-
43
- ### Examples
38
+ | Flag | Description |
39
+ | ------------------------ | ---------------------------------------------------------------------------- |
40
+ | _(no flag)_ | Uses built-in Matrix AI ESLint config |
41
+ | `--fix` | Enables auto-fixing via ESLint and Prettier |
42
+ | `--user-config` | Uses detected `eslint.config.[js,mjs,cjs,ts]` from the project root if found |
43
+ | `--eslint-config <path>` | Explicitly use a custom ESLint config file |
44
+ | `--eslint <targets>` | ESLint targets (files, roots, or globs); implies ESLint domain selection |
45
+ | `--markdown <targets>` | Markdown targets (files, roots, or globs); implies markdown domain selection |
46
+ | `--shell <targets>` | Shell targets (files, roots, or globs); implies shell domain selection |
47
+ | `--domain <id...>` | Run only selected domains (`eslint`, `shell`, `markdown`) |
48
+ | `--skip-domain <id...>` | Skip selected domains (`eslint`, `shell`, `markdown`) |
49
+ | `--list-domains` | Print available domains and short descriptions, then exit 0 |
50
+ | `--explain` | Print per-domain decision details before execution |
51
+ | `-v, --verbose` | Increase log verbosity (repeat for more detail) |
52
+
53
+ Domain selection behavior:
54
+
55
+ - With no selectors and no domain-specific target flags, all built-in domains
56
+ run by default.
57
+ - Passing `--eslint` and/or `--shell` implies explicit domain selection from
58
+ those flags.
59
+ - `--eslint ...` runs ESLint only.
60
+ - `--shell ...` runs shell only.
61
+ - Passing both runs both.
62
+ - Passing `--markdown` implies markdown domain selection.
63
+ - `--markdown ...` runs markdown only.
64
+ - Combined with other target flags, only those targeted domains run.
65
+ - `shellcheck` is optional only for default auto-run shell execution.
66
+ - If shell is explicitly requested (`--shell ...` or `--domain shell`),
67
+ missing `shellcheck` is a failure.
68
+ - `--shell` accepts target paths and glob patterns.
69
+ - Directories are used as roots.
70
+ - File paths and glob patterns are reduced to search roots, then `*.sh` files
71
+ are discovered under those roots.
72
+ - `--markdown` accepts target paths and glob patterns.
73
+ - Directories are used as roots.
74
+ - File paths and glob patterns are reduced to search roots, then `*.md` /
75
+ `*.mdx` files are discovered under those roots.
76
+
77
+ #### Targeted workflows
78
+
79
+ - Only ESLint on a subset of files:
80
+
81
+ ```sh
82
+ matrixai-lint --eslint "src/**/*.{ts,tsx}" --domain eslint
83
+ ```
84
+
85
+ - Only shell scripts under specific roots:
86
+
87
+ ```sh
88
+ matrixai-lint --shell scripts packages/*/scripts
89
+ ```
90
+
91
+ - Markdown only:
92
+
93
+ ```sh
94
+ matrixai-lint --domain markdown
95
+ ```
96
+
97
+ - Markdown only under selected roots:
98
+
99
+ ```sh
100
+ matrixai-lint --markdown standards templates README.md
101
+ ```
102
+
103
+ - Mixed scoped run (ESLint + shell only):
104
+
105
+ ```sh
106
+ matrixai-lint --eslint "src/**/*.{ts,tsx}" --shell scripts
107
+ ```
108
+
109
+ #### Examples
44
110
 
45
111
  ```sh
46
112
  matrixai-lint --fix
47
113
  matrixai-lint --user-config
48
- matrixai-lint --config ./eslint.config.js --fix
114
+ matrixai-lint --eslint-config ./eslint.config.js --fix
115
+ matrixai-lint --eslint "src/**/*.{ts,tsx}" --shell scripts
116
+ matrixai-lint --markdown standards templates README.md
117
+ matrixai-lint --domain eslint markdown
118
+ matrixai-lint --skip-domain markdown
119
+ matrixai-lint --list-domains
120
+ matrixai-lint --explain --domain eslint
121
+ matrixai-lint -v -v --domain markdown
49
122
  ```
50
123
 
51
- ### TypeScript Support
124
+ ### ESLint config (ESM / NodeNext)
52
125
 
53
- The linter is TypeScript-aware and requires a `tsconfig.json` to determine which
54
- files to lint and how to parse them.
126
+ `matrixai-lint` ships an ESLint Flat Config array and types for TypeScript
127
+ projects configured as NodeNext.
55
128
 
56
- By default:
129
+ #### Default import
57
130
 
58
- - It looks for `tsconfig.json` in the project root
59
- - Files are selected based on the `include` and `exclude` fields in the tsconfig
131
+ ```js
132
+ // eslint.config.js
133
+ import { config } from '@matrixai/lint';
60
134
 
61
- ### Working with multiple tsconfigs
135
+ export default config;
136
+ ```
62
137
 
63
- If your project uses more than one `tsconfig.json` or doesn't have one at the
64
- root, you can configure the linter using a `matrixai-lint-config.json` file at
65
- the root:
138
+ #### Explicit subpath import
66
139
 
67
- ```json
68
- {
69
- "tsconfigPaths": ["./tsconfig.base.json", "./packages/core/tsconfig.json"],
70
- "forceInclude": ["scripts", "src/overrides"]
71
- }
72
- ```
140
+ ```js
141
+ // eslint.config.js
142
+ import matrixai from '@matrixai/lint/configs/eslint.js';
73
143
 
74
- | Field | Type | Description |
75
- | --------------- | ---------- | ---------------------------------------------------------------------------------------- |
76
- | `tsconfigPaths` | `string[]` | One or more paths to `tsconfig.json` files |
77
- | `forceInclude` | `string[]` | Paths to always include, even if excluded by tsconfig (must be included by at least one) |
144
+ export default matrixai;
145
+ ```
78
146
 
79
- > If a path in `forceInclude` is not included in any of the `tsconfigPaths`,
80
- > TypeScript will throw a parsing error.
147
+ ### Lint configuration file
81
148
 
82
- ### ESLint Config Override
149
+ The linter is TypeScript-aware and requires a `tsconfig.json` to determine which
150
+ files to lint and how to parse them. By default it looks for `tsconfig.json` in
151
+ the project root and uses the `include`/`exclude` entries.
83
152
 
84
- You can use your own ESLint config by one of the following methods:
153
+ If your project uses more than one `tsconfig.json` or does not have one at the
154
+ root, configure the linter using a `matrixai-lint-config.json` file at the root.
85
155
 
86
- #### 1. Inline Custom Config
156
+ This config uses a versioned schema and must explicitly declare `"version": 2`:
87
157
 
88
- ```sh
89
- matrixai-lint --config ./eslint.config.js
158
+ ```json
159
+ {
160
+ "version": 2,
161
+ "root": ".",
162
+ "domains": {
163
+ "eslint": {
164
+ "tsconfigPaths": [
165
+ "./tsconfig.base.json",
166
+ "./packages/core/tsconfig.json"
167
+ ],
168
+ "forceInclude": ["scripts", "src/overrides"]
169
+ }
170
+ }
171
+ }
90
172
  ```
91
173
 
92
- #### 2. Auto-detect with `--user-config`
174
+ | Field | Type | Description |
175
+ | ------------------------------ | ---------- | ----------------------------------------------------------------------------------------- |
176
+ | `version` | `2` | Required schema version marker |
177
+ | `root` | `string` | Optional lint root (defaults to `.`). `tsconfigPaths` are resolved relative to this root. |
178
+ | `domains.eslint.tsconfigPaths` | `string[]` | One or more paths to `tsconfig.json` files |
179
+ | `domains.eslint.forceInclude` | `string[]` | Paths to always include, even if excluded by tsconfig (must be included by at least one) |
93
180
 
94
- ```sh
95
- matrixai-lint --user-config
96
- ```
181
+ Note: If a path in `forceInclude` is not included in any of the `tsconfigPaths`,
182
+ TypeScript will throw a parsing error.
97
183
 
98
- This will look for a valid eslint.config file in the project root.
184
+ ### Public API
99
185
 
100
- Valid config filenames:
186
+ Supported imports:
101
187
 
102
- - `eslint.config.js`
103
- - `eslint.config.cjs`
104
- - `eslint.config.mjs`
105
- - `eslint.config.ts`
188
+ - `@matrixai/lint`: named export `config`; types `MatrixAILintCfg`,
189
+ `RawMatrixCfg`, `CLIOptions`.
190
+ - `@matrixai/lint/configs/eslint.js`: default export of the ESLint Flat Config
191
+ array (same shape as `config`).
192
+ - `@matrixai/lint/configs/prettier.config.js`: reusable Prettier options object.
106
193
 
107
- #### 3. Extend the base config
194
+ The exported `config` is intended as a composable base preset for downstream
195
+ `eslint.config.js` files, not as an internal-only implementation detail.
108
196
 
109
- ```ts
110
- // eslint.config.js
111
- import matrixai from '@matrixai/lint/config';
112
-
113
- export default [
114
- ...matrixai,
115
- {
116
- rules: {
117
- '@typescript-eslint/no-explicit-any': 'error',
118
- 'no-console': 'off',
119
- },
120
- },
121
- ];
122
- ```
197
+ Any package import path not listed above is internal and not a stable public
198
+ API.
123
199
 
124
- ## Development
200
+ ## Contributing
125
201
 
126
- Run `nix develop`, and once you're inside, you can use:
202
+ Golden commands:
127
203
 
128
- ```sh
129
- # install (or reinstall packages from package.json)
130
- npm install
131
- # build the dist
132
- npm run build
133
- # run the repl (this allows you to import from ./src)
134
- npm run tsx
135
- # run the tests
136
- npm run test
137
- # lint the source code
138
- npm run lint
139
- # automatically fix the source
140
- npm run lintfix
141
- ```
204
+ - `npm run build`
205
+ - `npm run lint`
206
+ - `npm run lintfix`
207
+ - `npm run docs`
142
208
 
143
- ### Docs Generation
209
+ Notes:
144
210
 
145
- ```sh
146
- npm run docs
147
- ```
211
+ - `npm run lint` and `npm run lintfix` invoke `npm run prepare` first so the
212
+ compiled CLI in `dist/bin/lint.js` stays up to date while keeping TypeScript
213
+ incremental rebuilds fast.
214
+
215
+ For the authoritative contributor guidance see [AGENTS.md](AGENTS.md).
148
216
 
149
- See the docs at: https://matrixai.github.io/js-lint/
217
+ Docs: https://matrixai.github.io/js-lint/
150
218
 
151
219
  ### Publishing
152
220
 
package/dist/bin/lint.js CHANGED
@@ -1,182 +1,165 @@
1
1
  #!/usr/bin/env node
2
- import os from 'node:os';
3
2
  import path from 'node:path';
4
3
  import process from 'node:process';
5
- import childProcess from 'node:child_process';
6
4
  import fs from 'node:fs';
7
- import { createRequire } from 'node:module';
8
5
  import url from 'node:url';
9
- import { Command } from 'commander';
6
+ import { Command, Option } from 'commander';
7
+ import Logger, { StreamHandler } from '@matrixai/logger';
8
+ import { LINT_DOMAINS, resolveDomainSelection, createBuiltInDomainRegistry, listLintDomains, evaluateLintDomains, runLintDomainDecisions, } from '../domains/index.js';
10
9
  import * as utils from '../utils.js';
11
- const platform = os.platform();
12
10
  const program = new Command();
13
- const DEFAULT_SHELLCHECK_SEARCH_ROOTS = ['./src', './scripts', './tests'];
14
11
  const dirname = path.dirname(url.fileURLToPath(import.meta.url));
15
- const builtinPrettierCfg = path.resolve(dirname, '../configs/prettier.config.mjs');
12
+ const builtinPrettierCfg = path.resolve(dirname, '../configs/prettier.config.js');
16
13
  program
17
14
  .name('matrixai-lint')
18
15
  .description('Lint source files, scripts, and markdown with configured rules.')
16
+ .addOption(new Option('-v, --verbose', 'Increase log verbosity')
17
+ .argParser((_, previous = 0) => previous + 1)
18
+ .default(0))
19
19
  .option('-f, --fix', 'Automatically fix problems')
20
+ .option('--list-domains', 'List available lint domains and exit')
21
+ .option('--explain', 'Print per-domain selection and execution decisions')
20
22
  .option('--user-config', 'Use user-provided ESLint config instead of built-in one')
21
- .option('--config <path>', 'Path to explicit ESLint config file')
22
- .option('--eslint <pat...>', 'Glob(s) to pass to ESLint')
23
- .option('--shell <pat...>', 'Glob(s) to pass to shell-check')
24
- .allowUnknownOption(true); // Optional: force rejection of unknown flags
25
- /* eslint-disable no-console */
23
+ .option('--eslint-config <path>', 'Path to explicit ESLint config file')
24
+ .option('--eslint <target...>', 'ESLint targets (files, roots, or globs)')
25
+ .option('--markdown <target...>', 'Markdown targets (files, roots, or globs)')
26
+ .option('--shell <target...>', 'Shell targets (files, roots, or globs) used to derive shellcheck search roots')
27
+ .addOption(new Option('--domain <id...>', `Run only selected domains (${LINT_DOMAINS.join(', ')})`).choices(LINT_DOMAINS))
28
+ .addOption(new Option('--skip-domain <id...>', `Skip selected domains (${LINT_DOMAINS.join(', ')})`).choices(LINT_DOMAINS));
29
+ function describeAvailability(decision) {
30
+ if (decision.detection == null) {
31
+ return 'not-evaluated';
32
+ }
33
+ const detection = decision.detection;
34
+ const status = detection.available ? 'available' : 'unavailable';
35
+ const reason = detection.unavailableReason;
36
+ return reason != null && reason.length > 0
37
+ ? `${status} (${detection.availabilityKind}; ${reason})`
38
+ : `${status} (${detection.availabilityKind})`;
39
+ }
40
+ function describeRelevance(decision) {
41
+ if (decision.detection == null) {
42
+ return decision.plannedAction === 'skip-unselected'
43
+ ? 'not-evaluated (domain not selected)'
44
+ : 'not-evaluated';
45
+ }
46
+ const detection = decision.detection;
47
+ const status = detection.relevant ? 'relevant' : 'not-relevant';
48
+ const reason = detection.relevanceReason;
49
+ return reason != null && reason.length > 0 ? `${status} (${reason})` : status;
50
+ }
51
+ function printDomainList(logger, domains) {
52
+ logger.info('Available lint domains:');
53
+ for (const domainInfo of domains) {
54
+ logger.info(`- ${domainInfo.domain}: ${domainInfo.description}`);
55
+ }
56
+ }
57
+ function printExplain(logger, decisions) {
58
+ logger.info('[matrixai-lint] Domain execution plan:');
59
+ for (const decision of decisions) {
60
+ logger.info(`[matrixai-lint] - domain: ${decision.domain}`);
61
+ logger.info(`[matrixai-lint] selection: ${decision.selectionSource}${decision.explicitlyRequested ? ' (explicit)' : ''}`);
62
+ logger.info(`[matrixai-lint] relevance: ${describeRelevance(decision)}`);
63
+ logger.info(`[matrixai-lint] availability: ${describeAvailability(decision)}`);
64
+ if (decision.detectionError != null) {
65
+ logger.error(`[matrixai-lint] detection-error: ${decision.detectionError}`);
66
+ }
67
+ logger.info(`[matrixai-lint] planned-action: ${decision.plannedAction}`);
68
+ }
69
+ }
26
70
  async function main(argv = process.argv) {
27
71
  await program.parseAsync(argv);
28
72
  const options = program.opts();
73
+ const logger = new Logger('matrixai-lint', undefined, [new StreamHandler()]);
74
+ logger.setLevel(utils.verboseToLogLevel(options.verbose));
29
75
  const fix = Boolean(options.fix);
30
76
  const useUserConfig = Boolean(options.userConfig);
31
- const explicitConfigPath = options.config;
77
+ const explicitConfigPath = options.eslintConfig;
78
+ const listDomainsOnly = Boolean(options.listDomains);
79
+ const explain = Boolean(options.explain);
32
80
  const eslintPatterns = options.eslint;
81
+ const markdownPatterns = options.markdown;
33
82
  const shellPatterns = options.shell;
83
+ const { selectedDomains, explicitlyRequestedDomains, selectionSources } = resolveDomainSelection(options);
84
+ const domainRegistry = createBuiltInDomainRegistry({
85
+ prettierConfigPath: builtinPrettierCfg,
86
+ });
87
+ if (listDomainsOnly) {
88
+ printDomainList(logger, listLintDomains({
89
+ registry: domainRegistry,
90
+ executionOrder: LINT_DOMAINS,
91
+ }));
92
+ return;
93
+ }
34
94
  let hadFailure = false;
35
95
  // Resolve which config file to use
36
96
  let chosenConfig;
97
+ let isConfigValid = true;
37
98
  if (explicitConfigPath !== undefined) {
38
99
  const absolutePath = path.resolve(explicitConfigPath);
39
100
  if (!fs.existsSync(absolutePath)) {
40
- console.error(`--config points to “${explicitConfigPath}”, but that file does not exist.`);
41
- process.exit(1); // Hard‑fail; nothing to lint against
101
+ logger.error(`--eslint-config points to "${explicitConfigPath}", but that file does not exist.`);
102
+ hadFailure = true;
103
+ isConfigValid = false;
104
+ }
105
+ else {
106
+ chosenConfig = absolutePath;
42
107
  }
43
- chosenConfig = absolutePath;
44
108
  }
45
109
  else if (useUserConfig) {
46
110
  chosenConfig = utils.findUserESLintConfig();
47
111
  if (chosenConfig === undefined) {
48
- console.error('--user-config given but no local ESLint config was found. Falling back to built-in config.');
112
+ logger.warn('--user-config given but no local ESLint config was found. Falling back to built-in config.');
49
113
  }
50
114
  }
51
- try {
52
- const hadLintingErrors = await utils.runESLint({
115
+ const decisions = await evaluateLintDomains({
116
+ registry: domainRegistry,
117
+ selectedDomains,
118
+ explicitlyRequestedDomains,
119
+ selectionSources,
120
+ executionOrder: LINT_DOMAINS,
121
+ context: {
53
122
  fix,
54
- configPath: chosenConfig,
55
- explicitGlobs: eslintPatterns,
56
- });
57
- if (hadLintingErrors) {
58
- hadFailure = true;
59
- }
123
+ logger,
124
+ chosenConfig,
125
+ isConfigValid,
126
+ eslintPatterns,
127
+ markdownPatterns,
128
+ shellPatterns,
129
+ },
130
+ });
131
+ if (explain) {
132
+ printExplain(logger, decisions);
60
133
  }
61
- catch (err) {
62
- console.error(`ESLint failed: \n${err}`);
134
+ const hadDomainFailure = await runLintDomainDecisions({
135
+ registry: domainRegistry,
136
+ decisions,
137
+ context: {
138
+ fix,
139
+ logger,
140
+ chosenConfig,
141
+ isConfigValid,
142
+ eslintPatterns,
143
+ markdownPatterns,
144
+ shellPatterns,
145
+ },
146
+ });
147
+ if (hadDomainFailure) {
63
148
  hadFailure = true;
64
149
  }
65
- const searchRoots = (shellPatterns?.length ? shellPatterns : DEFAULT_SHELLCHECK_SEARCH_ROOTS)
66
- .map((p) => path.resolve(process.cwd(), p))
67
- .filter((p) => fs.existsSync(p));
68
- // Linting shell scripts (this does not have auto-fixing)
69
- const shellCheckArgs = [
70
- ...searchRoots,
71
- '-type',
72
- 'f',
73
- '-regextype',
74
- 'posix-extended',
75
- '-regex',
76
- '.*\\.(sh)',
77
- '-exec',
78
- 'shellcheck',
79
- '{}',
80
- '+',
81
- ];
82
- if (utils.commandExists('find') && utils.commandExists('shellcheck')) {
83
- console.error('Running shellcheck:');
84
- if (searchRoots.length === 0) {
85
- console.warn('No search roots found for shellcheck. Skipping shellcheck.');
86
- }
87
- else {
88
- console.error(' ' + ['find', ...shellCheckArgs].join(' '));
89
- try {
90
- childProcess.execFileSync('find', shellCheckArgs, {
91
- stdio: ['inherit', 'inherit', 'inherit'],
92
- windowsHide: true,
93
- encoding: 'utf-8',
94
- shell: platform === 'win32' ? true : false,
95
- cwd: process.cwd(),
96
- });
97
- }
98
- catch (err) {
99
- console.error('Shellcheck failed. ' + err);
100
- hadFailure = true;
101
- }
102
- }
103
- }
104
- else {
105
- console.warn('Skipping shellcheck: find or shellcheck not found in environment.');
106
- }
107
- // Linting markdown files
108
- // Always include README if it exists
109
- const markdownFiles = [];
110
- if (fs.existsSync('README.md'))
111
- markdownFiles.push('README.md');
112
- for (const dir of ['pages', 'blog', 'docs']) {
113
- if (fs.existsSync(dir))
114
- markdownFiles.push(...utils.collectMarkdown(dir));
115
- }
116
- if (markdownFiles.length === 0) {
117
- console.warn('Skipping Prettier: no Markdown/MDX files found.');
118
- return;
119
- }
120
- const prettierArgs = [
121
- '--config',
122
- builtinPrettierCfg,
123
- '--config-precedence',
124
- 'cli-override',
125
- '--no-editorconfig',
126
- fix ? '--write' : '--check',
127
- ...markdownFiles,
128
- ];
129
- console.error('Running prettier:');
130
- const require = createRequire(import.meta.url);
131
- let prettierBin = null;
132
- try {
133
- // Resolves to @matrixai/lint/node_modules/prettier/bin/prettier.cjs
134
- prettierBin = require.resolve('prettier/bin/prettier.cjs');
135
- }
136
- catch {
137
- // Bundled copy not found
138
- }
139
- try {
140
- if (prettierBin) {
141
- console.error(` ${prettierBin} \n ${prettierArgs.join('\n' + ' ')}`);
142
- childProcess.execFileSync(process.execPath, [prettierBin, ...prettierArgs], {
143
- stdio: 'inherit',
144
- windowsHide: true,
145
- encoding: 'utf-8',
146
- cwd: process.cwd(),
147
- });
148
- }
149
- else {
150
- console.error('prettier' + prettierArgs.join('\n' + ' '));
151
- childProcess.execFileSync('prettier', prettierArgs, {
152
- stdio: 'inherit',
153
- windowsHide: true,
154
- encoding: 'utf-8',
155
- shell: platform === 'win32',
156
- cwd: process.cwd(),
157
- });
158
- }
159
- }
160
- catch (err) {
161
- if (!fix) {
162
- console.error('Prettier check failed.');
163
- hadFailure = true;
164
- }
165
- else {
166
- throw err; // Should not happen when --write
167
- }
168
- }
169
150
  if (hadFailure) {
170
- console.error('[matrixai-lint] ✖ Linting failed.');
151
+ logger.error('[matrixai-lint] ✖ Linting failed.');
171
152
  process.exit(1);
172
153
  }
173
154
  else {
174
- console.error('[matrixai-lint] ✔ Linting passed.');
155
+ logger.info('[matrixai-lint] ✔ Linting passed.');
175
156
  }
176
157
  }
177
- /* eslint-enable no-console */
178
- export default main;
179
158
  if (import.meta.url.startsWith('file:')) {
180
- void main();
159
+ const modulePath = url.fileURLToPath(import.meta.url);
160
+ if (process.argv[1] === modulePath) {
161
+ void main();
162
+ }
181
163
  }
164
+ export default main;
182
165
  //# sourceMappingURL=lint.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lint.js","sourceRoot":"","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