eslint-interactive 13.0.0 → 14.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.
Files changed (203) hide show
  1. package/README.md +19 -10
  2. package/dist/action/convert-error-to-warning-per-file.d.ts +4 -0
  3. package/dist/action/convert-error-to-warning-per-file.d.ts.map +1 -0
  4. package/dist/action/convert-error-to-warning-per-file.js +8 -0
  5. package/dist/action/convert-error-to-warning-per-file.js.map +1 -0
  6. package/dist/action/disable-per-file.d.ts +4 -0
  7. package/dist/action/disable-per-file.d.ts.map +1 -0
  8. package/dist/action/disable-per-file.js +12 -0
  9. package/dist/action/disable-per-file.js.map +1 -0
  10. package/dist/action/disable-per-line.d.ts +4 -0
  11. package/dist/action/disable-per-line.d.ts.map +1 -0
  12. package/dist/action/disable-per-line.js +12 -0
  13. package/dist/action/disable-per-line.js.map +1 -0
  14. package/dist/action/fix.d.ts +4 -0
  15. package/dist/action/fix.d.ts.map +1 -0
  16. package/dist/action/fix.js +6 -0
  17. package/dist/action/fix.js.map +1 -0
  18. package/dist/action/index.d.ts +6 -0
  19. package/dist/action/index.d.ts.map +1 -0
  20. package/dist/action/index.js +6 -0
  21. package/dist/action/index.js.map +1 -0
  22. package/dist/action/print-result-details.d.ts +4 -0
  23. package/dist/action/print-result-details.d.ts.map +1 -0
  24. package/dist/action/print-result-details.js +36 -0
  25. package/dist/action/print-result-details.js.map +1 -0
  26. package/dist/cli/log.d.ts +7 -0
  27. package/dist/cli/log.d.ts.map +1 -0
  28. package/dist/cli/log.js +35 -0
  29. package/dist/cli/log.js.map +1 -0
  30. package/dist/cli/package.d.ts +2 -0
  31. package/dist/cli/package.d.ts.map +1 -0
  32. package/dist/cli/package.js +6 -0
  33. package/dist/cli/package.js.map +1 -0
  34. package/dist/cli/pager.d.ts +2 -0
  35. package/dist/cli/pager.d.ts.map +1 -0
  36. package/dist/cli/pager.js +34 -0
  37. package/dist/cli/pager.js.map +1 -0
  38. package/dist/cli/parse-argv.d.ts +4 -0
  39. package/dist/cli/parse-argv.d.ts.map +1 -0
  40. package/dist/cli/parse-argv.js +103 -0
  41. package/dist/cli/parse-argv.js.map +1 -0
  42. package/dist/cli/prompt.d.ts +51 -0
  43. package/dist/cli/prompt.d.ts.map +1 -0
  44. package/dist/cli/prompt.js +97 -0
  45. package/dist/cli/prompt.js.map +1 -0
  46. package/dist/cli/run.d.ts +6 -0
  47. package/dist/cli/run.d.ts.map +1 -0
  48. package/dist/cli/run.js +28 -0
  49. package/dist/cli/run.js.map +1 -0
  50. package/dist/core.d.ts +82 -0
  51. package/dist/core.d.ts.map +1 -0
  52. package/dist/core.js +189 -0
  53. package/dist/core.js.map +1 -0
  54. package/dist/eslint/linter.d.ts +18 -0
  55. package/dist/eslint/linter.d.ts.map +1 -0
  56. package/dist/eslint/linter.js +71 -0
  57. package/dist/eslint/linter.js.map +1 -0
  58. package/dist/eslint/report-translator.d.ts +9 -0
  59. package/dist/eslint/report-translator.d.ts.map +1 -0
  60. package/dist/eslint/report-translator.js +75 -0
  61. package/dist/eslint/report-translator.js.map +1 -0
  62. package/dist/eslint/rule-fixer.d.ts +80 -0
  63. package/dist/eslint/rule-fixer.d.ts.map +1 -0
  64. package/dist/eslint/rule-fixer.js +114 -0
  65. package/dist/eslint/rule-fixer.js.map +1 -0
  66. package/dist/eslint/source-code-fixer.d.ts +15 -0
  67. package/dist/eslint/source-code-fixer.d.ts.map +1 -0
  68. package/dist/eslint/source-code-fixer.js +131 -0
  69. package/dist/eslint/source-code-fixer.js.map +1 -0
  70. package/dist/fix/apply-auto-fixes.d.ts +8 -0
  71. package/dist/fix/apply-auto-fixes.d.ts.map +1 -0
  72. package/dist/fix/apply-auto-fixes.js +8 -0
  73. package/dist/fix/apply-auto-fixes.js.map +1 -0
  74. package/dist/fix/apply-suggestions.d.ts +11 -0
  75. package/dist/fix/apply-suggestions.d.ts.map +1 -0
  76. package/dist/fix/apply-suggestions.js +25 -0
  77. package/dist/fix/apply-suggestions.js.map +1 -0
  78. package/dist/fix/convert-error-to-warning-per-file.d.ts +10 -0
  79. package/dist/fix/convert-error-to-warning-per-file.d.ts.map +1 -0
  80. package/dist/fix/convert-error-to-warning-per-file.js +28 -0
  81. package/dist/fix/convert-error-to-warning-per-file.js.map +1 -0
  82. package/dist/fix/disable-per-file.d.ts +12 -0
  83. package/dist/fix/disable-per-file.d.ts.map +1 -0
  84. package/dist/fix/disable-per-file.js +63 -0
  85. package/dist/fix/disable-per-file.js.map +1 -0
  86. package/dist/fix/disable-per-line.d.ts +12 -0
  87. package/dist/fix/disable-per-line.d.ts.map +1 -0
  88. package/dist/fix/disable-per-line.js +72 -0
  89. package/dist/fix/disable-per-line.js.map +1 -0
  90. package/dist/fix/index.d.ts +19 -0
  91. package/dist/fix/index.d.ts.map +1 -0
  92. package/dist/fix/index.js +8 -0
  93. package/dist/fix/index.js.map +1 -0
  94. package/dist/fix/make-fixable-and-fix.d.ts +11 -0
  95. package/dist/fix/make-fixable-and-fix.d.ts.map +1 -0
  96. package/dist/fix/make-fixable-and-fix.js +35 -0
  97. package/dist/fix/make-fixable-and-fix.js.map +1 -0
  98. package/dist/formatter/colors.d.ts +4 -0
  99. package/dist/formatter/colors.d.ts.map +1 -0
  100. package/dist/formatter/colors.js +5 -0
  101. package/dist/formatter/colors.js.map +1 -0
  102. package/dist/formatter/filter-rule-statistics.d.ts +9 -0
  103. package/dist/formatter/filter-rule-statistics.d.ts.map +1 -0
  104. package/dist/formatter/filter-rule-statistics.js +22 -0
  105. package/dist/formatter/filter-rule-statistics.js.map +1 -0
  106. package/dist/formatter/format-by-files.d.ts +3 -0
  107. package/dist/formatter/format-by-files.d.ts.map +1 -0
  108. package/dist/formatter/format-by-files.js +42 -0
  109. package/dist/formatter/format-by-files.js.map +1 -0
  110. package/dist/formatter/format-by-rules.d.ts +9 -0
  111. package/dist/formatter/format-by-rules.d.ts.map +1 -0
  112. package/dist/formatter/format-by-rules.js +33 -0
  113. package/dist/formatter/format-by-rules.js.map +1 -0
  114. package/dist/formatter/format-table.d.ts +4 -0
  115. package/dist/formatter/format-table.d.ts.map +1 -0
  116. package/dist/formatter/format-table.js +62 -0
  117. package/dist/formatter/format-table.js.map +1 -0
  118. package/dist/formatter/index.d.ts +7 -0
  119. package/dist/formatter/index.d.ts.map +1 -0
  120. package/dist/formatter/index.js +9 -0
  121. package/dist/formatter/index.js.map +1 -0
  122. package/dist/formatter/sort-rule-statistics.d.ts +5 -0
  123. package/dist/formatter/sort-rule-statistics.d.ts.map +1 -0
  124. package/dist/formatter/sort-rule-statistics.js +34 -0
  125. package/dist/formatter/sort-rule-statistics.js.map +1 -0
  126. package/dist/formatter/take-rule-statistics.d.ts +18 -0
  127. package/dist/formatter/take-rule-statistics.d.ts.map +1 -0
  128. package/dist/formatter/take-rule-statistics.js +51 -0
  129. package/dist/formatter/take-rule-statistics.js.map +1 -0
  130. package/dist/index.d.ts +6 -0
  131. package/dist/index.d.ts.map +1 -0
  132. package/dist/index.js +6 -0
  133. package/dist/index.js.map +1 -0
  134. package/dist/plugin.d.ts +4 -0
  135. package/dist/plugin.d.ts.map +1 -0
  136. package/dist/plugin.js +87 -0
  137. package/dist/plugin.js.map +1 -0
  138. package/dist/scene/check-results.d.ts +21 -0
  139. package/dist/scene/check-results.d.ts.map +1 -0
  140. package/dist/scene/check-results.js +19 -0
  141. package/dist/scene/check-results.js.map +1 -0
  142. package/dist/scene/index.d.ts +25 -0
  143. package/dist/scene/index.d.ts.map +1 -0
  144. package/dist/scene/index.js +6 -0
  145. package/dist/scene/index.js.map +1 -0
  146. package/dist/scene/lint.d.ts +7 -0
  147. package/dist/scene/lint.d.ts.map +1 -0
  148. package/dist/scene/lint.js +34 -0
  149. package/dist/scene/lint.js.map +1 -0
  150. package/dist/scene/select-action.d.ts +19 -0
  151. package/dist/scene/select-action.d.ts.map +1 -0
  152. package/dist/scene/select-action.js +44 -0
  153. package/dist/scene/select-action.js.map +1 -0
  154. package/dist/scene/select-rule-ids.d.ts +14 -0
  155. package/dist/scene/select-rule-ids.d.ts.map +1 -0
  156. package/dist/scene/select-rule-ids.js +10 -0
  157. package/dist/scene/select-rule-ids.js.map +1 -0
  158. package/dist/type.d.ts +14 -0
  159. package/dist/type.d.ts.map +1 -0
  160. package/dist/type.js +2 -0
  161. package/dist/type.js.map +1 -0
  162. package/dist/util/array.d.ts +3 -0
  163. package/dist/util/array.d.ts.map +1 -0
  164. package/dist/util/array.js +14 -0
  165. package/dist/util/array.js.map +1 -0
  166. package/dist/util/eslint.d.ts +103 -0
  167. package/dist/util/eslint.d.ts.map +1 -0
  168. package/dist/util/eslint.js +220 -0
  169. package/dist/util/eslint.js.map +1 -0
  170. package/dist/util/terminal-link.d.ts +2 -0
  171. package/dist/util/terminal-link.d.ts.map +1 -0
  172. package/dist/util/terminal-link.js +16 -0
  173. package/dist/util/terminal-link.js.map +1 -0
  174. package/dist/util/type-check.d.ts +3 -0
  175. package/dist/util/type-check.d.ts.map +1 -0
  176. package/dist/util/type-check.js +8 -0
  177. package/dist/util/type-check.js.map +1 -0
  178. package/package.json +22 -24
  179. package/src/action/convert-error-to-warning-per-file.ts +4 -6
  180. package/src/action/disable-per-file.ts +4 -6
  181. package/src/action/disable-per-line.ts +4 -6
  182. package/src/action/fix.ts +4 -10
  183. package/src/action/print-result-details.ts +5 -9
  184. package/src/cli/log.ts +25 -0
  185. package/src/cli/parse-argv.ts +32 -11
  186. package/src/cli/prompt.ts +56 -92
  187. package/src/cli/run.ts +3 -29
  188. package/src/core.ts +13 -6
  189. package/src/fix/disable-per-file.ts +1 -1
  190. package/src/fix/disable-per-line.ts +1 -1
  191. package/src/formatter/filter-rule-statistics.ts +27 -0
  192. package/src/formatter/format-by-rules.ts +10 -7
  193. package/src/formatter/index.ts +4 -3
  194. package/src/index.ts +1 -1
  195. package/src/scene/check-results.ts +2 -5
  196. package/src/scene/lint.ts +14 -12
  197. package/src/scene/select-action.ts +2 -4
  198. package/src/scene/select-rule-ids.ts +2 -6
  199. package/src/type.ts +2 -0
  200. package/src/util/terminal-link.ts +16 -0
  201. package/src/cli/spinner.ts +0 -22
  202. package/src/core-worker.ts +0 -55
  203. package/src/typings/enquirer.d.ts +0 -7
package/README.md CHANGED
@@ -46,7 +46,7 @@ It also supports the following actions in addition to `eslint --fix`. All action
46
46
 
47
47
  ## Requirements
48
48
 
49
- - Node.js `^20.19.0 || ^22.12.0 || >=24.0.0`
49
+ - Node.js `^22.12.0 || >=24.0.0`
50
50
  - ESLint `>=9.0.0`
51
51
  - If you use ESLint `<8.45.0`, use `eslint-interactive@^10`.
52
52
  - Flat config (`eslint.config.js`)
@@ -60,7 +60,7 @@ It also supports the following actions in addition to `eslint --fix`. All action
60
60
  ```console
61
61
  $ # For npm
62
62
  $ npm i -D eslint-interactive
63
- $ npx eslint-interactive --help
63
+ $ npx --no --offline eslint-interactive --help
64
64
 
65
65
  $ # For yarn
66
66
  $ yarn add -D eslint-interactive
@@ -81,19 +81,28 @@ $ npx eslint-interactive --help
81
81
  eslint-interactive [...patterns]
82
82
 
83
83
  Options:
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+)
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
+ --ignore-pattern <string> Patterns of files to ignore
90
+ --no-ignore Disable use of ignore files and patterns
91
+ --cache Only check changed files
92
+ --cache-location <path> Path to the cache file or directory
93
+ --flag <name> Enable a feature flag (requires ESLint v9.6.0+)
94
+ --sort <field> Sort rules by: rule, error, warning, fixable, suggestions
95
+ --sort-order <direction> Sort direction: asc, desc (default: desc for counts, asc for rule)
96
+ --filter <criterion> Show only rules matching the criterion: fixable, has-suggestions
97
+ (repeatable; multiple values are OR-ed)
92
98
 
93
99
  Examples:
94
100
  eslint-interactive Lint all files in the project
95
101
  eslint-interactive src test Lint specified directories
96
102
  eslint-interactive 'src/**/*.{ts,tsx,vue}' Lint with glob pattern
103
+ eslint-interactive --sort error Sort rules by error count (descending)
104
+ eslint-interactive --sort rule Sort rules by rule name (ascending)
105
+ eslint-interactive --filter fixable Show only rules that have fixable problems
97
106
  ```
98
107
 
99
108
  ## Programmable API
@@ -0,0 +1,4 @@
1
+ import type { ESLint } from 'eslint';
2
+ import type { Core, Undo } from '../core.js';
3
+ export declare function doConvertErrorToWarningPerFileAction(core: Core, results: ESLint.LintResult[], selectedRuleIds: string[]): Promise<Undo>;
4
+ //# sourceMappingURL=convert-error-to-warning-per-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert-error-to-warning-per-file.d.ts","sourceRoot":"","sources":["../../src/action/convert-error-to-warning-per-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGrC,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAE7C,wBAAsB,oCAAoC,CACxD,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,EAC5B,eAAe,EAAE,MAAM,EAAE,GACxB,OAAO,CAAC,IAAI,CAAC,CAMf"}
@@ -0,0 +1,8 @@
1
+ import { withProgress } from '../cli/log.js';
2
+ import { promptToInputDescription } from '../cli/prompt.js';
3
+ export async function doConvertErrorToWarningPerFileAction(core, results, selectedRuleIds) {
4
+ const description = await promptToInputDescription();
5
+ const undo = await withProgress('Fixing', async () => core.convertErrorToWarningPerFile(results, selectedRuleIds, description));
6
+ return undo;
7
+ }
8
+ //# sourceMappingURL=convert-error-to-warning-per-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert-error-to-warning-per-file.js","sourceRoot":"","sources":["../../src/action/convert-error-to-warning-per-file.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAG5D,MAAM,CAAC,KAAK,UAAU,oCAAoC,CACxD,IAAU,EACV,OAA4B,EAC5B,eAAyB;IAEzB,MAAM,WAAW,GAAG,MAAM,wBAAwB,EAAE,CAAC;IACrD,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE,CACnD,IAAI,CAAC,4BAA4B,CAAC,OAAO,EAAE,eAAe,EAAE,WAAW,CAAC,CACzE,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ESLint } from 'eslint';
2
+ import type { Core, Undo } from '../core.js';
3
+ export declare function doDisablePerFileAction(core: Core, results: ESLint.LintResult[], selectedRuleIds: string[]): Promise<Undo>;
4
+ //# sourceMappingURL=disable-per-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disable-per-file.d.ts","sourceRoot":"","sources":["../../src/action/disable-per-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIrC,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAE7C,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,EAC5B,eAAe,EAAE,MAAM,EAAE,GACxB,OAAO,CAAC,IAAI,CAAC,CAUf"}
@@ -0,0 +1,12 @@
1
+ import { withProgress } from '../cli/log.js';
2
+ import { promptToInputDescription, promptToInputDescriptionPosition } from '../cli/prompt.js';
3
+ export async function doDisablePerFileAction(core, results, selectedRuleIds) {
4
+ const description = await promptToInputDescription();
5
+ let descriptionPosition;
6
+ if (description) {
7
+ descriptionPosition = await promptToInputDescriptionPosition();
8
+ }
9
+ const undo = await withProgress('Fixing', async () => core.disablePerFile(results, selectedRuleIds, description, descriptionPosition));
10
+ return undo;
11
+ }
12
+ //# sourceMappingURL=disable-per-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disable-per-file.js","sourceRoot":"","sources":["../../src/action/disable-per-file.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,wBAAwB,EAAE,gCAAgC,EAAE,MAAM,kBAAkB,CAAC;AAG9F,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,IAAU,EACV,OAA4B,EAC5B,eAAyB;IAEzB,MAAM,WAAW,GAAG,MAAM,wBAAwB,EAAE,CAAC;IACrD,IAAI,mBAAwC,CAAC;IAC7C,IAAI,WAAW,EAAE,CAAC;QAChB,mBAAmB,GAAG,MAAM,gCAAgC,EAAE,CAAC;IACjE,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE,CACnD,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,mBAAmB,CAAC,CAChF,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ESLint } from 'eslint';
2
+ import type { Core, Undo } from '../core.js';
3
+ export declare function doDisablePerLineAction(core: Core, results: ESLint.LintResult[], selectedRuleIds: string[]): Promise<Undo>;
4
+ //# sourceMappingURL=disable-per-line.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disable-per-line.d.ts","sourceRoot":"","sources":["../../src/action/disable-per-line.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIrC,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAE7C,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,EAC5B,eAAe,EAAE,MAAM,EAAE,GACxB,OAAO,CAAC,IAAI,CAAC,CAUf"}
@@ -0,0 +1,12 @@
1
+ import { withProgress } from '../cli/log.js';
2
+ import { promptToInputDescription, promptToInputDescriptionPosition } from '../cli/prompt.js';
3
+ export async function doDisablePerLineAction(core, results, selectedRuleIds) {
4
+ const description = await promptToInputDescription();
5
+ let descriptionPosition;
6
+ if (description) {
7
+ descriptionPosition = await promptToInputDescriptionPosition();
8
+ }
9
+ const undo = await withProgress('Fixing', async () => core.disablePerLine(results, selectedRuleIds, description, descriptionPosition));
10
+ return undo;
11
+ }
12
+ //# sourceMappingURL=disable-per-line.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disable-per-line.js","sourceRoot":"","sources":["../../src/action/disable-per-line.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,wBAAwB,EAAE,gCAAgC,EAAE,MAAM,kBAAkB,CAAC;AAG9F,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,IAAU,EACV,OAA4B,EAC5B,eAAyB;IAEzB,MAAM,WAAW,GAAG,MAAM,wBAAwB,EAAE,CAAC;IACrD,IAAI,mBAAwC,CAAC;IAC7C,IAAI,WAAW,EAAE,CAAC;QAChB,mBAAmB,GAAG,MAAM,gCAAgC,EAAE,CAAC;IACjE,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE,CACnD,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,mBAAmB,CAAC,CAChF,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ESLint } from 'eslint';
2
+ import type { Core, Undo } from '../core.js';
3
+ export declare function doFixAction(core: Core, results: ESLint.LintResult[], selectedRuleIds: string[]): Promise<Undo>;
4
+ //# sourceMappingURL=fix.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fix.d.ts","sourceRoot":"","sources":["../../src/action/fix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAE7C,wBAAsB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,EAAE,eAAe,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAGpH"}
@@ -0,0 +1,6 @@
1
+ import { withProgress } from '../cli/log.js';
2
+ export async function doFixAction(core, results, selectedRuleIds) {
3
+ const undo = await withProgress('Fixing', async () => core.applyAutoFixes(results, selectedRuleIds));
4
+ return undo;
5
+ }
6
+ //# sourceMappingURL=fix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fix.js","sourceRoot":"","sources":["../../src/action/fix.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,IAAU,EAAE,OAA4B,EAAE,eAAyB;IACnG,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC;IACrG,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { doDisablePerFileAction } from './disable-per-file.js';
2
+ export { doDisablePerLineAction } from './disable-per-line.js';
3
+ export { doConvertErrorToWarningPerFileAction } from './convert-error-to-warning-per-file.js';
4
+ export { doFixAction } from './fix.js';
5
+ export { doPrintResultDetailsAction } from './print-result-details.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,6 @@
1
+ export { doDisablePerFileAction } from './disable-per-file.js';
2
+ export { doDisablePerLineAction } from './disable-per-line.js';
3
+ export { doConvertErrorToWarningPerFileAction } from './convert-error-to-warning-per-file.js';
4
+ export { doFixAction } from './fix.js';
5
+ export { doPrintResultDetailsAction } from './print-result-details.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,4 @@
1
+ import type { ESLint } from 'eslint';
2
+ import type { Core } from '../core.js';
3
+ export declare function doPrintResultDetailsAction(core: Core, results: ESLint.LintResult[], selectedRuleIds: string[]): Promise<void>;
4
+ //# sourceMappingURL=print-result-details.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"print-result-details.d.ts","sourceRoot":"","sources":["../../src/action/print-result-details.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIrC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGvC,wBAAsB,0BAA0B,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,EAAE,eAAe,EAAE,MAAM,EAAE,iBAiBnH"}
@@ -0,0 +1,36 @@
1
+ import { writeFile } from 'node:fs/promises';
2
+ import { mkdir } from 'node:fs/promises';
3
+ import { tmpdir } from 'node:os';
4
+ import { join } from 'node:path';
5
+ // eslint-disable-next-line n/no-unsupported-features/node-builtins
6
+ import { stripVTControlCharacters, styleText } from 'node:util';
7
+ import { log } from '@clack/prompts';
8
+ import { VERSION } from '../cli/package.js';
9
+ import { pager } from '../cli/pager.js';
10
+ import { promptToInputDisplayMode } from '../cli/prompt.js';
11
+ import { unreachable } from '../util/type-check.js';
12
+ export async function doPrintResultDetailsAction(core, results, selectedRuleIds) {
13
+ const displayMode = await promptToInputDisplayMode();
14
+ const formattedResultDetails = await core.formatResultDetails(results, selectedRuleIds);
15
+ if (displayMode === 'printInTerminal') {
16
+ log.message(formattedResultDetails);
17
+ }
18
+ else if (displayMode === 'printInTerminalWithPager') {
19
+ await pager(formattedResultDetails);
20
+ }
21
+ else if (displayMode === 'writeToFile') {
22
+ const tempDir = getTempDir();
23
+ const filePath = join(tempDir, 'lint-result-details.txt');
24
+ await mkdir(tempDir, { recursive: true }); // Create the directory because it might not exist
25
+ await writeFile(filePath, stripVTControlCharacters(formattedResultDetails), 'utf8');
26
+ log.message(styleText('cyan', `Wrote to ${filePath}`));
27
+ }
28
+ else {
29
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
30
+ unreachable(`Unknown display mode: ${displayMode}`);
31
+ }
32
+ }
33
+ function getTempDir() {
34
+ return join(tmpdir(), 'eslint-interactive', VERSION);
35
+ }
36
+ //# sourceMappingURL=print-result-details.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"print-result-details.js","sourceRoot":"","sources":["../../src/action/print-result-details.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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AwB,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC,CAAC;QACpF,GAAG,CAAC,OAAO,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"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Log an error message to stderr
3
+ * @param message The message to report
4
+ */
5
+ export declare function error(message: string): void;
6
+ export declare function withProgress<T>(taskName: 'Linting' | 'Fixing' | 'Undoing', cb: () => Promise<T>): Promise<T>;
7
+ //# sourceMappingURL=log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/cli/log.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,QAEpC;AAED,wBAAsB,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAYlH"}
@@ -0,0 +1,35 @@
1
+ // eslint-disable-next-line n/no-unsupported-features/node-builtins
2
+ import { styleText } from 'node:util';
3
+ import { taskLog } from '@clack/prompts';
4
+ /**
5
+ * Log an error message to stderr
6
+ * @param message The message to report
7
+ */
8
+ export function error(message) {
9
+ process.stderr.write(styleText('red', 'Error') + ': ' + message + '\n');
10
+ }
11
+ export async function withProgress(taskName, cb) {
12
+ const log = taskLog({
13
+ title: `${taskName}...`,
14
+ });
15
+ startProgress();
16
+ try {
17
+ const result = await cb();
18
+ log.success(`${taskName} completed.`);
19
+ return result;
20
+ }
21
+ finally {
22
+ endProgress();
23
+ }
24
+ }
25
+ function startProgress() {
26
+ if (!process.stdout.isTTY)
27
+ return;
28
+ process.stdout.write('\x1b]9;4;3\x07');
29
+ }
30
+ function endProgress() {
31
+ if (!process.stdout.isTTY)
32
+ return;
33
+ process.stdout.write('\x1b]9;4;0\x07');
34
+ }
35
+ //# sourceMappingURL=log.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/cli/log.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC;;;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;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAAI,QAA0C,EAAE,EAAoB;IACpG,MAAM,GAAG,GAAG,OAAO,CAAC;QAClB,KAAK,EAAE,GAAG,QAAQ,KAAK;KACxB,CAAC,CAAC;IACH,aAAa,EAAE,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC;QAC1B,GAAG,CAAC,OAAO,CAAC,GAAG,QAAQ,aAAa,CAAC,CAAC;QACtC,OAAO,MAAM,CAAC;IAChB,CAAC;YAAS,CAAC;QACT,WAAW,EAAE,CAAC;IAChB,CAAC;AACH,CAAC;AAED,SAAS,aAAa;IACpB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK;QAAE,OAAO;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;AACzC,CAAC;AAED,SAAS,WAAW;IAClB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK;QAAE,OAAO;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const VERSION: string;
2
+ //# sourceMappingURL=package.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.d.ts","sourceRoot":"","sources":["../../src/cli/package.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,OAAO,EAAE,MAA6B,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { dirname, join } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ const PACKAGE_JSON = JSON.parse(readFileSync(join(dirname(fileURLToPath(import.meta.url)), '..', '..', 'package.json'), 'utf8'));
5
+ export const VERSION = PACKAGE_JSON.version;
6
+ //# sourceMappingURL=package.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.js","sourceRoot":"","sources":["../../src/cli/package.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAC7B,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAChG,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAW,YAAY,CAAC,OAAO,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function pager(content: string): Promise<void>;
2
+ //# sourceMappingURL=pager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pager.d.ts","sourceRoot":"","sources":["../../src/cli/pager.ts"],"names":[],"mappings":"AAEA,wBAAsB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAM1D"}
@@ -0,0 +1,34 @@
1
+ import { spawn } from 'node:child_process';
2
+ export async function pager(content) {
3
+ if (process.platform === 'win32') {
4
+ return spawnPager('more', [], content);
5
+ }
6
+ else {
7
+ return spawnPager('less', ['-R'], content);
8
+ }
9
+ }
10
+ async function spawnPager(command, options, content) {
11
+ return new Promise((resolve, reject) => {
12
+ try {
13
+ const process = spawn(command, options, { shell: true, stdio: ['pipe', 'inherit', 'inherit'] });
14
+ process.stdin.write(content);
15
+ process.stdin.end();
16
+ process.addListener('exit', (code) => {
17
+ if (code !== 0) {
18
+ reject(new Error(`\`${command}\` exited with code ${code}`));
19
+ }
20
+ else {
21
+ resolve();
22
+ }
23
+ });
24
+ process.addListener('error', (err) => {
25
+ reject(new Error(`\`${command}\` throws an error: ${err.message}`));
26
+ });
27
+ }
28
+ catch (e) {
29
+ const cause = e instanceof Error ? e.message : String(e);
30
+ reject(new Error(`Failed to execute \`${command}\`: ${cause}`));
31
+ }
32
+ });
33
+ }
34
+ //# sourceMappingURL=pager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pager.js","sourceRoot":"","sources":["../../src/cli/pager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,OAAe;IACzC,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,OAAO,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC;SAAM,CAAC;QACN,OAAO,UAAU,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,OAAe,EAAE,OAAiB,EAAE,OAAe;IAC3E,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;YAChG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC7B,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;YACpB,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;gBACnC,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;oBACf,MAAM,CAAC,IAAI,KAAK,CAAC,KAAK,OAAO,uBAAuB,IAAI,EAAE,CAAC,CAAC,CAAC;gBAC/D,CAAC;qBAAM,CAAC;oBACN,OAAO,EAAE,CAAC;gBACZ,CAAC;YACH,CAAC,CAAC,CAAC;YACH,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;gBACnC,MAAM,CAAC,IAAI,KAAK,CAAC,KAAK,OAAO,uBAAuB,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YACtE,CAAC,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,KAAK,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACzD,MAAM,CAAC,IAAI,KAAK,CAAC,uBAAuB,OAAO,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC;QAClE,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Config } from '../type.js';
2
+ /** Parse CLI options */
3
+ export declare function parseArgv(argv: string[]): Config;
4
+ //# sourceMappingURL=parse-argv.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-argv.d.ts","sourceRoot":"","sources":["../../src/cli/parse-argv.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAyC,MAAM,YAAY,CAAC;AAOhF,wBAAwB;AACxB,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAyGhD"}
@@ -0,0 +1,103 @@
1
+ import { parseArgs } from 'node:util';
2
+ import { VERSION } from './package.js';
3
+ const VALID_SORT_FIELDS = ['rule', 'error', 'warning', 'fixable', 'suggestions'];
4
+ const VALID_SORT_ORDERS = ['asc', 'desc'];
5
+ const VALID_FILTER_CRITERIA = ['fixable', 'has-suggestions'];
6
+ /** Parse CLI options */
7
+ export function parseArgv(argv) {
8
+ const options = {
9
+ 'config': { type: 'string', short: 'c' },
10
+ 'format': { type: 'string' },
11
+ 'quiet': { type: 'boolean' },
12
+ 'ignore-pattern': { type: 'string', multiple: true },
13
+ 'ignore': { type: 'boolean' },
14
+ 'cache': { type: 'boolean' },
15
+ 'cache-location': { type: 'string' },
16
+ 'version': { type: 'boolean' },
17
+ 'help': { type: 'boolean' },
18
+ 'flag': { type: 'string', multiple: true },
19
+ 'sort': { type: 'string' },
20
+ 'sort-order': { type: 'string' },
21
+ 'filter': { type: 'string', multiple: true },
22
+ };
23
+ const { values, positionals } = parseArgs({
24
+ allowPositionals: true,
25
+ allowNegative: true,
26
+ strict: true,
27
+ args: argv.slice(2),
28
+ options,
29
+ });
30
+ // Validate `--sort` and `--sort-order`
31
+ if (values.sort !== undefined && !VALID_SORT_FIELDS.includes(values.sort)) {
32
+ console.error(`Invalid --sort value: "${values.sort}". Must be one of: ${VALID_SORT_FIELDS.join(', ')}`);
33
+ // eslint-disable-next-line n/no-process-exit
34
+ process.exit(1);
35
+ }
36
+ if (values['sort-order'] !== undefined && !VALID_SORT_ORDERS.includes(values['sort-order'])) {
37
+ console.error(`Invalid --sort-order value: "${values['sort-order']}". Must be one of: ${VALID_SORT_ORDERS.join(', ')}`);
38
+ // eslint-disable-next-line n/no-process-exit
39
+ process.exit(1);
40
+ }
41
+ if (values.filter !== undefined) {
42
+ for (const filter of values.filter) {
43
+ if (!VALID_FILTER_CRITERIA.includes(filter)) {
44
+ console.error(`Invalid --filter value: "${filter}". Must be one of: ${VALID_FILTER_CRITERIA.join(', ')}`);
45
+ // eslint-disable-next-line n/no-process-exit
46
+ process.exit(1);
47
+ }
48
+ }
49
+ }
50
+ if (values.version) {
51
+ console.log(VERSION);
52
+ // eslint-disable-next-line n/no-process-exit
53
+ process.exit(0);
54
+ }
55
+ if (values.help) {
56
+ console.log(`
57
+ eslint-interactive [...patterns]
58
+
59
+ Options:
60
+ --help Show help
61
+ --version Show version number
62
+ -c, --config <path> Use this configuration, overriding config options if present
63
+ --format <nameOrPath> Specify the format to be used for the "Display problem messages" action
64
+ --quiet Report errors only
65
+ --ignore-pattern <string> Patterns of files to ignore
66
+ --no-ignore Disable use of ignore files and patterns
67
+ --cache Only check changed files
68
+ --cache-location <path> Path to the cache file or directory
69
+ --flag <name> Enable a feature flag (requires ESLint v9.6.0+)
70
+ --sort <field> Sort rules by: rule, error, warning, fixable, suggestions
71
+ --sort-order <direction> Sort direction: asc, desc (default: desc for counts, asc for rule)
72
+ --filter <criterion> Show only rules matching the criterion: fixable, has-suggestions
73
+ (repeatable; multiple values are OR-ed)
74
+
75
+ Examples:
76
+ eslint-interactive Lint all files in the project
77
+ eslint-interactive src test Lint specified directories
78
+ eslint-interactive 'src/**/*.{ts,tsx,vue}' Lint with glob pattern
79
+ eslint-interactive --sort error Sort rules by error count (descending)
80
+ eslint-interactive --sort rule Sort rules by rule name (ascending)
81
+ eslint-interactive --filter fixable Show only rules that have fixable problems
82
+ `.trim());
83
+ // eslint-disable-next-line n/no-process-exit
84
+ process.exit(0);
85
+ }
86
+ const patterns = positionals.map((pattern) => pattern.toString());
87
+ const formatterName = values.format;
88
+ return {
89
+ patterns,
90
+ formatterName,
91
+ quiet: values.quiet,
92
+ ignorePatterns: values['ignore-pattern'],
93
+ ignore: values.ignore,
94
+ overrideConfigFile: values.config,
95
+ cache: values.cache,
96
+ cacheLocation: values['cache-location'],
97
+ flags: values.flag,
98
+ sort: values.sort,
99
+ sortOrder: values['sort-order'],
100
+ filters: values.filter,
101
+ };
102
+ }
103
+ //# sourceMappingURL=parse-argv.js.map
@@ -0,0 +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;AAEvC,MAAM,iBAAiB,GAAyB,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;AACvG,MAAM,iBAAiB,GAAyB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAChE,MAAM,qBAAqB,GAA+B,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;AAEzF,wBAAwB;AACxB,MAAM,UAAU,SAAS,CAAC,IAAc;IACtC,MAAM,OAAO,GAAG;QACd,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE;QACxC,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC5B,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QAC5B,gBAAgB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;QACpD,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QAC7B,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QAC5B,gBAAgB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACpC,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QAC9B,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;QAC3B,MAAM,EAAE,EAAE,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M,CAAC,MAAuC;KACxD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,51 @@
1
+ import type { ESLint } from 'eslint';
2
+ /**
3
+ * The type that indicates what to do with the problems of selected rules.
4
+ */
5
+ export type Action = 'printResultDetails' | 'applyAutoFixes' | 'disablePerLine' | 'disablePerFile' | 'convertErrorToWarningPerFile' | 'relintAndReselectRules' | 'reselectRules';
6
+ /**
7
+ * The type representing how to display the lint results.
8
+ *
9
+ * `printInTerminal` means to print the lint results in the terminal.
10
+ * `printInTerminalWithPager` means to print the lint results in the terminal with a pager (e.g. `less`).
11
+ * `writeToFile` means to write the lint results to a file.
12
+ */
13
+ type DisplayMode = 'printInTerminal' | 'printInTerminalWithPager' | 'writeToFile';
14
+ /**
15
+ * The type that represents what to do next.
16
+ */
17
+ type NextStep = 'fixOtherRules' | 'exit' | 'undoTheFix';
18
+ export type DescriptionPosition = 'sameLine' | 'previousLine';
19
+ /**
20
+ * Ask the user for the rule ids to which they want to apply the action.
21
+ * @param ruleIdsInResults The rule ids that are in the lint results.
22
+ * @returns The rule ids
23
+ */
24
+ export declare function promptToInputRuleIds(ruleIdsInResults: string[]): Promise<string[]>;
25
+ /**
26
+ * Ask the user what action they want to perform.
27
+ * @returns The action name
28
+ */
29
+ export declare function promptToInputAction(results: ESLint.LintResult[], selectedRuleIds: string[], initialAction?: Action): Promise<Action>;
30
+ /**
31
+ * Ask the user how to display the lint results.
32
+ * @returns How to display
33
+ */
34
+ export declare function promptToInputDisplayMode(): Promise<DisplayMode>;
35
+ /**
36
+ * Ask the user a description to leave in directive.
37
+ * @returns The description
38
+ */
39
+ export declare function promptToInputDescription(): Promise<string | undefined>;
40
+ /**
41
+ * Ask the user a position of the description
42
+ * @returns The description position
43
+ */
44
+ export declare function promptToInputDescriptionPosition(): Promise<DescriptionPosition>;
45
+ /**
46
+ * Ask the user what to do next.
47
+ * @returns What to do next.
48
+ */
49
+ export declare function promptToInputWhatToDoNext(): Promise<NextStep>;
50
+ export {};
51
+ //# sourceMappingURL=prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/cli/prompt.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAWrC;;GAEG;AACH,MAAM,MAAM,MAAM,GACd,oBAAoB,GACpB,gBAAgB,GAChB,gBAAgB,GAChB,gBAAgB,GAChB,8BAA8B,GAC9B,wBAAwB,GACxB,eAAe,CAAC;AAEpB;;;;;;GAMG;AACH,KAAK,WAAW,GAAG,iBAAiB,GAAG,0BAA0B,GAAG,aAAa,CAAC;AAElF;;GAEG;AACH,KAAK,QAAQ,GAAG,eAAe,GAAG,MAAM,GAAG,YAAY,CAAC;AAExD,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,cAAc,CAAC;AAE9D;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,gBAAgB,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAQxF;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,EAC5B,eAAe,EAAE,MAAM,EAAE,EACzB,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,MAAM,CAAC,CA0BjB;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,WAAW,CAAC,CAWrE;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAO5E;AAED;;;GAGG;AACH,wBAAsB,gCAAgC,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAUrF;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,QAAQ,CAAC,CAWnE"}