markuplint 2.0.0-rc.2 → 2.0.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/README.md CHANGED
@@ -1,26 +1,65 @@
1
1
  # ![markuplint](https://cdn.rawgit.com/YusukeHirao/markuplint/HEAD/media/logo-v.svg)
2
2
 
3
3
  [![npm version](https://badge.fury.io/js/markuplint.svg)](https://badge.fury.io/js/markuplint)
4
- [![Build Status](https://travis-ci.org/markuplint/markuplint.svg?branch=main)](https://travis-ci.org/markuplint/markuplint) [![Coverage Status](https://coveralls.io/repos/github/markuplint/markuplint/badge.svg?branch=main)](https://coveralls.io/github/markuplint/markuplint?branch=main)
4
+ [![Test](https://github.com/markuplint/markuplint/workflows/Test/badge.svg?branch=main)](https://github.com/markuplint/markuplint/actions?query=workflow%3ATest)
5
+ [![Coverage Status](https://coveralls.io/repos/github/markuplint/markuplint/badge.svg?branch=main)](https://coveralls.io/github/markuplint/markuplint?branch=main)
5
6
 
6
- A Linter for All Markup Languages (for legacy/modern HTML, Web Components, SVG, MathML, AMP HTML and more).
7
+ Peace of mind in your markup - A Linter for All Markup Languages.
7
8
 
8
- ## Install
9
+ ## Features
10
+
11
+ - Conformance checking that according to HTML Living Standard, WAI-ARIA, and ARIA in HTML.
12
+ - Supports SVG and CSS Values.
13
+ - Supports React, Vue, Svelte, Pug, PHP, and more.
14
+ - Possible to specify the rule to each element if you use the selector.
15
+ - Possible to create a custom rule.
16
+
17
+ ![Screenshot: Violation Report CLI output](https://raw.githubusercontent.com/markuplint/markuplint/main/packages/markuplint/media/screenshot01.png)
18
+
19
+ ## Instant using
9
20
 
10
21
  ```
11
- $ npm install -D markuplint
12
- $ yarn add -D markuplint
22
+ $ npx markuplint target.html
13
23
  ```
14
24
 
15
25
  Supported for _Node.js_ `v12.4.0` or later.
16
26
 
17
27
  ## Usage
18
28
 
19
- ### CLI
29
+ ### Initialization
30
+
31
+ Create a [configuration](https://markuplint.dev/configuration) file and install dependencies.
32
+
33
+ ```
34
+ $ npx markuplint --init
35
+ # or
36
+ $ yarn run markuplint --init
37
+ ```
38
+
39
+ Answer questions interactively.
40
+ By doing this, needed modules are installed includes `markuplint`.
41
+
42
+ Add a command to the `scripts` option on `package.json`:
20
43
 
44
+ ```json
45
+ {
46
+ "scripts": {
47
+ "html:lint": "markuplint **/*.html"
48
+ }
49
+ }
21
50
  ```
22
- $ npx markuplint verifyee.html
51
+
52
+ If you want to change the target path, you can change it for your project.
53
+
54
+ Execute the script:
55
+
23
56
  ```
57
+ $ npm run html:lint
58
+ # or
59
+ $ yarn html:lint
60
+ ```
61
+
62
+ ### Command line options
24
63
 
25
64
  ```
26
65
  $ npx markuplint --help
@@ -30,42 +69,60 @@ Usage
30
69
  $ <stdout> | markuplint
31
70
 
32
71
  Options
33
- --config-file, -c FILE_PATH Ruleset file path.
34
- --fix, Fix HTML.
35
- --format, -f FORMAT Output format. Support "JSON", "Simple" and "Standard". Default: "Standard".
36
- --no-color, Output no color.
37
- --problem-only, -p Output only problems, without passeds.
38
- --verbose Output with detailed information.
39
-
40
- --help, -h Show help.
41
- --version, -v Show version.
72
+ --config, -c FILE_PATH A configuration file path.
73
+ --fix, Fix HTML.
74
+ --format, -f FORMAT Output format. Support "JSON", "Simple" and "Standard". Default: "Standard".
75
+ --no-search-config No search a configure file automatically.
76
+ --ignore-ext Evaluate files that are received even though the type of extension.
77
+ --no-import-preset-rules No import preset rules.
78
+ --locale Locale of the message of violation. Default is an OS setting.
79
+ --no-color, Output no color.
80
+ --problem-only, -p Output only problems, without passeds.
81
+ --verbose Output with detailed information.
82
+
83
+ --init Initialize settings interactively.
84
+ --create-rule Add the scaffold of a custom rule.
85
+
86
+ --help, -h Show help.
87
+ --version, -v Show version.
42
88
 
43
89
  Examples
44
- $ markuplint verifyee.html --ruleset path/to/.markuplintrc
90
+ $ markuplint verifyee.html --config path/to/.markuplintrc
45
91
  $ cat verifyee.html | markuplint
46
92
  ```
47
93
 
48
- ![Screen shot](media/screenshot01.png)
94
+ ## Guideline
95
+
96
+ - [Getting Started](https://markuplint.dev/getting-started)
97
+ - [Rules](https://markuplint.dev/rules)
98
+ - [Configuration](https://markuplint.dev/configuration)
99
+ - [API](https://markuplint.dev/api-docs)
100
+ - [Playground](https://playground.markuplint.dev/)
101
+
102
+ ## Editor Extensions
103
+
104
+ | Editor | Installation Page | Author |
105
+ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
106
+ | <a href="https://marketplace.visualstudio.com/items?itemName=yusukehirao.vscode-markuplint"><img src="https://raw.githubusercontent.com/markuplint/markuplint/main/media/vscode.png" width="75" height="82" alt="Visual Studio Code: markuplint extension"></a> | [Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=yusukehirao.vscode-markuplint) | [@YusukeHirao](https://github.com/YusukeHirao) |
49
107
 
50
- ### API
108
+ ## License
51
109
 
52
- - [Functions](https://markuplint.dev/api-docs#Functions)
53
- - [Interface Document](https://api.markuplint.dev) (genereated by [TypeDoc](https://typedoc.org/))
110
+ [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmarkuplint%2Fmarkuplint.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fmarkuplint%2Fmarkuplint?ref=badge_large)
54
111
 
55
- ## Configuration
112
+ ## Sponsors
56
113
 
57
- - [Configuration](https://markuplint.dev/configuration)
114
+ [:heart: Sponsor](https://github.com/sponsors/markuplint)
58
115
 
59
- ## Rules
116
+ ### Personal Supporters
60
117
 
61
- - [Rules](https://markuplint.dev/rules)
62
- - Customizing your rule **🚧 WIP**
118
+ [<img width="36" src="https://avatars.githubusercontent.com/u/6581173?v=4" alt="mikimhk"/>](https://github.com/mikimhk)
119
+ [<img width="36" src="https://avatars.githubusercontent.com/u/91733847?v=4" alt="Tokitake" />](https://github.com/Tokitake)
63
120
 
64
121
  ## Thanks
65
122
 
66
123
  This linter is inspired by:
67
124
 
68
- - [HTMLHint](http://htmlhint.com/)
69
- - [ESLint](https://eslint.org/)
70
- - [stylelint](https://stylelint.io/)
71
- - [textlint](https://textlint.github.io/)
125
+ - [HTMLHint](http://htmlhint.com/)
126
+ - [ESLint](https://eslint.org/)
127
+ - [stylelint](https://stylelint.io/)
128
+ - [textlint](https://textlint.github.io/)
@@ -3,25 +3,25 @@ import type { APIOptions, MLEngineEventMap } from './types';
3
3
  import type { MLFile, Target } from '@markuplint/file-resolver';
4
4
  import { StrictEventEmitter } from 'strict-event-emitter';
5
5
  declare type MLEngineOptions = {
6
- debug?: boolean;
7
- watch?: boolean;
6
+ debug?: boolean;
7
+ watch?: boolean;
8
8
  };
9
9
  export default class MLEngine extends StrictEventEmitter<MLEngineEventMap> {
10
- #private;
11
- static toMLFile(target: Target): Promise<MLFile>;
12
- constructor(file: MLFile, options?: APIOptions & MLEngineOptions);
13
- exec(): Promise<MLResultInfo | null>;
14
- setCode(code: string): Promise<void>;
15
- close(): Promise<void>;
16
- private setup;
17
- private provide;
18
- private cretateCore;
19
- private resolveConfig;
20
- private resolveParser;
21
- private resolveRuleset;
22
- private resolveSchemas;
23
- private resolveRules;
24
- private i18n;
25
- private watch;
10
+ #private;
11
+ static toMLFile(target: Target): Promise<MLFile>;
12
+ constructor(file: MLFile, options?: APIOptions & MLEngineOptions);
13
+ exec(): Promise<MLResultInfo | null>;
14
+ setCode(code: string): Promise<void>;
15
+ close(): Promise<void>;
16
+ private setup;
17
+ private provide;
18
+ private cretateCore;
19
+ private resolveConfig;
20
+ private resolveParser;
21
+ private resolveRuleset;
22
+ private resolveSchemas;
23
+ private resolveRules;
24
+ private i18n;
25
+ private watch;
26
26
  }
27
27
  export {};
@@ -113,6 +113,10 @@ class MLEngine extends strict_event_emitter_1.StrictEventEmitter {
113
113
  fileLog('Resolved Config: %O', configSet.config);
114
114
  fileLog('Resolved Plugins: %O', configSet.plugins);
115
115
  fileLog('Resolve Errors: %O', configSet.errs);
116
+ if (!(await (0, tslib_1.__classPrivateFieldGet)(this, _MLEngine_file, "f").isFile())) {
117
+ this.emit('log', 'file-no-exists', `The file doesn't exist or it is not a file: ${(0, tslib_1.__classPrivateFieldGet)(this, _MLEngine_file, "f").path}`);
118
+ return null;
119
+ }
116
120
  // Exclude
117
121
  const excludeFiles = configSet.config.excludeFiles || [];
118
122
  for (const excludeFile of excludeFiles) {
@@ -122,9 +126,9 @@ class MLEngine extends strict_event_emitter_1.StrictEventEmitter {
122
126
  }
123
127
  }
124
128
  const { parser, parserOptions, matched } = await this.resolveParser(configSet);
125
- // Ext Matching
126
- if (((_a = (0, tslib_1.__classPrivateFieldGet)(this, _MLEngine_options, "f")) === null || _a === void 0 ? void 0 : _a.extMatch) && !matched && !(0, tslib_1.__classPrivateFieldGet)(this, _MLEngine_file, "f").path.match(/\.html?$/i)) {
127
- this.emit('log', 'extension-matching', `${(0, tslib_1.__classPrivateFieldGet)(this, _MLEngine_file, "f").path}`);
129
+ const checkingExt = !((_a = (0, tslib_1.__classPrivateFieldGet)(this, _MLEngine_options, "f")) === null || _a === void 0 ? void 0 : _a.ignoreExt);
130
+ if (checkingExt && !matched) {
131
+ this.emit('log', 'ext-unmatched', `Avoided linting because a file is unmatched by the extension: ${(0, tslib_1.__classPrivateFieldGet)(this, _MLEngine_file, "f").path}`);
128
132
  return null;
129
133
  }
130
134
  const ruleset = this.resolveRuleset(configSet);
@@ -4,40 +4,47 @@ import type { MLMarkupLanguageParser } from '@markuplint/ml-ast';
4
4
  import type { Config, Violation, ParserOptions } from '@markuplint/ml-config';
5
5
  import type { AnyMLRule, MLSchema, Ruleset } from '@markuplint/ml-core';
6
6
  export declare type APIOptions = {
7
- configFile?: string;
8
- config?: Config;
9
- defaultConfig?: Config;
10
- noSearchConfig?: boolean;
11
- locale?: string;
12
- fix?: boolean;
13
- extMatch?: boolean;
14
- rules?: AnyMLRule[];
15
- importPresetRules?: boolean;
16
- /**
17
- * @deprecated
18
- */
19
- autoLoad?: boolean;
7
+ configFile?: string;
8
+ config?: Config;
9
+ defaultConfig?: Config;
10
+ noSearchConfig?: boolean;
11
+ locale?: string;
12
+ fix?: boolean;
13
+ ignoreExt?: boolean;
14
+ rules?: AnyMLRule[];
15
+ importPresetRules?: boolean;
16
+ /**
17
+ * @deprecated
18
+ */
19
+ autoLoad?: boolean;
20
20
  };
21
21
  export declare type MLFabric = {
22
- ruleset: Ruleset;
23
- rules: AnyMLRule[];
24
- schemas: MLSchema;
25
- parser: MLMarkupLanguageParser;
26
- parserOptions: ParserOptions;
27
- locale: LocaleSet;
28
- configErrors?: Error[];
22
+ ruleset: Ruleset;
23
+ rules: AnyMLRule[];
24
+ schemas: MLSchema;
25
+ parser: MLMarkupLanguageParser;
26
+ parserOptions: ParserOptions;
27
+ locale: LocaleSet;
28
+ configErrors?: Error[];
29
29
  };
30
30
  export declare type MLEngineEventMap = {
31
- log: (phase: string, message: string) => void;
32
- config: (filePath: string, config: ConfigSet, message?: string) => void;
33
- exclude: (filePath: string, setting: string, message?: string) => void;
34
- parser: (filePath: string, parser: string, message?: string) => void;
35
- ruleset: (filePath: string, ruleset: Ruleset, message?: string) => void;
36
- schemas: (filePath: string, schemas: MLSchema, message?: string) => void;
37
- rules: (filePath: string, rules: AnyMLRule[], message?: string) => void;
38
- i18n: (filePath: string, locale: LocaleSet, message?: string) => void;
39
- code: (filePath: string, sourceCode: string, message?: string) => void;
40
- lint: (filePath: string, sourceCode: string, violations: Violation[], fixedCode: string, debug: string[] | null, message?: string) => void;
41
- 'lint-error': (filePath: string, sourceCode: string, error: Error) => void;
42
- 'config-errors': (filePath: string, errors: Error[]) => void;
31
+ log: (phase: string, message: string) => void;
32
+ config: (filePath: string, config: ConfigSet, message?: string) => void;
33
+ exclude: (filePath: string, setting: string, message?: string) => void;
34
+ parser: (filePath: string, parser: string, message?: string) => void;
35
+ ruleset: (filePath: string, ruleset: Ruleset, message?: string) => void;
36
+ schemas: (filePath: string, schemas: MLSchema, message?: string) => void;
37
+ rules: (filePath: string, rules: AnyMLRule[], message?: string) => void;
38
+ i18n: (filePath: string, locale: LocaleSet, message?: string) => void;
39
+ code: (filePath: string, sourceCode: string, message?: string) => void;
40
+ lint: (
41
+ filePath: string,
42
+ sourceCode: string,
43
+ violations: Violation[],
44
+ fixedCode: string,
45
+ debug: string[] | null,
46
+ message?: string,
47
+ ) => void;
48
+ 'lint-error': (filePath: string, sourceCode: string, error: Error) => void;
49
+ 'config-errors': (filePath: string, errors: Error[]) => void;
43
50
  };
package/lib/api/v1.d.ts CHANGED
@@ -6,55 +6,46 @@ import type { MLRule } from '@markuplint/ml-core';
6
6
  * @returns
7
7
  */
8
8
  export declare function lint_v1(options: {
9
- /**
10
- * Glob pattern
11
- */
12
- files?: string | string[];
13
- /**
14
- * Target source code of evaluation
15
- */
16
- sourceCodes?: string | string[];
17
- /**
18
- * File names when `sourceCodes`
19
- */
20
- names?: string | string[];
21
- /**
22
- * Workspace path when `sourceCodes`
23
- */
24
- workspace?: string;
25
- /**
26
- * Configure file or object
27
- */
28
- config?: string | Config;
29
- /**
30
- * The config applied when not resolved from files or set it explicitly.
31
- */
32
- defaultConfig?: Config;
33
- /**
34
- * Rules (default: `@markuplint/rules`)
35
- */
36
- rules?: MLRule<RuleConfigValue, unknown>[];
37
- /**
38
- * Auto resolve rules
39
- *
40
- * Auto importing form *node_modules* when set `@markuplint/rule-{RULE_NAME}` or `markuplint-rule-{RULE_NAME}` in config rules
41
- */
42
- rulesAutoResolve?: boolean;
43
- /**
44
- * Auto fix
45
- */
46
- fix?: boolean;
47
- /**
48
- * Locale
49
- */
50
- locale?: string;
51
- /**
52
- * Confirm the extension of the target file to the regexp of parser plugins.
53
- * It doesn't run the linting if it doesn't match.
54
- * If you don't set a parser plugin and the target file is HTML, It confirms the regexp as `/\.html?$/i`.
55
- * Default is false.
56
- *
57
- * @default false
58
- */
59
- extMatch?: boolean;
60
- }): Promise<import("..").MLResultInfo[]>;
9
+ /**
10
+ * Glob pattern
11
+ */
12
+ files?: string | string[];
13
+ /**
14
+ * Target source code of evaluation
15
+ */
16
+ sourceCodes?: string | string[];
17
+ /**
18
+ * File names when `sourceCodes`
19
+ */
20
+ names?: string | string[];
21
+ /**
22
+ * Workspace path when `sourceCodes`
23
+ */
24
+ workspace?: string;
25
+ /**
26
+ * Configure file or object
27
+ */
28
+ config?: string | Config;
29
+ /**
30
+ * The config applied when not resolved from files or set it explicitly.
31
+ */
32
+ defaultConfig?: Config;
33
+ /**
34
+ * Rules (default: `@markuplint/rules`)
35
+ */
36
+ rules?: MLRule<RuleConfigValue, unknown>[];
37
+ /**
38
+ * Auto resolve rules
39
+ *
40
+ * Auto importing form *node_modules* when set `@markuplint/rule-{RULE_NAME}` or `markuplint-rule-{RULE_NAME}` in config rules
41
+ */
42
+ rulesAutoResolve?: boolean;
43
+ /**
44
+ * Auto fix
45
+ */
46
+ fix?: boolean;
47
+ /**
48
+ * Locale
49
+ */
50
+ locale?: string;
51
+ }): Promise<import('..').MLResultInfo[]>;
package/lib/api/v1.js CHANGED
@@ -40,7 +40,6 @@ async function lint_v1(options) {
40
40
  noSearchConfig: !options.files,
41
41
  rules: options.rules,
42
42
  autoLoad: (_a = options.rulesAutoResolve) !== null && _a !== void 0 ? _a : true,
43
- extMatch: options.extMatch,
44
43
  locale: options.locale,
45
44
  });
46
45
  return result;
@@ -1,38 +1,54 @@
1
1
  import meow from 'meow';
2
- export declare const help = "\nUsage\n\t$ markuplint <HTML file pathes (glob format)>\n\t$ <stdout> | markuplint\n\nOptions\n\t--config-file, -c FILE_PATH Ruleset file path.\n\t--fix, Fix HTML.\n\t--format, -f FORMAT Output format. Support \"JSON\", \"Simple\" and \"Standard\". Default: \"Standard\".\n\t--no-color, Output no color.\n\t--problem-only, -p Output only problems, without passeds.\n\t--verbose Output with detailed information.\n\n\t--init Initialize settings interactively.\n\t--create-rule Add the scaffold of a custom rule.\n\n\t--help, -h Show help.\n\t--version, -v Show version.\n\nExamples\n\t$ markuplint verifyee.html --ruleset path/to/.markuplintrc\n\t$ cat verifyee.html | markuplint\n";
2
+ export declare const help =
3
+ '\nUsage\n\t$ markuplint <HTML file pathes (glob format)>\n\t$ <stdout> | markuplint\n\nOptions\n\t--config, -c FILE_PATH A configuration file path.\n\t--fix, Fix HTML.\n\t--format, -f FORMAT Output format. Support "JSON", "Simple" and "Standard". Default: "Standard".\n\t--no-search-config No search a configure file automatically.\n\t--ignore-ext Evaluate files that are received even though the type of extension.\n\t--no-import-preset-rules No import preset rules.\n\t--locale Locale of the message of violation. Default is an OS setting.\n\t--no-color, Output no color.\n\t--problem-only, -p Output only problems, without passeds.\n\t--verbose Output with detailed information.\n\n\t--init Initialize settings interactively.\n\t--create-rule Add the scaffold of a custom rule.\n\n\t--help, -h Show help.\n\t--version, -v Show version.\n\nExamples\n\t$ markuplint verifyee.html --config path/to/.markuplintrc\n\t$ cat verifyee.html | markuplint\n';
3
4
  export declare const cli: meow.Result<{
4
- init: {
5
- type: "boolean";
6
- default: false;
7
- };
8
- createRule: {
9
- type: "boolean";
10
- default: false;
11
- };
12
- configFile: {
13
- type: "string";
14
- alias: string;
15
- };
16
- fix: {
17
- type: "boolean";
18
- default: false;
19
- };
20
- format: {
21
- type: "string";
22
- alias: string;
23
- };
24
- color: {
25
- type: "boolean";
26
- default: true;
27
- };
28
- problemOnly: {
29
- type: "boolean";
30
- alias: string;
31
- default: false;
32
- };
33
- verbose: {
34
- type: "boolean";
35
- default: false;
36
- };
5
+ config: {
6
+ type: 'string';
7
+ alias: string;
8
+ };
9
+ fix: {
10
+ type: 'boolean';
11
+ default: false;
12
+ };
13
+ format: {
14
+ type: 'string';
15
+ alias: string;
16
+ };
17
+ searchConfig: {
18
+ type: 'boolean';
19
+ default: true;
20
+ };
21
+ ignoreExt: {
22
+ type: 'boolean';
23
+ default: false;
24
+ };
25
+ importPresetRules: {
26
+ type: 'boolean';
27
+ default: true;
28
+ };
29
+ locale: {
30
+ type: 'string';
31
+ };
32
+ color: {
33
+ type: 'boolean';
34
+ default: true;
35
+ };
36
+ problemOnly: {
37
+ type: 'boolean';
38
+ alias: string;
39
+ default: false;
40
+ };
41
+ verbose: {
42
+ type: 'boolean';
43
+ default: false;
44
+ };
45
+ init: {
46
+ type: 'boolean';
47
+ default: false;
48
+ };
49
+ createRule: {
50
+ type: 'boolean';
51
+ default: false;
52
+ };
37
53
  }>;
38
54
  export declare type CLIOptions = typeof cli.flags;
@@ -9,34 +9,30 @@ Usage
9
9
  $ <stdout> | markuplint
10
10
 
11
11
  Options
12
- --config-file, -c FILE_PATH Ruleset file path.
13
- --fix, Fix HTML.
14
- --format, -f FORMAT Output format. Support "JSON", "Simple" and "Standard". Default: "Standard".
15
- --no-color, Output no color.
16
- --problem-only, -p Output only problems, without passeds.
17
- --verbose Output with detailed information.
12
+ --config, -c FILE_PATH A configuration file path.
13
+ --fix, Fix HTML.
14
+ --format, -f FORMAT Output format. Support "JSON", "Simple" and "Standard". Default: "Standard".
15
+ --no-search-config No search a configure file automatically.
16
+ --ignore-ext Evaluate files that are received even though the type of extension.
17
+ --no-import-preset-rules No import preset rules.
18
+ --locale Locale of the message of violation. Default is an OS setting.
19
+ --no-color, Output no color.
20
+ --problem-only, -p Output only problems, without passeds.
21
+ --verbose Output with detailed information.
18
22
 
19
- --init Initialize settings interactively.
20
- --create-rule Add the scaffold of a custom rule.
23
+ --init Initialize settings interactively.
24
+ --create-rule Add the scaffold of a custom rule.
21
25
 
22
- --help, -h Show help.
23
- --version, -v Show version.
26
+ --help, -h Show help.
27
+ --version, -v Show version.
24
28
 
25
29
  Examples
26
- $ markuplint verifyee.html --ruleset path/to/.markuplintrc
30
+ $ markuplint verifyee.html --config path/to/.markuplintrc
27
31
  $ cat verifyee.html | markuplint
28
32
  `;
29
33
  exports.cli = (0, meow_1.default)(exports.help, {
30
34
  flags: {
31
- init: {
32
- type: 'boolean',
33
- default: false,
34
- },
35
- createRule: {
36
- type: 'boolean',
37
- default: false,
38
- },
39
- configFile: {
35
+ config: {
40
36
  type: 'string',
41
37
  alias: 'c',
42
38
  },
@@ -48,6 +44,21 @@ exports.cli = (0, meow_1.default)(exports.help, {
48
44
  type: 'string',
49
45
  alias: 'f',
50
46
  },
47
+ searchConfig: {
48
+ type: 'boolean',
49
+ default: true,
50
+ },
51
+ ignoreExt: {
52
+ type: 'boolean',
53
+ default: false,
54
+ },
55
+ importPresetRules: {
56
+ type: 'boolean',
57
+ default: true,
58
+ },
59
+ locale: {
60
+ type: 'string',
61
+ },
51
62
  color: {
52
63
  type: 'boolean',
53
64
  default: true,
@@ -61,5 +72,13 @@ exports.cli = (0, meow_1.default)(exports.help, {
61
72
  type: 'boolean',
62
73
  default: false,
63
74
  },
75
+ init: {
76
+ type: 'boolean',
77
+ default: false,
78
+ },
79
+ createRule: {
80
+ type: 'boolean',
81
+ default: false,
82
+ },
64
83
  },
65
84
  });
@@ -10,7 +10,12 @@ const debug_1 = require("../debug");
10
10
  const output_1 = require("./output");
11
11
  async function command(files, options) {
12
12
  const fix = options.fix;
13
- const configFile = options.configFile && path_1.default.join(process.cwd(), options.configFile);
13
+ const configFile = options.config && path_1.default.join(process.cwd(), options.config);
14
+ const locale = options.locale;
15
+ const searchConfig = options.searchConfig;
16
+ const ignoreExt = options.ignoreExt;
17
+ const importPresetRules = options.importPresetRules;
18
+ const verbose = options.verbose;
14
19
  const fileList = await (0, file_resolver_1.resolveFiles)(files);
15
20
  if (debug_1.log.enabled) {
16
21
  (0, debug_1.log)('File list: %O', fileList.map(f => f.path));
@@ -19,7 +24,15 @@ async function command(files, options) {
19
24
  }
20
25
  let hasError = false;
21
26
  for (const file of fileList) {
22
- const engine = new api_1.MLEngine(file, { configFile });
27
+ const engine = new api_1.MLEngine(file, {
28
+ configFile,
29
+ fix,
30
+ locale,
31
+ noSearchConfig: !searchConfig,
32
+ ignoreExt,
33
+ importPresetRules,
34
+ debug: verbose,
35
+ });
23
36
  const result = await engine.exec();
24
37
  if (!result) {
25
38
  continue;
@@ -4,9 +4,12 @@ exports.createRule = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const create_rule_helper_1 = require("@markuplint/create-rule-helper");
6
6
  const cli_color_1 = (0, tslib_1.__importDefault)(require("cli-color"));
7
+ const util_1 = require("../../util");
7
8
  const install_module_1 = require("../init/install-module");
8
9
  const prompt_1 = require("../prompt");
9
10
  async function createRule() {
11
+ (0, util_1.write)((0, util_1.head)('Create a rule'));
12
+ util_1.write.break();
10
13
  const purpose = await (0, prompt_1.select)({
11
14
  message: 'What purpose do you create the rule for?',
12
15
  choices: [
@@ -49,5 +52,5 @@ function output(name, icon, title, path) {
49
52
  const _marker = cli_color_1.default.xterm(39)('✔') + ' ';
50
53
  const _title = (icon, title) => `${icon} ` + cli_color_1.default.bold(`${name}/${title}`);
51
54
  const _file = (path) => ' ' + cli_color_1.default.cyanBright(path);
52
- process.stdout.write(_marker + _title(icon, title) + _file(path) + '\n');
55
+ (0, util_1.write)(_marker + _title(icon, title) + _file(path));
53
56
  }
@@ -0,0 +1 @@
1
+ export declare const head: string;