eslint-interactive 12.0.0 â 13.0.1
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 +34 -58
- package/bin/eslint-interactive.js +8 -11
- package/dist/action/index.d.ts +0 -2
- package/dist/action/index.d.ts.map +1 -1
- package/dist/action/index.js +0 -2
- package/dist/action/index.js.map +1 -1
- package/dist/action/print-result-details.d.ts.map +1 -1
- package/dist/action/print-result-details.js +6 -1
- package/dist/action/print-result-details.js.map +1 -1
- package/dist/cli/log.d.ts +3 -3
- package/dist/cli/log.d.ts.map +1 -1
- package/dist/cli/log.js +5 -4
- package/dist/cli/log.js.map +1 -1
- package/dist/cli/parse-argv.d.ts +2 -22
- package/dist/cli/parse-argv.d.ts.map +1 -1
- package/dist/cli/parse-argv.js +37 -43
- package/dist/cli/parse-argv.js.map +1 -1
- package/dist/cli/prompt.d.ts +1 -11
- package/dist/cli/prompt.d.ts.map +1 -1
- package/dist/cli/prompt.js +3 -44
- package/dist/cli/prompt.js.map +1 -1
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +6 -20
- package/dist/cli/run.js.map +1 -1
- package/dist/core-worker.d.ts +2 -4
- package/dist/core-worker.d.ts.map +1 -1
- package/dist/core-worker.js +3 -10
- package/dist/core-worker.js.map +1 -1
- package/dist/core.d.ts +8 -5
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +61 -47
- package/dist/core.js.map +1 -1
- package/dist/eslint/linter.d.ts +2 -3
- package/dist/eslint/linter.d.ts.map +1 -1
- package/dist/eslint/linter.js.map +1 -1
- package/dist/eslint/source-code-fixer.d.ts +1 -5
- package/dist/eslint/source-code-fixer.d.ts.map +1 -1
- package/dist/fix/make-fixable-and-fix.d.ts +2 -3
- package/dist/fix/make-fixable-and-fix.d.ts.map +1 -1
- package/dist/fix/make-fixable-and-fix.js +14 -41
- package/dist/fix/make-fixable-and-fix.js.map +1 -1
- package/dist/formatter/format-by-files.d.ts.map +1 -1
- package/dist/formatter/format-by-files.js +1 -0
- package/dist/formatter/format-by-files.js.map +1 -1
- package/dist/formatter/format-by-rules.d.ts +6 -1
- package/dist/formatter/format-by-rules.d.ts.map +1 -1
- package/dist/formatter/format-by-rules.js +7 -2
- package/dist/formatter/format-by-rules.js.map +1 -1
- package/dist/formatter/index.d.ts +3 -1
- package/dist/formatter/index.d.ts.map +1 -1
- package/dist/formatter/index.js +3 -2
- package/dist/formatter/index.js.map +1 -1
- package/dist/formatter/sort-rule-statistics.d.ts +5 -0
- package/dist/formatter/sort-rule-statistics.d.ts.map +1 -0
- package/dist/formatter/sort-rule-statistics.js +34 -0
- package/dist/formatter/sort-rule-statistics.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +14 -0
- package/dist/plugin.js.map +1 -1
- package/dist/scene/lint.d.ts.map +1 -1
- package/dist/scene/lint.js +13 -14
- package/dist/scene/lint.js.map +1 -1
- package/dist/scene/select-action.d.ts.map +1 -1
- package/dist/scene/select-action.js +3 -9
- package/dist/scene/select-action.js.map +1 -1
- package/dist/type.d.ts +12 -0
- package/dist/type.d.ts.map +1 -0
- package/dist/type.js +2 -0
- package/dist/type.js.map +1 -0
- package/dist/util/eslint.d.ts.map +1 -1
- package/dist/util/eslint.js +1 -1
- package/dist/util/eslint.js.map +1 -1
- package/dist/util/type-check.d.ts +0 -3
- package/dist/util/type-check.d.ts.map +1 -1
- package/package.json +20 -20
- package/src/action/index.ts +0 -2
- package/src/action/print-result-details.ts +7 -1
- package/src/cli/log.ts +5 -4
- package/src/cli/parse-argv.ts +45 -61
- package/src/cli/prompt.ts +4 -48
- package/src/cli/run.ts +6 -22
- package/src/core-worker.ts +6 -21
- package/src/core.ts +52 -50
- package/src/eslint/linter.ts +2 -3
- package/src/fix/make-fixable-and-fix.ts +15 -47
- package/src/formatter/format-by-files.ts +1 -0
- package/src/formatter/format-by-rules.ts +18 -3
- package/src/formatter/index.ts +8 -3
- package/src/formatter/sort-rule-statistics.ts +35 -0
- package/src/index.ts +2 -2
- package/src/plugin.ts +14 -0
- package/src/scene/lint.ts +16 -18
- package/src/scene/select-action.ts +1 -8
- package/src/type.ts +13 -0
- package/src/util/eslint.ts +2 -2
- package/src/util/type-check.ts +0 -4
- package/bin/_eslint-interactive.js +0 -9
- package/dist/action/apply-suggestions.d.ts +0 -6
- package/dist/action/apply-suggestions.d.ts.map +0 -1
- package/dist/action/apply-suggestions.js +0 -27
- package/dist/action/apply-suggestions.js.map +0 -1
- package/dist/action/make-fixable-and-fix.d.ts +0 -6
- package/dist/action/make-fixable-and-fix.d.ts.map +0 -1
- package/dist/action/make-fixable-and-fix.js +0 -27
- package/dist/action/make-fixable-and-fix.js.map +0 -1
- package/dist/config.d.ts +0 -47
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -98
- package/dist/config.js.map +0 -1
- package/dist/eslint/use-at-your-own-risk.d.ts +0 -5
- package/dist/eslint/use-at-your-own-risk.d.ts.map +0 -1
- package/dist/eslint/use-at-your-own-risk.js +0 -6
- package/dist/eslint/use-at-your-own-risk.js.map +0 -1
- package/dist/util/file-system.d.ts +0 -5
- package/dist/util/file-system.d.ts.map +0 -1
- package/dist/util/file-system.js +0 -10
- package/dist/util/file-system.js.map +0 -1
- package/dist/util/filter-script.d.ts +0 -6
- package/dist/util/filter-script.d.ts.map +0 -1
- package/dist/util/filter-script.js +0 -38
- package/dist/util/filter-script.js.map +0 -1
- package/src/action/apply-suggestions.ts +0 -39
- package/src/action/make-fixable-and-fix.ts +0 -39
- package/src/config.ts +0 -142
- package/src/eslint/use-at-your-own-risk.js +0 -6
- package/src/util/file-system.ts +0 -10
- package/src/util/filter-script.ts +0 -45
- package/static/example-filter-script.js +0 -40
- package/static/example-fixable-maker-script.js +0 -38
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
## Motivation
|
|
17
17
|
|
|
18
|
-
The default ESLint output contains a lot of useful messages for developers, such as the source of the error and hints for fixing it. While this works for many use cases, it does not work well in situations where many messages are reported. For example, when introducing ESLint into a project, or when making big changes to the
|
|
18
|
+
The default ESLint output contains a lot of useful messages for developers, such as the source of the error and hints for fixing it. While this works for many use cases, it does not work well in situations where many messages are reported. For example, when introducing ESLint into a project, or when making big changes to the `eslint.config.js` of a project. In these situations, the output of ESLint can be quite large, making it difficult for developers to analyze the output. It is also difficult for the developer to fix messages mechanically, because messages of many rules are mixed up in the output.
|
|
19
19
|
|
|
20
20
|
In such the above situation, I think two things are important:
|
|
21
21
|
|
|
@@ -32,21 +32,30 @@ It also supports the following actions in addition to `eslint --fix`. All action
|
|
|
32
32
|
|
|
33
33
|
- Display details of lint results
|
|
34
34
|
- Run `eslint --fix`
|
|
35
|
-
- Disable per line (
|
|
35
|
+
- Disable per line (`// eslint-disable-next-line <rule-name>`)
|
|
36
36
|
- Disable per file (`/* eslint-disable <rule-name> */`)
|
|
37
|
+
- Add disable comments (`// eslint-disable <rule-name>`) per file.
|
|
37
38
|
- Convert error to warning per file (`/* eslint <rule-name>: 1 */`)
|
|
38
|
-
- Apply suggestions
|
|
39
|
-
-
|
|
39
|
+
- Apply suggestions (via [Programmable API](./docs/programmable-api.md) only)
|
|
40
|
+
- Select one of the applicable suggestions and apply it. ([What's _suggestions_?](#whats-suggestions))
|
|
41
|
+
- Users can write JavaScript code to programmatically select the suggestion to be applied.
|
|
42
|
+
- See [Programmable API documentation](./docs/programmable-api.md#applySuggestions) for details.
|
|
43
|
+
- Make forcibly fixable and run `eslint --fix` (via [Programmable API](./docs/programmable-api.md) only)
|
|
44
|
+
- This feature makes forcibly un-fixable problems fixable, and applies them.
|
|
45
|
+
- See [Programmable API documentation](./docs/programmable-api.md#makeFixableAndFix) for details.
|
|
40
46
|
|
|
41
47
|
## Requirements
|
|
42
48
|
|
|
43
|
-
- Node.js `^20.19.0 ||
|
|
44
|
-
- ESLint `>=
|
|
49
|
+
- Node.js `^20.19.0 || ^22.12.0 || >=24.0.0`
|
|
50
|
+
- ESLint `>=9.0.0`
|
|
45
51
|
- If you use ESLint `<8.45.0`, use `eslint-interactive@^10`.
|
|
52
|
+
- Flat config (`eslint.config.js`)
|
|
53
|
+
- If you use legacy config (`.eslintrc.*`), use `eslint-interactive@^12`.
|
|
46
54
|
|
|
47
55
|
## Installation
|
|
48
56
|
|
|
49
|
-
|
|
57
|
+
> [!WARNING]
|
|
58
|
+
> Global installation of `eslint-interactive` is **not recommended** and is only supported on a **best-effort basis**. It is recommended to install `eslint-interactive` locally. See [FAQ](#why-is-global-installation-not-recommended).
|
|
50
59
|
|
|
51
60
|
```console
|
|
52
61
|
$ # For npm
|
|
@@ -64,62 +73,29 @@ $ pnpm exec eslint-interactive --help
|
|
|
64
73
|
|
|
65
74
|
## Usage
|
|
66
75
|
|
|
67
|
-
The interface of `eslint-interactive` is partially compatible with `eslint`. So, in most cases, simply replacing `eslint` with `eslint-interactive` in the command to lint (e.g. `eslint ./src
|
|
76
|
+
The interface of `eslint-interactive` is partially compatible with `eslint`. So, in most cases, simply replacing `eslint` with `eslint-interactive` in the command to lint (e.g. `eslint --quiet ./src`) will work. However, eslint-interactive is installed locally, so you need to add `npx`.
|
|
68
77
|
|
|
69
78
|
```console
|
|
70
79
|
$ # Show help
|
|
71
80
|
$ npx eslint-interactive --help
|
|
72
|
-
eslint-interactive [
|
|
81
|
+
eslint-interactive [...patterns]
|
|
73
82
|
|
|
74
83
|
Options:
|
|
75
|
-
--help
|
|
76
|
-
--version
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
--
|
|
80
|
-
--
|
|
81
|
-
--
|
|
82
|
-
--
|
|
83
|
-
--format Specify the format to be used for the `Display problem messages` action [string] [default: "stylish"]
|
|
84
|
-
--quiet Report errors only [boolean] [default: false]
|
|
85
|
-
--cache Only check changed files [boolean] [default: false]
|
|
86
|
-
--cache-location Path to the cache file or directory [string]
|
|
87
|
-
--flag Enable a feature flag (requires ESLint v9.6.0+) [array]
|
|
88
|
-
|
|
84
|
+
--help Show help
|
|
85
|
+
--version Show version number
|
|
86
|
+
-c, --config <path> Use this configuration, overriding config options if present
|
|
87
|
+
--format <nameOrPath> Specify the format to be used for the "Display problem messages" action
|
|
88
|
+
--quiet Report errors only
|
|
89
|
+
--cache Only check changed files
|
|
90
|
+
--cache-location <path> Path to the cache file or directory
|
|
91
|
+
--flag <name> Enable a feature flag (requires ESLint v9.6.0+)
|
|
89
92
|
|
|
90
93
|
Examples:
|
|
91
|
-
eslint-interactive
|
|
92
|
-
eslint-interactive
|
|
93
|
-
eslint-interactive '
|
|
94
|
-
eslint-interactive ./src --ext .ts,.tsx,.vue Lint with custom extensions
|
|
95
|
-
eslint-interactive ./src --rulesdir ./rules Lint with custom rules
|
|
96
|
-
eslint-interactive ./src --no-eslintrc --config ./.eslintrc.ci.js Lint with custom config
|
|
94
|
+
eslint-interactive Lint all files in the project
|
|
95
|
+
eslint-interactive src test Lint specified directories
|
|
96
|
+
eslint-interactive 'src/**/*.{ts,tsx,vue}' Lint with glob pattern
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
-
## Available actions
|
|
100
|
-
|
|
101
|
-
Actions can be executed per rule.
|
|
102
|
-
|
|
103
|
-
- Display details of lint results
|
|
104
|
-
- Displays ESLint error reports.
|
|
105
|
-
- Run `eslint --fix`
|
|
106
|
-
- Apply fixable problems.
|
|
107
|
-
- Disable per line
|
|
108
|
-
- Add disable comments (`// eslint-disable-next-line <rule-name>`) per line.
|
|
109
|
-
- Disable per file
|
|
110
|
-
- Add disable comments (`// eslint-disable <rule-name>`) per file.
|
|
111
|
-
- Convert error to warning per file
|
|
112
|
-
- Add inline config comments (`/* eslint <rule-name>: 1 */`) per file.
|
|
113
|
-
- Apply suggestions (experimental, for experts)
|
|
114
|
-
- Select one of the applicable suggestions and apply it. ([What's _suggestions_?](#whats-suggestions))
|
|
115
|
-
- Users can write JavaScript code to programmatically select the suggestion to be applied.
|
|
116
|
-
- The tool will tell you how to use the feature in detail. Please follow the instructions of the tool.
|
|
117
|
-
- This feature is experimental and may change significantly.
|
|
118
|
-
- Make forcibly fixable and run `eslint --fix` (experimental, for experts)
|
|
119
|
-
- This feature make forcibly un-fixable problems fixable, and apply them.
|
|
120
|
-
- The tool will tell you how to use the feature in detail. Please follow the instructions of the tool.
|
|
121
|
-
- This feature is experimental and may change significantly.
|
|
122
|
-
|
|
123
99
|
## Programmable API
|
|
124
100
|
|
|
125
101
|
See [Programmable API documentation](./docs/programmable-api.md).
|
|
@@ -138,13 +114,13 @@ In some cases fixes aren't appropriate to be automatically applied, for example,
|
|
|
138
114
|
|
|
139
115
|
Suggestion can be one or more. The user has to manually decide if that fix should be applied or which fix should be applied because automatically applying of suggestion is inappropriate. For this reason, ESLint has stated that it will not officially provide a way to automatically apply suggestion ([ref](https://github.com/eslint/rfcs/tree/64b2511da6f2c10e1692671315459eb916aea53f/designs/2019-suggestions#:~:text=Unlike%20fixes%2C%20suggestion%20will%20not%20expose%20a%20new%20API%20function)). Instead, tools such as [`vscode-eslint`](https://github.com/microsoft/vscode-eslint) allow users to apply suggestions manually ([ref](https://github.com/microsoft/vscode-eslint/pull/814#issuecomment-587011529)).
|
|
140
116
|
|
|
141
|
-
### Why is global installation not
|
|
117
|
+
### Why is global installation not recommended?
|
|
142
118
|
|
|
143
|
-
`eslint` is installed locally in most projects. In such a case, if `eslint-interactive` is installed globally, it will be installed in a different space than `eslint`. The space separation makes some resources of `eslint-interactive` inaccessible from `eslint` and may break them (ref: [#77](https://github.com/mizdra/eslint-interactive/issues/77)).
|
|
119
|
+
`eslint` is installed locally in most projects. In such a case, if `eslint-interactive` is installed globally, it will be installed in a different space than `eslint`. The space separation makes some resources of `eslint-interactive` inaccessible from `eslint` and may break them (ref: [#77](https://github.com/mizdra/eslint-interactive/issues/77)). For this reason, local installation is recommended. Global installation is supported, but only on a best-effort basis.
|
|
144
120
|
|
|
145
121
|
### Is global installation prohibited?
|
|
146
122
|
|
|
147
|
-
No. `eslint-interactive` does not prohibit global installation. Global installation is
|
|
123
|
+
No. `eslint-interactive` does not prohibit global installation. Global installation is supported on a best-effort basis because it has the advantage of saving installation effort. However, it is not recommended and users should be aware that some issues may arise.
|
|
148
124
|
|
|
149
125
|
If the global installation does not work, you can send a patch by pull request. However, whether the patch will be accepted depends on the case.
|
|
150
126
|
|
|
@@ -160,6 +136,6 @@ Thanks, [@IanVS](https://github.com/IanVS).
|
|
|
160
136
|
|
|
161
137
|
[suppress-eslint-errors](https://github.com/amanda-mitchell/suppress-eslint-errors) is an excellent tool to add comments for disable mechanically. Just like `eslint-interactive`, it allows you to add disable comments for each rule and leave the purpose of disable as a comment. There is no functional difference between the two, but there is a difference in the API used to insert the comments.
|
|
162
138
|
|
|
163
|
-
`suppress-eslint-errors` uses [`jscodeshift`](https://github.com/facebook/jscodeshift) to insert comments. `jscodeshift` modifies the file in parallel, so `suppress-eslint-errors` has the advantage of being able to insert comments faster. However, `jscodeshift` cannot reuse the AST of ESLint, so you need to reparse the code in `jscodeshift`. This means that you have to pass `jscodeshift` the information it needs to parse your code (parser type, parser options). In fact, `suppress-eslint-errors` requires `--extensions` and `--parser` command line option. Normally, users specify the parsing options in
|
|
139
|
+
`suppress-eslint-errors` uses [`jscodeshift`](https://github.com/facebook/jscodeshift) to insert comments. `jscodeshift` modifies the file in parallel, so `suppress-eslint-errors` has the advantage of being able to insert comments faster. However, `jscodeshift` cannot reuse the AST of ESLint, so you need to reparse the code in `jscodeshift`. This means that you have to pass `jscodeshift` the information it needs to parse your code (parser type, parser options). In fact, `suppress-eslint-errors` requires `--extensions` and `--parser` command line option. Normally, users specify the parsing options in `eslint.config.js`, so passing these options may seem cumbersome. Also, due to the difference in the way ESLint and `jscodeshift` parse, it may not be possible to insert comments correctly.
|
|
164
140
|
|
|
165
|
-
On the other hand, `eslint-interactive` uses [`ESLint.outputFixes`](https://eslint.org/docs/developer-guide/nodejs-api#-eslintoutputfixesresults) to insert comments. It uses ESLint's API to do everything from parsing the code to inserting the comments, so it works as expected in many cases. Also, `eslint-interactive` will parse the code using the parsing options specified in `.
|
|
141
|
+
On the other hand, `eslint-interactive` uses [`ESLint.outputFixes`](https://eslint.org/docs/developer-guide/nodejs-api#-eslintoutputfixesresults) to insert comments. It uses ESLint's API to do everything from parsing the code to inserting the comments, so it works as expected in many cases. Also, `eslint-interactive` will parse the code using the parsing options specified in `eslint.config.js`. Therefore, comments can be inserted without any additional command line options. By the way, comment insertion is slower than `suppress-eslint-errors` because, unlike `suppress-eslint-errors`, it cannot modify files in parallel. However, this limitation may be improved when ESLint supports parallel processing in the near future.
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// @ts-check
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const scriptFile = resolve(dir, '_eslint-interactive.js');
|
|
12
|
-
|
|
13
|
-
spawnSync('node', ['--unhandled-rejections=strict', scriptFile, ...process.argv.slice(2)], { stdio: 'inherit' });
|
|
3
|
+
import { run } from '../dist/index.js';
|
|
4
|
+
|
|
5
|
+
run({
|
|
6
|
+
argv: process.argv,
|
|
7
|
+
}).catch((error) => {
|
|
8
|
+
console.error(error);
|
|
9
|
+
process.exit(1);
|
|
10
|
+
});
|
package/dist/action/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
export { doApplySuggestionsAction } from './apply-suggestions.js';
|
|
2
1
|
export { doDisablePerFileAction } from './disable-per-file.js';
|
|
3
2
|
export { doDisablePerLineAction } from './disable-per-line.js';
|
|
4
3
|
export { doConvertErrorToWarningPerFileAction } from './convert-error-to-warning-per-file.js';
|
|
5
4
|
export { doFixAction } from './fix.js';
|
|
6
|
-
export { doMakeFixableAndFixAction } from './make-fixable-and-fix.js';
|
|
7
5
|
export { doPrintResultDetailsAction } from './print-result-details.js';
|
|
8
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/action/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/action/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,oCAAoC,EAAE,MAAM,wCAAwC,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC"}
|
package/dist/action/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
export { doApplySuggestionsAction } from './apply-suggestions.js';
|
|
2
1
|
export { doDisablePerFileAction } from './disable-per-file.js';
|
|
3
2
|
export { doDisablePerLineAction } from './disable-per-line.js';
|
|
4
3
|
export { doConvertErrorToWarningPerFileAction } from './convert-error-to-warning-per-file.js';
|
|
5
4
|
export { doFixAction } from './fix.js';
|
|
6
|
-
export { doMakeFixableAndFixAction } from './make-fixable-and-fix.js';
|
|
7
5
|
export { doPrintResultDetailsAction } from './print-result-details.js';
|
|
8
6
|
//# sourceMappingURL=index.js.map
|
package/dist/action/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/action/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/action/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,oCAAoC,EAAE,MAAM,wCAAwC,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"print-result-details.d.ts","sourceRoot":"","sources":["../../src/action/print-result-details.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"print-result-details.d.ts","sourceRoot":"","sources":["../../src/action/print-result-details.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIrC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,MAAM,CAAC,gBAAgB,CAAC,EAC9B,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,EAC5B,eAAe,EAAE,MAAM,EAAE,iBAkB1B"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { writeFile } from 'node:fs/promises';
|
|
2
2
|
import { mkdir } from 'node:fs/promises';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
3
4
|
import { join } from 'node:path';
|
|
5
|
+
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
4
6
|
import { stripVTControlCharacters, styleText } from 'node:util';
|
|
7
|
+
import { VERSION } from '../cli/package.js';
|
|
5
8
|
import { pager } from '../cli/pager.js';
|
|
6
9
|
import { promptToInputDisplayMode } from '../cli/prompt.js';
|
|
7
|
-
import { getTempDir } from '../util/file-system.js';
|
|
8
10
|
import { unreachable } from '../util/type-check.js';
|
|
9
11
|
export async function doPrintResultDetailsAction(core, results, selectedRuleIds) {
|
|
10
12
|
const displayMode = await promptToInputDisplayMode();
|
|
@@ -27,4 +29,7 @@ export async function doPrintResultDetailsAction(core, results, selectedRuleIds)
|
|
|
27
29
|
unreachable(`Unknown display mode: ${displayMode}`);
|
|
28
30
|
}
|
|
29
31
|
}
|
|
32
|
+
function getTempDir() {
|
|
33
|
+
return join(tmpdir(), 'eslint-interactive', VERSION);
|
|
34
|
+
}
|
|
30
35
|
//# sourceMappingURL=print-result-details.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"print-result-details.js","sourceRoot":"","sources":["../../src/action/print-result-details.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGhE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"print-result-details.js","sourceRoot":"","sources":["../../src/action/print-result-details.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,mEAAmE;AACnE,OAAO,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGhE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,IAA8B,EAC9B,OAA4B,EAC5B,eAAyB;IAEzB,MAAM,WAAW,GAAG,MAAM,wBAAwB,EAAE,CAAC;IACrD,MAAM,sBAAsB,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IACxF,IAAI,WAAW,KAAK,iBAAiB,EAAE,CAAC;QACtC,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;IACtC,CAAC;SAAM,IAAI,WAAW,KAAK,0BAA0B,EAAE,CAAC;QACtD,MAAM,KAAK,CAAC,sBAAsB,CAAC,CAAC;IACtC,CAAC;SAAM,IAAI,WAAW,KAAK,aAAa,EAAE,CAAC;QACzC,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;QAC7B,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,yBAAyB,CAAC,CAAC;QAC1D,MAAM,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,kDAAkD;QAC7F,MAAM,SAAS,CAAC,QAAQ,EAAE,wBAAwB,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC,CAAC;QACpF,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE,YAAY,QAAQ,EAAE,CAAC,CAAC,CAAC;IACzD,CAAC;SAAM,CAAC;QACN,4EAA4E;QAC5E,WAAW,CAAC,yBAAyB,WAAW,EAAE,CAAC,CAAC;IACtD,CAAC;AACH,CAAC;AAED,SAAS,UAAU;IACjB,OAAO,IAAI,CAAC,MAAM,EAAE,EAAE,oBAAoB,EAAE,OAAO,CAAC,CAAC;AACvD,CAAC"}
|
package/dist/cli/log.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Log
|
|
3
|
-
* @param message The message to
|
|
2
|
+
* Log an error message to stderr
|
|
3
|
+
* @param message The message to report
|
|
4
4
|
*/
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function error(message: string): void;
|
|
6
6
|
//# sourceMappingURL=log.d.ts.map
|
package/dist/cli/log.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/cli/log.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/cli/log.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,QAEpC"}
|
package/dist/cli/log.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
1
2
|
import { styleText } from 'node:util';
|
|
2
3
|
/**
|
|
3
|
-
* Log
|
|
4
|
-
* @param message The message to
|
|
4
|
+
* Log an error message to stderr
|
|
5
|
+
* @param message The message to report
|
|
5
6
|
*/
|
|
6
|
-
export function
|
|
7
|
-
process.stderr.write(styleText('
|
|
7
|
+
export function error(message) {
|
|
8
|
+
process.stderr.write(styleText('red', 'Error') + ': ' + message + '\n');
|
|
8
9
|
}
|
|
9
10
|
//# sourceMappingURL=log.js.map
|
package/dist/cli/log.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/cli/log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC;;;GAGG;AACH,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/cli/log.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC;;;GAGG;AACH,MAAM,UAAU,KAAK,CAAC,OAAe;IACnC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC;AAC1E,CAAC"}
|
package/dist/cli/parse-argv.d.ts
CHANGED
|
@@ -1,24 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
patterns: string[];
|
|
3
|
-
formatterName: string | undefined;
|
|
4
|
-
quiet: boolean | undefined;
|
|
5
|
-
useEslintrc: boolean | undefined;
|
|
6
|
-
overrideConfigFile: string | undefined;
|
|
7
|
-
extensions: string[] | undefined;
|
|
8
|
-
rulePaths: string[] | undefined;
|
|
9
|
-
ignorePath: string | undefined;
|
|
10
|
-
cache: boolean | undefined;
|
|
11
|
-
cacheLocation: string | undefined;
|
|
12
|
-
resolvePluginsRelativeTo: string | undefined;
|
|
13
|
-
flags: string[] | undefined;
|
|
14
|
-
};
|
|
15
|
-
/** Default CLI Options */
|
|
16
|
-
export declare const cliOptionsDefaults: {
|
|
17
|
-
formatterName: string;
|
|
18
|
-
quiet: false;
|
|
19
|
-
useEslintrc: true;
|
|
20
|
-
cache: false;
|
|
21
|
-
};
|
|
1
|
+
import type { Config } from '../type.js';
|
|
22
2
|
/** Parse CLI options */
|
|
23
|
-
export declare function parseArgv(argv: string[]):
|
|
3
|
+
export declare function parseArgv(argv: string[]): Config;
|
|
24
4
|
//# sourceMappingURL=parse-argv.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-argv.d.ts","sourceRoot":"","sources":["../../src/cli/parse-argv.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parse-argv.d.ts","sourceRoot":"","sources":["../../src/cli/parse-argv.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAwB,MAAM,YAAY,CAAC;AAM/D,wBAAwB;AACxB,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAqFhD"}
|
package/dist/cli/parse-argv.js
CHANGED
|
@@ -1,28 +1,20 @@
|
|
|
1
1
|
import { parseArgs } from 'node:util';
|
|
2
2
|
import { VERSION } from './package.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
formatterName: 'stylish',
|
|
6
|
-
quiet: false,
|
|
7
|
-
useEslintrc: true,
|
|
8
|
-
cache: false,
|
|
9
|
-
};
|
|
3
|
+
const VALID_SORT_FIELDS = ['rule', 'error', 'warning', 'fixable', 'suggestions'];
|
|
4
|
+
const VALID_SORT_ORDERS = ['asc', 'desc'];
|
|
10
5
|
/** Parse CLI options */
|
|
11
6
|
export function parseArgv(argv) {
|
|
12
7
|
const options = {
|
|
13
|
-
'eslintrc': { type: 'boolean', default: cliOptionsDefaults.useEslintrc },
|
|
14
8
|
'config': { type: 'string', short: 'c' },
|
|
15
|
-
'
|
|
16
|
-
'
|
|
17
|
-
'
|
|
18
|
-
'ignore-path': { type: 'string' },
|
|
19
|
-
'format': { type: 'string', default: cliOptionsDefaults.formatterName },
|
|
20
|
-
'quiet': { type: 'boolean', default: cliOptionsDefaults.quiet },
|
|
21
|
-
'cache': { type: 'boolean', default: cliOptionsDefaults.cache },
|
|
9
|
+
'format': { type: 'string' },
|
|
10
|
+
'quiet': { type: 'boolean' },
|
|
11
|
+
'cache': { type: 'boolean' },
|
|
22
12
|
'cache-location': { type: 'string' },
|
|
23
13
|
'version': { type: 'boolean' },
|
|
24
14
|
'help': { type: 'boolean' },
|
|
25
15
|
'flag': { type: 'string', multiple: true },
|
|
16
|
+
'sort': { type: 'string' },
|
|
17
|
+
'sort-order': { type: 'string' },
|
|
26
18
|
};
|
|
27
19
|
const { values, positionals } = parseArgs({
|
|
28
20
|
allowPositionals: true,
|
|
@@ -31,6 +23,17 @@ export function parseArgv(argv) {
|
|
|
31
23
|
args: argv.slice(2),
|
|
32
24
|
options,
|
|
33
25
|
});
|
|
26
|
+
// Validate `--sort` and `--sort-order`
|
|
27
|
+
if (values.sort !== undefined && !VALID_SORT_FIELDS.includes(values.sort)) {
|
|
28
|
+
console.error(`Invalid --sort value: "${values.sort}". Must be one of: ${VALID_SORT_FIELDS.join(', ')}`);
|
|
29
|
+
// eslint-disable-next-line n/no-process-exit
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
if (values['sort-order'] !== undefined && !VALID_SORT_ORDERS.includes(values['sort-order'])) {
|
|
33
|
+
console.error(`Invalid --sort-order value: "${values['sort-order']}". Must be one of: ${VALID_SORT_ORDERS.join(', ')}`);
|
|
34
|
+
// eslint-disable-next-line n/no-process-exit
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
34
37
|
if (values.version) {
|
|
35
38
|
console.log(VERSION);
|
|
36
39
|
// eslint-disable-next-line n/no-process-exit
|
|
@@ -38,51 +41,42 @@ export function parseArgv(argv) {
|
|
|
38
41
|
}
|
|
39
42
|
if (values.help) {
|
|
40
43
|
console.log(`
|
|
41
|
-
eslint-interactive [
|
|
44
|
+
eslint-interactive [...patterns]
|
|
42
45
|
|
|
43
46
|
Options:
|
|
44
|
-
--help
|
|
45
|
-
--version
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
--
|
|
49
|
-
--
|
|
50
|
-
--
|
|
51
|
-
--
|
|
52
|
-
--
|
|
53
|
-
--
|
|
54
|
-
--cache Only check changed files [boolean] [default: false]
|
|
55
|
-
--cache-location Path to the cache file or directory [string]
|
|
56
|
-
--flag Enable a feature flag (requires ESLint v9.6.0+) [array]
|
|
47
|
+
--help Show help
|
|
48
|
+
--version Show version number
|
|
49
|
+
-c, --config <path> Use this configuration, overriding config options if present
|
|
50
|
+
--format <nameOrPath> Specify the format to be used for the "Display problem messages" action
|
|
51
|
+
--quiet Report errors only
|
|
52
|
+
--cache Only check changed files
|
|
53
|
+
--cache-location <path> Path to the cache file or directory
|
|
54
|
+
--flag <name> Enable a feature flag (requires ESLint v9.6.0+)
|
|
55
|
+
--sort <field> Sort rules by: rule, error, warning, fixable, suggestions
|
|
56
|
+
--sort-order <direction> Sort direction: asc, desc (default: desc for counts, asc for rule)
|
|
57
57
|
|
|
58
58
|
Examples:
|
|
59
|
-
eslint-interactive
|
|
60
|
-
eslint-interactive
|
|
61
|
-
eslint-interactive '
|
|
62
|
-
eslint-interactive
|
|
63
|
-
eslint-interactive
|
|
64
|
-
|
|
65
|
-
`);
|
|
59
|
+
eslint-interactive Lint all files in the project
|
|
60
|
+
eslint-interactive src test Lint specified directories
|
|
61
|
+
eslint-interactive 'src/**/*.{ts,tsx,vue}' Lint with glob pattern
|
|
62
|
+
eslint-interactive --sort error Sort rules by error count (descending)
|
|
63
|
+
eslint-interactive --sort rule Sort rules by rule name (ascending)
|
|
64
|
+
`.trim());
|
|
66
65
|
// eslint-disable-next-line n/no-process-exit
|
|
67
66
|
process.exit(0);
|
|
68
67
|
}
|
|
69
68
|
const patterns = positionals.map((pattern) => pattern.toString());
|
|
70
|
-
const rulePaths = values.rulesdir?.map((rulePath) => rulePath.toString());
|
|
71
|
-
const extensions = values.ext?.map((extension) => extension.toString()).flatMap((extension) => extension.split(','));
|
|
72
69
|
const formatterName = values.format;
|
|
73
70
|
return {
|
|
74
71
|
patterns,
|
|
75
72
|
formatterName,
|
|
76
73
|
quiet: values.quiet,
|
|
77
|
-
useEslintrc: values.eslintrc,
|
|
78
74
|
overrideConfigFile: values.config,
|
|
79
|
-
extensions,
|
|
80
|
-
rulePaths,
|
|
81
|
-
ignorePath: values['ignore-path'],
|
|
82
75
|
cache: values.cache,
|
|
83
76
|
cacheLocation: values['cache-location'],
|
|
84
|
-
resolvePluginsRelativeTo: values['resolve-plugins-relative-to'],
|
|
85
77
|
flags: values.flag,
|
|
78
|
+
sort: values.sort,
|
|
79
|
+
sortOrder: values['sort-order'],
|
|
86
80
|
};
|
|
87
81
|
}
|
|
88
82
|
//# sourceMappingURL=parse-argv.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-argv.js","sourceRoot":"","sources":["../../src/cli/parse-argv.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"parse-argv.js","sourceRoot":"","sources":["../../src/cli/parse-argv.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EA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AgB,CAAC;QACvC,KAAK,EAAE,MAAM,CAAC,IAAI;QAClB,IAAI,EAAE,MAAM,CAAC,IAA6B;QAC1C,SAAS,EAAE,MAAM,CAAC,YAAY,CAA0B;KACzD,CAAC;AACJ,CAAC"}
|
package/dist/cli/prompt.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { ESLint } from 'eslint';
|
|
|
2
2
|
/**
|
|
3
3
|
* The type that indicates what to do with the problems of selected rules.
|
|
4
4
|
*/
|
|
5
|
-
export type Action = 'printResultDetails' | 'applyAutoFixes' | 'disablePerLine' | 'disablePerFile' | 'convertErrorToWarningPerFile' | '
|
|
5
|
+
export type Action = 'printResultDetails' | 'applyAutoFixes' | 'disablePerLine' | 'disablePerFile' | 'convertErrorToWarningPerFile' | 'relintAndReselectRules' | 'reselectRules';
|
|
6
6
|
/**
|
|
7
7
|
* The type representing how to display the lint results.
|
|
8
8
|
*
|
|
@@ -47,15 +47,5 @@ export declare function promptToInputDescriptionPosition(): Promise<DescriptionP
|
|
|
47
47
|
* @returns What to do next.
|
|
48
48
|
*/
|
|
49
49
|
export declare function promptToInputWhatToDoNext(): Promise<NextStep>;
|
|
50
|
-
/**
|
|
51
|
-
* Ask the user if they want to reuse the filter script.
|
|
52
|
-
* @returns If it reuses, `true`, if not, `false`.
|
|
53
|
-
*/
|
|
54
|
-
export declare function promptToInputReuseFilterScript(): Promise<boolean>;
|
|
55
|
-
/**
|
|
56
|
-
* Ask the user if they want to reuse the script.
|
|
57
|
-
* @returns If it reuses, `true`, if not, `false`.
|
|
58
|
-
*/
|
|
59
|
-
export declare function promptToInputReuseScript(): Promise<boolean>;
|
|
60
50
|
export {};
|
|
61
51
|
//# sourceMappingURL=prompt.d.ts.map
|
package/dist/cli/prompt.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/cli/prompt.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EA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|
package/dist/cli/prompt.js
CHANGED
|
@@ -36,24 +36,15 @@ export async function promptToInputAction(results, selectedRuleIds, initialActio
|
|
|
36
36
|
const ruleStatistics = takeRuleStatistics(results).filter((ruleStatistic) => selectedRuleIds.includes(ruleStatistic.ruleId));
|
|
37
37
|
const foldedStatistics = ruleStatistics.reduce((a, b) => ({
|
|
38
38
|
isFixableCount: a.isFixableCount + b.isFixableCount,
|
|
39
|
-
|
|
40
|
-
}), { isFixableCount: 0, hasSuggestionsCount: 0 });
|
|
39
|
+
}), { isFixableCount: 0 });
|
|
41
40
|
const choices = [
|
|
42
41
|
{ name: 'printResultDetails', message: 'đ Display details of lint results' },
|
|
43
42
|
{ name: 'applyAutoFixes', message: 'đ§ Run `eslint --fix`', disabled: foldedStatistics.isFixableCount === 0 },
|
|
44
43
|
{ name: 'disablePerLine', message: 'đ§ Disable per line' },
|
|
45
44
|
{ name: 'disablePerFile', message: 'đ§ Disable per file' },
|
|
46
45
|
{ name: 'convertErrorToWarningPerFile', message: 'đ§ Convert error to warning per file' },
|
|
47
|
-
{
|
|
48
|
-
|
|
49
|
-
message: 'đ§ Apply suggestions (experimental, for experts)',
|
|
50
|
-
disabled: foldedStatistics.hasSuggestionsCount === 0,
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
name: 'makeFixableAndFix',
|
|
54
|
-
message: 'đ§ Make forcibly fixable and run `eslint --fix` (experimental, for experts)',
|
|
55
|
-
},
|
|
56
|
-
{ name: 'reselectRules', message: 'âŠī¸ Reselect rules' },
|
|
46
|
+
{ name: 'relintAndReselectRules', message: 'âŠī¸ Go back (with re-lint)' },
|
|
47
|
+
{ name: 'reselectRules', message: 'âŠī¸ Go back' },
|
|
57
48
|
];
|
|
58
49
|
const { action } = await prompt([
|
|
59
50
|
{
|
|
@@ -141,36 +132,4 @@ export async function promptToInputWhatToDoNext() {
|
|
|
141
132
|
]);
|
|
142
133
|
return nextStep;
|
|
143
134
|
}
|
|
144
|
-
/**
|
|
145
|
-
* Ask the user if they want to reuse the filter script.
|
|
146
|
-
* @returns If it reuses, `true`, if not, `false`.
|
|
147
|
-
*/
|
|
148
|
-
export async function promptToInputReuseFilterScript() {
|
|
149
|
-
const { reuseFilterScript } = await prompt([
|
|
150
|
-
{
|
|
151
|
-
name: 'reuseFilterScript',
|
|
152
|
-
type: 'confirm',
|
|
153
|
-
message: 'Do you want to reuse a previously edited filter script?',
|
|
154
|
-
initial: true,
|
|
155
|
-
onCancel,
|
|
156
|
-
},
|
|
157
|
-
]);
|
|
158
|
-
return reuseFilterScript;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Ask the user if they want to reuse the script.
|
|
162
|
-
* @returns If it reuses, `true`, if not, `false`.
|
|
163
|
-
*/
|
|
164
|
-
export async function promptToInputReuseScript() {
|
|
165
|
-
const { reuseScript } = await prompt([
|
|
166
|
-
{
|
|
167
|
-
name: 'reuseScript',
|
|
168
|
-
type: 'confirm',
|
|
169
|
-
message: 'Do you want to reuse a previously edited script?',
|
|
170
|
-
initial: true,
|
|
171
|
-
onCancel,
|
|
172
|
-
},
|
|
173
|
-
]);
|
|
174
|
-
return reuseScript;
|
|
175
|
-
}
|
|
176
135
|
//# sourceMappingURL=prompt.js.map
|
package/dist/cli/prompt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/cli/prompt.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC;AAE5B,iHAAiH;AACjH,mDAAmD;AACnD,6CAA6C;AAC7C,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/cli/prompt.ts"],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EAAE,SAAS,EAAE;aACrC;YACD,QAAQ;SACT;KACF,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/cli/run.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,wBAAsB,GAAG,CAAC,OAAO,EAAE,OAAO,iBAsCzC"}
|