eslint-interactive 8.1.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/LICENSE +25 -0
- package/README.md +147 -0
- package/bin/eslint-interactive.js +10 -0
- package/dist/action/apply-suggestions.d.ts +6 -0
- package/dist/action/apply-suggestions.d.ts.map +1 -0
- package/dist/action/apply-suggestions.js +28 -0
- package/dist/action/apply-suggestions.js.map +1 -0
- package/dist/action/disable-per-file.d.ts +6 -0
- package/dist/action/disable-per-file.d.ts.map +1 -0
- package/dist/action/disable-per-file.js +8 -0
- package/dist/action/disable-per-file.js.map +1 -0
- package/dist/action/disable-per-line.d.ts +6 -0
- package/dist/action/disable-per-line.d.ts.map +1 -0
- package/dist/action/disable-per-line.js +8 -0
- package/dist/action/disable-per-line.js.map +1 -0
- package/dist/action/fix.d.ts +6 -0
- package/dist/action/fix.d.ts.map +1 -0
- package/dist/action/fix.js +6 -0
- package/dist/action/fix.js.map +1 -0
- package/dist/action/index.d.ts +7 -0
- package/dist/action/index.d.ts.map +1 -0
- package/dist/action/index.js +7 -0
- package/dist/action/index.js.map +1 -0
- package/dist/action/make-fixable-and-fix.d.ts +6 -0
- package/dist/action/make-fixable-and-fix.d.ts.map +1 -0
- package/dist/action/make-fixable-and-fix.js +28 -0
- package/dist/action/make-fixable-and-fix.js.map +1 -0
- package/dist/action/print-result-details.d.ts +5 -0
- package/dist/action/print-result-details.d.ts.map +1 -0
- package/dist/action/print-result-details.js +12 -0
- package/dist/action/print-result-details.js.map +1 -0
- package/dist/cli/log.d.ts +6 -0
- package/dist/cli/log.d.ts.map +1 -0
- package/dist/cli/log.js +9 -0
- package/dist/cli/log.js.map +1 -0
- package/dist/cli/ora.d.ts +4 -0
- package/dist/cli/ora.d.ts.map +1 -0
- package/dist/cli/ora.js +23 -0
- package/dist/cli/ora.js.map +1 -0
- package/dist/cli/package.d.ts +2 -0
- package/dist/cli/package.d.ts.map +1 -0
- package/dist/cli/package.js +6 -0
- package/dist/cli/package.js.map +1 -0
- package/dist/cli/parse-argv.d.ts +4 -0
- package/dist/cli/parse-argv.d.ts.map +1 -0
- package/dist/cli/parse-argv.js +50 -0
- package/dist/cli/parse-argv.js.map +1 -0
- package/dist/cli/prompt.d.ts +53 -0
- package/dist/cli/prompt.d.ts.map +1 -0
- package/dist/cli/prompt.js +154 -0
- package/dist/cli/prompt.js.map +1 -0
- package/dist/cli/run.d.ts +8 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +46 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/core-worker.d.ts +21 -0
- package/dist/core-worker.d.ts.map +1 -0
- package/dist/core-worker.js +52 -0
- package/dist/core-worker.js.map +1 -0
- package/dist/core.d.ts +84 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +196 -0
- package/dist/core.js.map +1 -0
- package/dist/formatter/colors.d.ts +4 -0
- package/dist/formatter/colors.d.ts.map +1 -0
- package/dist/formatter/colors.js +5 -0
- package/dist/formatter/colors.js.map +1 -0
- package/dist/formatter/format-by-files.d.ts +3 -0
- package/dist/formatter/format-by-files.d.ts.map +1 -0
- package/dist/formatter/format-by-files.js +41 -0
- package/dist/formatter/format-by-files.js.map +1 -0
- package/dist/formatter/format-by-rules.d.ts +3 -0
- package/dist/formatter/format-by-rules.d.ts.map +1 -0
- package/dist/formatter/format-by-rules.js +34 -0
- package/dist/formatter/format-by-rules.js.map +1 -0
- package/dist/formatter/index.d.ts +4 -0
- package/dist/formatter/index.d.ts.map +1 -0
- package/dist/formatter/index.js +7 -0
- package/dist/formatter/index.js.map +1 -0
- package/dist/formatter/take-rule-statistics.d.ts +18 -0
- package/dist/formatter/take-rule-statistics.d.ts.map +1 -0
- package/dist/formatter/take-rule-statistics.js +51 -0
- package/dist/formatter/take-rule-statistics.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin/fix/apply-auto-fixes.d.ts +8 -0
- package/dist/plugin/fix/apply-auto-fixes.d.ts.map +1 -0
- package/dist/plugin/fix/apply-auto-fixes.js +8 -0
- package/dist/plugin/fix/apply-auto-fixes.js.map +1 -0
- package/dist/plugin/fix/apply-suggestions.d.ts +11 -0
- package/dist/plugin/fix/apply-suggestions.d.ts.map +1 -0
- package/dist/plugin/fix/apply-suggestions.js +25 -0
- package/dist/plugin/fix/apply-suggestions.js.map +1 -0
- package/dist/plugin/fix/disable-per-file.d.ts +10 -0
- package/dist/plugin/fix/disable-per-file.d.ts.map +1 -0
- package/dist/plugin/fix/disable-per-file.js +39 -0
- package/dist/plugin/fix/disable-per-file.js.map +1 -0
- package/dist/plugin/fix/disable-per-line.d.ts +10 -0
- package/dist/plugin/fix/disable-per-line.d.ts.map +1 -0
- package/dist/plugin/fix/disable-per-line.js +54 -0
- package/dist/plugin/fix/disable-per-line.js.map +1 -0
- package/dist/plugin/fix/index.d.ts +6 -0
- package/dist/plugin/fix/index.d.ts.map +1 -0
- package/dist/plugin/fix/index.js +6 -0
- package/dist/plugin/fix/index.js.map +1 -0
- package/dist/plugin/fix/make-fixable-and-fix.d.ts +12 -0
- package/dist/plugin/fix/make-fixable-and-fix.d.ts.map +1 -0
- package/dist/plugin/fix/make-fixable-and-fix.js +61 -0
- package/dist/plugin/fix/make-fixable-and-fix.js.map +1 -0
- package/dist/plugin/fix-rule.d.ts +10 -0
- package/dist/plugin/fix-rule.d.ts.map +1 -0
- package/dist/plugin/fix-rule.js +124 -0
- package/dist/plugin/fix-rule.js.map +1 -0
- package/dist/plugin/index.d.ts +49 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/index.js +11 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/prefer-addition-shorthand-rule.d.ts +7 -0
- package/dist/plugin/prefer-addition-shorthand-rule.d.ts.map +1 -0
- package/dist/plugin/prefer-addition-shorthand-rule.js +54 -0
- package/dist/plugin/prefer-addition-shorthand-rule.js.map +1 -0
- package/dist/plugin/rule-fixer.d.ts +80 -0
- package/dist/plugin/rule-fixer.d.ts.map +1 -0
- package/dist/plugin/rule-fixer.js +118 -0
- package/dist/plugin/rule-fixer.js.map +1 -0
- package/dist/scene/check-results.d.ts +21 -0
- package/dist/scene/check-results.d.ts.map +1 -0
- package/dist/scene/check-results.js +22 -0
- package/dist/scene/check-results.js.map +1 -0
- package/dist/scene/index.d.ts +25 -0
- package/dist/scene/index.d.ts.map +1 -0
- package/dist/scene/index.js +6 -0
- package/dist/scene/index.js.map +1 -0
- package/dist/scene/lint.d.ts +8 -0
- package/dist/scene/lint.d.ts.map +1 -0
- package/dist/scene/lint.js +31 -0
- package/dist/scene/lint.js.map +1 -0
- package/dist/scene/select-action.d.ts +20 -0
- package/dist/scene/select-action.d.ts.map +1 -0
- package/dist/scene/select-action.js +46 -0
- package/dist/scene/select-action.js.map +1 -0
- package/dist/scene/select-rule-ids.d.ts +15 -0
- package/dist/scene/select-rule-ids.d.ts.map +1 -0
- package/dist/scene/select-rule-ids.js +10 -0
- package/dist/scene/select-rule-ids.js.map +1 -0
- package/dist/tsconfig.src.tsbuildinfo +1 -0
- package/dist/util/array.d.ts +3 -0
- package/dist/util/array.d.ts.map +1 -0
- package/dist/util/array.js +14 -0
- package/dist/util/array.js.map +1 -0
- package/dist/util/cache.d.ts +5 -0
- package/dist/util/cache.d.ts.map +1 -0
- package/dist/util/cache.js +13 -0
- package/dist/util/cache.js.map +1 -0
- package/dist/util/eslint.d.ts +68 -0
- package/dist/util/eslint.d.ts.map +1 -0
- package/dist/util/eslint.js +147 -0
- package/dist/util/eslint.js.map +1 -0
- package/dist/util/filter-script.d.ts +6 -0
- package/dist/util/filter-script.d.ts.map +1 -0
- package/dist/util/filter-script.js +39 -0
- package/dist/util/filter-script.js.map +1 -0
- package/dist/util/type-check.d.ts +3 -0
- package/dist/util/type-check.d.ts.map +1 -0
- package/dist/util/type-check.js +8 -0
- package/dist/util/type-check.js.map +1 -0
- package/package.json +93 -0
- package/src/action/apply-suggestions.ts +40 -0
- package/src/action/disable-per-file.ts +16 -0
- package/src/action/disable-per-line.ts +16 -0
- package/src/action/fix.ts +14 -0
- package/src/action/index.ts +6 -0
- package/src/action/make-fixable-and-fix.ts +40 -0
- package/src/action/print-result-details.ts +18 -0
- package/src/cli/log.ts +11 -0
- package/src/cli/ora.ts +25 -0
- package/src/cli/package.ts +9 -0
- package/src/cli/parse-argv.ts +52 -0
- package/src/cli/prompt.ts +205 -0
- package/src/cli/run.ts +50 -0
- package/src/core-worker.ts +66 -0
- package/src/core.ts +240 -0
- package/src/formatter/colors.ts +5 -0
- package/src/formatter/format-by-files.ts +48 -0
- package/src/formatter/format-by-rules.ts +37 -0
- package/src/formatter/index.ts +9 -0
- package/src/formatter/take-rule-statistics.ts +66 -0
- package/src/index.ts +4 -0
- package/src/plugin/fix/apply-auto-fixes.ts +13 -0
- package/src/plugin/fix/apply-suggestions.ts +44 -0
- package/src/plugin/fix/disable-per-file.ts +53 -0
- package/src/plugin/fix/disable-per-line.ts +65 -0
- package/src/plugin/fix/index.ts +13 -0
- package/src/plugin/fix/make-fixable-and-fix.ts +77 -0
- package/src/plugin/fix-rule.ts +142 -0
- package/src/plugin/index.ts +66 -0
- package/src/plugin/prefer-addition-shorthand-rule.ts +56 -0
- package/src/plugin/rule-fixer.ts +147 -0
- package/src/scene/check-results.ts +43 -0
- package/src/scene/index.ts +18 -0
- package/src/scene/lint.ts +41 -0
- package/src/scene/select-action.ts +70 -0
- package/src/scene/select-rule-ids.ts +24 -0
- package/src/typings/cachedir.d.ts +5 -0
- package/src/typings/node-pager.d.ts +4 -0
- package/src/util/array.ts +16 -0
- package/src/util/cache.ts +11 -0
- package/src/util/eslint.ts +162 -0
- package/src/util/filter-script.ts +45 -0
- package/src/util/type-check.ts +8 -0
- package/static/example-filter-script.js +49 -0
- package/static/example-fixable-maker-script.js +47 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/cli/prompt.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAShC;;GAEG;AACH,oBAAY,MAAM,GACd,oBAAoB,GACpB,gBAAgB,GAChB,gBAAgB,GAChB,gBAAgB,GAChB,kBAAkB,GAClB,mBAAmB,GACnB,eAAe,CAAC;AAEpB;;;;;GAKG;AACH,oBAAY,WAAW,GAAG,WAAW,GAAG,cAAc,CAAC;AAEvD;;GAEG;AACH,oBAAY,QAAQ,GAAG,eAAe,GAAG,MAAM,GAAG,YAAY,CAAC;AAE/D;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,gBAAgB,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAexF;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,CA0CjB;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,WAAW,CAAC,CAgBrE;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAY5E;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,QAAQ,CAAC,CAenE;AAED;;;GAGG;AACH,wBAAsB,8BAA8B,IAAI,OAAO,CAAC,OAAO,CAAC,CAWvE;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,OAAO,CAAC,CAWjE"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/* istanbul ignore file */
|
|
2
|
+
import enquirer from 'enquirer';
|
|
3
|
+
import { takeRuleStatistics } from '../formatter/index.js';
|
|
4
|
+
const { prompt } = enquirer;
|
|
5
|
+
// When combined with worker, for some reason the enquirer grabs the SIGINT and the process continues to survive.
|
|
6
|
+
// Therefore, the process is explicitly terminated.
|
|
7
|
+
const onCancel = () => process.exit();
|
|
8
|
+
/**
|
|
9
|
+
* Ask the user for the rule ids to which they want to apply the action.
|
|
10
|
+
* @param ruleIdsInResults The rule ids that are in the lint results.
|
|
11
|
+
* @returns The rule ids
|
|
12
|
+
*/
|
|
13
|
+
export async function promptToInputRuleIds(ruleIdsInResults) {
|
|
14
|
+
const { ruleIds } = await prompt([
|
|
15
|
+
{
|
|
16
|
+
name: 'ruleIds',
|
|
17
|
+
type: 'multiselect',
|
|
18
|
+
message: 'Which rules would you like to apply action?',
|
|
19
|
+
hint: 'Select all you want with <space> key.',
|
|
20
|
+
choices: ruleIdsInResults,
|
|
21
|
+
validate(value) {
|
|
22
|
+
return value.length === 0 ? `Select at least one rule with <space> key.` : true;
|
|
23
|
+
},
|
|
24
|
+
onCancel,
|
|
25
|
+
},
|
|
26
|
+
]);
|
|
27
|
+
return ruleIds;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Ask the user what action they want to perform.
|
|
31
|
+
* @returns The action name
|
|
32
|
+
*/
|
|
33
|
+
export async function promptToInputAction(results, selectedRuleIds, initialAction) {
|
|
34
|
+
var _a;
|
|
35
|
+
const ruleStatistics = takeRuleStatistics(results).filter((ruleStatistic) => selectedRuleIds.includes(ruleStatistic.ruleId));
|
|
36
|
+
const foldedStatistics = ruleStatistics.reduce((a, b) => ({
|
|
37
|
+
isFixableCount: a.isFixableCount + b.isFixableCount,
|
|
38
|
+
hasSuggestionsCount: a.hasSuggestionsCount + b.hasSuggestionsCount,
|
|
39
|
+
}), { isFixableCount: 0, hasSuggestionsCount: 0 });
|
|
40
|
+
const choices = [
|
|
41
|
+
{ name: 'printResultDetails', message: '🔎 Display details of lint results' },
|
|
42
|
+
{ name: 'applyAutoFixes', message: '🔧 Run `eslint --fix`', disabled: foldedStatistics.isFixableCount === 0 },
|
|
43
|
+
{ name: 'disablePerLine', message: '🔧 Disable per line' },
|
|
44
|
+
{ name: 'disablePerFile', message: '🔧 Disable per file' },
|
|
45
|
+
{
|
|
46
|
+
name: 'applySuggestions',
|
|
47
|
+
message: '🔧 Apply suggestions (experimental, for experts)',
|
|
48
|
+
disabled: foldedStatistics.hasSuggestionsCount === 0,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'makeFixableAndFix',
|
|
52
|
+
message: '🔧 Make forcibly fixable and run `eslint --fix` (experimental, for experts)',
|
|
53
|
+
},
|
|
54
|
+
{ name: 'reselectRules', message: '↩️ Reselect rules' },
|
|
55
|
+
];
|
|
56
|
+
const { action } = await prompt([
|
|
57
|
+
{
|
|
58
|
+
name: 'action',
|
|
59
|
+
type: 'select',
|
|
60
|
+
message: 'Which action do you want to do?',
|
|
61
|
+
choices,
|
|
62
|
+
initial: (_a = choices.findIndex((choice) => choice.name === initialAction)) !== null && _a !== void 0 ? _a : 0,
|
|
63
|
+
onCancel,
|
|
64
|
+
},
|
|
65
|
+
]);
|
|
66
|
+
return action;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Ask the user how to display the lint results.
|
|
70
|
+
* @returns How to display
|
|
71
|
+
*/
|
|
72
|
+
export async function promptToInputDisplayMode() {
|
|
73
|
+
const { displayMode } = await prompt([
|
|
74
|
+
{
|
|
75
|
+
name: 'displayMode',
|
|
76
|
+
type: 'select',
|
|
77
|
+
message: 'What format do you want to display the problem message in?',
|
|
78
|
+
choices: [
|
|
79
|
+
{ name: 'withPager', message: '↕️ Display with pager' },
|
|
80
|
+
{ name: 'withoutPager', message: '📃 Display without pager' },
|
|
81
|
+
],
|
|
82
|
+
onCancel,
|
|
83
|
+
},
|
|
84
|
+
]);
|
|
85
|
+
return displayMode;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Ask the user a description to leave in disable comment.
|
|
89
|
+
* @returns The description
|
|
90
|
+
*/
|
|
91
|
+
export async function promptToInputDescription() {
|
|
92
|
+
const { description } = await prompt([
|
|
93
|
+
{
|
|
94
|
+
name: 'description',
|
|
95
|
+
type: 'input',
|
|
96
|
+
message: 'Leave a code comment with your reason for disabling (Optional)',
|
|
97
|
+
onCancel,
|
|
98
|
+
},
|
|
99
|
+
]);
|
|
100
|
+
return description === '' ? undefined : description;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Ask the user what to do next.
|
|
104
|
+
* @returns What to do next.
|
|
105
|
+
*/
|
|
106
|
+
export async function promptToInputWhatToDoNext() {
|
|
107
|
+
const { nextStep } = await prompt([
|
|
108
|
+
{
|
|
109
|
+
name: 'nextStep',
|
|
110
|
+
type: 'select',
|
|
111
|
+
message: "What's the next step?",
|
|
112
|
+
choices: [
|
|
113
|
+
{ name: 'fixOtherRules', message: '🔧 Fix other rules' },
|
|
114
|
+
{ name: 'undoTheFix', message: '↩️ Undo the fix' },
|
|
115
|
+
{ name: 'exit', message: '💚 Exit' },
|
|
116
|
+
],
|
|
117
|
+
onCancel,
|
|
118
|
+
},
|
|
119
|
+
]);
|
|
120
|
+
return nextStep;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Ask the user if they want to reuse the filter script.
|
|
124
|
+
* @returns If it reuses, `true`, if not, `false`.
|
|
125
|
+
*/
|
|
126
|
+
export async function promptToInputReuseFilterScript() {
|
|
127
|
+
const { reuseFilterScript } = await prompt([
|
|
128
|
+
{
|
|
129
|
+
name: 'reuseFilterScript',
|
|
130
|
+
type: 'confirm',
|
|
131
|
+
message: 'Do you want to reuse a previously edited filter script?',
|
|
132
|
+
initial: true,
|
|
133
|
+
onCancel,
|
|
134
|
+
},
|
|
135
|
+
]);
|
|
136
|
+
return reuseFilterScript;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Ask the user if they want to reuse the script.
|
|
140
|
+
* @returns If it reuses, `true`, if not, `false`.
|
|
141
|
+
*/
|
|
142
|
+
export async function promptToInputReuseScript() {
|
|
143
|
+
const { reuseScript } = await prompt([
|
|
144
|
+
{
|
|
145
|
+
name: 'reuseScript',
|
|
146
|
+
type: 'confirm',
|
|
147
|
+
message: 'Do you want to reuse a previously edited script?',
|
|
148
|
+
initial: true,
|
|
149
|
+
onCancel,
|
|
150
|
+
},
|
|
151
|
+
]);
|
|
152
|
+
return reuseScript;
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +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,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;AA2BtC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,gBAA0B;IACnE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAwB;QACtD;YACE,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE,6CAA6C;YACtD,IAAI,EAAE,uCAAuC;YAC7C,OAAO,EAAE,gBAAgB;YACzB,QAAQ,CAAC,KAAK;gBACZ,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,4CAA4C,CAAC,CAAC,CAAC,IAAI,CAAC;YAClF,CAAC;YACD,QAAQ;SACT;KACF,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,OAA4B,EAC5B,eAAyB,EACzB,aAAsB;;IAEtB,MAAM,cAAc,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,EAAE,E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,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,8BAA8B;IAClD,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,MAAM,CAAiC;QACzE;YACE,IAAI,EAAE,mBAAmB;YACzB,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,yDAAyD;YAClE,OAAO,EAAE,IAAI;YACb,QAAQ;SACT;KACF,CAAC,CAAC;IACH,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB;IAC5C,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,MAAM,CAA2B;QAC7D;YACE,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,kDAAkD;YAC3D,OAAO,EAAE,IAAI;YACb,QAAQ;SACT;KACF,CAAC,CAAC;IACH,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":"AAYA,oBAAY,OAAO,GAAG;IACpB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,wBAAsB,GAAG,CAAC,OAAO,EAAE,OAAO,iBA8BzC"}
|
package/dist/cli/run.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createRequire as _createRequire } from "module";
|
|
2
|
+
const __require = _createRequire(import.meta.url);
|
|
3
|
+
import { dirname, join } from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { Worker } from 'worker_threads';
|
|
6
|
+
import { wrap } from 'comlink';
|
|
7
|
+
import nodeEndpoint from 'comlink/dist/esm/node-adapter.mjs';
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
9
|
+
const isInstalledGlobally = __require("is-installed-globally");
|
|
10
|
+
import { warn } from '../cli/log.js';
|
|
11
|
+
import { parseArgv } from '../cli/parse-argv.js';
|
|
12
|
+
import { lint, selectAction, selectRuleIds, checkResults } from '../scene/index.js';
|
|
13
|
+
/**
|
|
14
|
+
* Run eslint-interactive.
|
|
15
|
+
*/
|
|
16
|
+
export async function run(options) {
|
|
17
|
+
if (isInstalledGlobally) {
|
|
18
|
+
warn('eslint-interactive is installed globally. ' +
|
|
19
|
+
'The globally installed eslint-interactive is not officially supported because some features do not work. ' +
|
|
20
|
+
'It is recommended to install eslint-interactive locally.');
|
|
21
|
+
}
|
|
22
|
+
const config = parseArgv(options.argv);
|
|
23
|
+
// Directly executing the Core API will hog the main thread and halt the spinner.
|
|
24
|
+
// So we wrap it with comlink and run it on the Worker.
|
|
25
|
+
const worker = new Worker(join(dirname(fileURLToPath(import.meta.url)), '..', 'core-worker.js'));
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
|
+
const ProxiedCore = wrap(nodeEndpoint(worker));
|
|
28
|
+
const core = await new ProxiedCore(config);
|
|
29
|
+
let nextScene = { name: 'lint' };
|
|
30
|
+
while (nextScene.name !== 'exit') {
|
|
31
|
+
if (nextScene.name === 'lint') {
|
|
32
|
+
nextScene = await lint(core);
|
|
33
|
+
}
|
|
34
|
+
else if (nextScene.name === 'selectRuleIds') {
|
|
35
|
+
nextScene = await selectRuleIds(core, nextScene.args);
|
|
36
|
+
}
|
|
37
|
+
else if (nextScene.name === 'selectAction') {
|
|
38
|
+
nextScene = await selectAction(core, nextScene.args);
|
|
39
|
+
}
|
|
40
|
+
else if (nextScene.name === 'checkResults') {
|
|
41
|
+
nextScene = await checkResults(nextScene.args);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
await worker.terminate();
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/cli/run.ts"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GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;SAC9B;aAAM,IAAI,SAAS,CAAC,IAAI,KAAK,eAAe,EAAE;YAC7C,SAAS,GAAG,MAAM,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;SACvD;aAAM,IAAI,SAAS,CAAC,IAAI,KAAK,cAAc,EAAE;YAC5C,SAAS,GAAG,MAAM,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;SACtD;aAAM,IAAI,SAAS,CAAC,IAAI,KAAK,cAAc,EAAE;YAC5C,SAAS,GAAG,MAAM,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;SAChD;KACF;IACD,MAAM,MAAM,CAAC,SAAS,EAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ESLint } from 'eslint';
|
|
2
|
+
import { Core, Config } from './core.js';
|
|
3
|
+
/**
|
|
4
|
+
* This is a wrapper for using the Core API from comlink.
|
|
5
|
+
*
|
|
6
|
+
* The arguments of the methods wrapped in comlink must be serializable.
|
|
7
|
+
* The methods in this class are serializable versions of the Core API methods.
|
|
8
|
+
*/
|
|
9
|
+
export declare class SerializableCore {
|
|
10
|
+
readonly core: Core;
|
|
11
|
+
constructor(config: Config);
|
|
12
|
+
lint(...args: Parameters<Core['lint']>): ReturnType<Core['lint']>;
|
|
13
|
+
formatResultSummary(...args: Parameters<Core['formatResultSummary']>): ReturnType<Core['formatResultSummary']>;
|
|
14
|
+
formatResultDetails(...args: Parameters<Core['formatResultDetails']>): ReturnType<Core['formatResultDetails']>;
|
|
15
|
+
applyAutoFixes(...args: Parameters<Core['applyAutoFixes']>): ReturnType<Core['applyAutoFixes']>;
|
|
16
|
+
disablePerLine(...args: Parameters<Core['disablePerLine']>): ReturnType<Core['disablePerLine']>;
|
|
17
|
+
disablePerFile(...args: Parameters<Core['disablePerFile']>): ReturnType<Core['disablePerFile']>;
|
|
18
|
+
applySuggestions(results: ESLint.LintResult[], ruleIds: string[], filterScript: string): ReturnType<Core['applySuggestions']>;
|
|
19
|
+
makeFixableAndFix(results: ESLint.LintResult[], ruleIds: string[], fixableMakerScript: string): ReturnType<Core['makeFixableAndFix']>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=core-worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-worker.d.ts","sourceRoot":"","sources":["../src/core-worker.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AASzC;;;;;GAKG;AACH,qBAAa,gBAAgB;IAC3B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;gBACR,MAAM,EAAE,MAAM;IAGpB,IAAI,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAGvE,mBAAmB,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IAGxG,mBAAmB,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IAG9G,cAAc,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAG/F,cAAc,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAG/F,cAAc,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAG/F,gBAAgB,CACpB,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,EAC5B,OAAO,EAAE,MAAM,EAAE,EACjB,YAAY,EAAE,MAAM,GACnB,UAAU,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAIjC,iBAAiB,CACrB,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,EAC5B,OAAO,EAAE,MAAM,EAAE,EACjB,kBAAkB,EAAE,MAAM,GACzB,UAAU,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;CAIzC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { parentPort, MessageChannel } from 'worker_threads';
|
|
2
|
+
import { expose, proxy } from 'comlink';
|
|
3
|
+
import nodeEndpoint from 'comlink/dist/esm/node-adapter.mjs';
|
|
4
|
+
import { Core } from './core.js';
|
|
5
|
+
/**
|
|
6
|
+
* @file This is a wrapper module for using the Core API with comlink.
|
|
7
|
+
*/
|
|
8
|
+
if (parentPort === null)
|
|
9
|
+
throw new Error('This module must be started on a worker.');
|
|
10
|
+
/**
|
|
11
|
+
* This is a wrapper for using the Core API from comlink.
|
|
12
|
+
*
|
|
13
|
+
* The arguments of the methods wrapped in comlink must be serializable.
|
|
14
|
+
* The methods in this class are serializable versions of the Core API methods.
|
|
15
|
+
*/
|
|
16
|
+
export class SerializableCore {
|
|
17
|
+
constructor(config) {
|
|
18
|
+
this.core = new Core(config);
|
|
19
|
+
}
|
|
20
|
+
async lint(...args) {
|
|
21
|
+
return this.core.lint(...args);
|
|
22
|
+
}
|
|
23
|
+
formatResultSummary(...args) {
|
|
24
|
+
return this.core.formatResultSummary(...args);
|
|
25
|
+
}
|
|
26
|
+
async formatResultDetails(...args) {
|
|
27
|
+
return this.core.formatResultDetails(...args);
|
|
28
|
+
}
|
|
29
|
+
async applyAutoFixes(...args) {
|
|
30
|
+
return proxy(await this.core.applyAutoFixes(...args));
|
|
31
|
+
}
|
|
32
|
+
async disablePerLine(...args) {
|
|
33
|
+
return proxy(await this.core.disablePerLine(...args));
|
|
34
|
+
}
|
|
35
|
+
async disablePerFile(...args) {
|
|
36
|
+
return proxy(await this.core.disablePerFile(...args));
|
|
37
|
+
}
|
|
38
|
+
async applySuggestions(results, ruleIds, filterScript) {
|
|
39
|
+
const filter = eval(filterScript);
|
|
40
|
+
return proxy(await this.core.applySuggestions(results, ruleIds, filter));
|
|
41
|
+
}
|
|
42
|
+
async makeFixableAndFix(results, ruleIds, fixableMakerScript) {
|
|
43
|
+
const fixableMaker = eval(fixableMakerScript);
|
|
44
|
+
return proxy(await this.core.makeFixableAndFix(results, ruleIds, fixableMaker));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// workaround for https://github.com/GoogleChromeLabs/comlink/issues/466
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
49
|
+
globalThis.MessageChannel = MessageChannel;
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
51
|
+
expose(SerializableCore, nodeEndpoint(parentPort));
|
|
52
|
+
//# sourceMappingURL=core-worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-worker.js","sourceRoot":"","sources":["../src/core-worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,YAAY,MAAM,mCAAmC,CAAC;AAE7D,OAAO,EAAE,IAAI,EAAU,MAAM,WAAW,CAAC;AAGzC;;GAEG;AAEH,IAAI,UAAU,KAAK,IAAI;IAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;AAErF;;;;;GAKG;AACH,MAAM,OAAO,gBAAgB;IAE3B,YAAY,MA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0B;QAE1B,MAAM,YAAY,GAAG,IAAI,CAAC,kBAAkB,CAAiB,CAAC;QAC9D,OAAO,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;IAClF,CAAC;CACF;AAED,wEAAwE;AACxE,8DAA8D;AAC7D,UAAkB,CAAC,cAAc,GAAG,cAAc,CAAC;AAEpD,8DAA8D;AAC9D,MAAM,CAAC,gBAAgB,EAAG,YAAoB,CAAC,UAAU,CAAC,CAAC,CAAC"}
|
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ESLint } from 'eslint';
|
|
2
|
+
import { FixableMaker, SuggestionFilter } from './plugin/index.js';
|
|
3
|
+
export declare type Undo = () => Promise<void>;
|
|
4
|
+
/** The config of eslint-interactive */
|
|
5
|
+
export declare type Config = {
|
|
6
|
+
patterns: string[];
|
|
7
|
+
rulePaths?: string[] | undefined;
|
|
8
|
+
extensions?: string[] | undefined;
|
|
9
|
+
formatterName?: string;
|
|
10
|
+
cache?: boolean;
|
|
11
|
+
cacheLocation?: string;
|
|
12
|
+
cwd?: string;
|
|
13
|
+
};
|
|
14
|
+
/** Default config of `Core` */
|
|
15
|
+
export declare const DEFAULT_BASE_CONFIG: {
|
|
16
|
+
cache: boolean;
|
|
17
|
+
cacheLocation: string;
|
|
18
|
+
formatterName: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* The core of eslint-interactive.
|
|
22
|
+
* It uses ESLint's Node.js API to output a summary of problems, fix problems, apply suggestions, etc.
|
|
23
|
+
*/
|
|
24
|
+
export declare class Core {
|
|
25
|
+
readonly config: Config;
|
|
26
|
+
/** The base options of ESLint */
|
|
27
|
+
readonly baseOptions: ESLint.Options;
|
|
28
|
+
constructor(config: Config);
|
|
29
|
+
/**
|
|
30
|
+
* Lint project.
|
|
31
|
+
* @returns The results of linting
|
|
32
|
+
*/
|
|
33
|
+
lint(): Promise<ESLint.LintResult[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Returns summary of lint results.
|
|
36
|
+
* @param results The lint results of the project to print summary
|
|
37
|
+
*/
|
|
38
|
+
formatResultSummary(results: ESLint.LintResult[]): string;
|
|
39
|
+
/**
|
|
40
|
+
* Returns details of lint results.
|
|
41
|
+
* @param results The lint results of the project to print summary
|
|
42
|
+
* @param ruleIds The rule ids to print details
|
|
43
|
+
*/
|
|
44
|
+
formatResultDetails(results: ESLint.LintResult[], ruleIds: (string | null)[]): Promise<string>;
|
|
45
|
+
/**
|
|
46
|
+
* Run `eslint --fix`.
|
|
47
|
+
* @param ruleIds The rule ids to fix
|
|
48
|
+
*/
|
|
49
|
+
applyAutoFixes(results: ESLint.LintResult[], ruleIds: string[]): Promise<Undo>;
|
|
50
|
+
/**
|
|
51
|
+
* Add disable comments per line.
|
|
52
|
+
* @param results The lint results of the project to add disable comments
|
|
53
|
+
* @param ruleIds The rule ids to add disable comments
|
|
54
|
+
* @param description The description of the disable comments
|
|
55
|
+
*/
|
|
56
|
+
disablePerLine(results: ESLint.LintResult[], ruleIds: string[], description?: string): Promise<Undo>;
|
|
57
|
+
/**
|
|
58
|
+
* Add disable comments per file.
|
|
59
|
+
* @param results The lint results of the project to add disable comments
|
|
60
|
+
* @param ruleIds The rule ids to add disable comments
|
|
61
|
+
* @param description The description of the disable comments
|
|
62
|
+
*/
|
|
63
|
+
disablePerFile(results: ESLint.LintResult[], ruleIds: string[], description?: string): Promise<Undo>;
|
|
64
|
+
/**
|
|
65
|
+
* Apply suggestions.
|
|
66
|
+
* @param results The lint results of the project to apply suggestions
|
|
67
|
+
* @param ruleIds The rule ids to apply suggestions
|
|
68
|
+
* @param filter The script to filter suggestions
|
|
69
|
+
* */
|
|
70
|
+
applySuggestions(results: ESLint.LintResult[], ruleIds: string[], filter: SuggestionFilter): Promise<Undo>;
|
|
71
|
+
/**
|
|
72
|
+
* Make forcibly fixable and run `eslint --fix`.
|
|
73
|
+
* @param results The lint results of the project to apply suggestions
|
|
74
|
+
* @param ruleIds The rule ids to apply suggestions
|
|
75
|
+
* @param fixableMaker The function to make `Linter.LintMessage` forcibly fixable.
|
|
76
|
+
* */
|
|
77
|
+
makeFixableAndFix(results: ESLint.LintResult[], ruleIds: string[], fixableMaker: FixableMaker): Promise<Undo>;
|
|
78
|
+
/**
|
|
79
|
+
* Fix source codes.
|
|
80
|
+
* @param fix The fix information to do.
|
|
81
|
+
*/
|
|
82
|
+
private fix;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,OAAO,EAGL,YAAY,EACZ,gBAAgB,EAGjB,MAAM,mBAAmB,CAAC;AAqC3B,oBAAY,IAAI,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvC,uCAAuC;AACvC,oBAAY,MAAM,GAAG;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,+BAA+B;AAC/B,eAAO,MAAM,mBAAmB;;;;CAI/B,CAAC;AAEF;;;GAGG;AACH,qBAAa,IAAI;IACf,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,iCAAiC;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC;gBAEzB,MAAM,EAAE,MAAM;IAW1B;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;IAM1C;;;OAGG;IACH,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,GAAG,MAAM;IAgBzD;;;;OAIG;IACG,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAsBpG;;;OAGG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpF;;;;;OAKG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1G;;;;;OAKG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1G;;;;;SAKK;IACC,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhH;;;;;SAKK;IACC,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAInH;;;OAGG;YACW,GAAG;CAwClB"}
|
package/dist/core.js
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { createRequire as _createRequire } from "module";
|
|
2
|
+
const __require = _createRequire(import.meta.url);
|
|
3
|
+
import { join } from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { ESLint } from 'eslint';
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
7
|
+
const isInstalledGlobally = __require("is-installed-globally");
|
|
8
|
+
import { format } from './formatter/index.js';
|
|
9
|
+
import { eslintInteractivePlugin, OVERLAPPED_PROBLEM_MESSAGE, } from './plugin/index.js';
|
|
10
|
+
import { unique } from './util/array.js';
|
|
11
|
+
import { getCacheDir } from './util/cache.js';
|
|
12
|
+
import { filterResultsByRuleId, scanUsedPluginsFromResults } from './util/eslint.js';
|
|
13
|
+
const MAX_AUTOFIX_PASSES = 10;
|
|
14
|
+
/**
|
|
15
|
+
* Generate results to undo.
|
|
16
|
+
* @param resultsOfLint The results of lint.
|
|
17
|
+
* @returns The results to undo.
|
|
18
|
+
*/
|
|
19
|
+
function generateResultsToUndo(resultsOfLint) {
|
|
20
|
+
return resultsOfLint.map((resultOfLint) => {
|
|
21
|
+
// NOTE: THIS IS HACK.
|
|
22
|
+
return { ...resultOfLint, output: resultOfLint.source };
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function hasOverlappedProblems(results) {
|
|
26
|
+
return results.flatMap((result) => result.messages).some((message) => message.message === OVERLAPPED_PROBLEM_MESSAGE);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get all the rules loaded from eslintrc.
|
|
30
|
+
* @param targetFilePaths The target file paths.
|
|
31
|
+
* @param options The eslint option.
|
|
32
|
+
* @returns The rule ids loaded from eslintrc.
|
|
33
|
+
*/
|
|
34
|
+
async function getUsedRuleIds(targetFilePaths, options) {
|
|
35
|
+
const eslintToGetRules = new ESLint(options);
|
|
36
|
+
const configs = await Promise.all(targetFilePaths.map(async (filePath) => eslintToGetRules.calculateConfigForFile(filePath)));
|
|
37
|
+
return unique(configs.map((config) => config.rules).flatMap((rules) => Object.keys(rules)));
|
|
38
|
+
}
|
|
39
|
+
/** Default config of `Core` */
|
|
40
|
+
export const DEFAULT_BASE_CONFIG = {
|
|
41
|
+
cache: true,
|
|
42
|
+
cacheLocation: join(getCacheDir(), '.eslintcache'),
|
|
43
|
+
formatterName: 'codeframe',
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* The core of eslint-interactive.
|
|
47
|
+
* It uses ESLint's Node.js API to output a summary of problems, fix problems, apply suggestions, etc.
|
|
48
|
+
*/
|
|
49
|
+
export class Core {
|
|
50
|
+
constructor(config) {
|
|
51
|
+
var _a, _b;
|
|
52
|
+
this.config = config;
|
|
53
|
+
this.baseOptions = {
|
|
54
|
+
cache: (_a = this.config.cache) !== null && _a !== void 0 ? _a : DEFAULT_BASE_CONFIG.cache,
|
|
55
|
+
cacheLocation: (_b = this.config.cacheLocation) !== null && _b !== void 0 ? _b : DEFAULT_BASE_CONFIG.cacheLocation,
|
|
56
|
+
rulePaths: this.config.rulePaths,
|
|
57
|
+
extensions: this.config.extensions,
|
|
58
|
+
cwd: this.config.cwd,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Lint project.
|
|
63
|
+
* @returns The results of linting
|
|
64
|
+
*/
|
|
65
|
+
async lint() {
|
|
66
|
+
const eslint = new ESLint(this.baseOptions);
|
|
67
|
+
const results = await eslint.lintFiles(this.config.patterns);
|
|
68
|
+
return results;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Returns summary of lint results.
|
|
72
|
+
* @param results The lint results of the project to print summary
|
|
73
|
+
*/
|
|
74
|
+
formatResultSummary(results) {
|
|
75
|
+
var _a, _b, _c;
|
|
76
|
+
// get used plugins from `results`
|
|
77
|
+
const plugins = scanUsedPluginsFromResults(results);
|
|
78
|
+
// get `rulesMeta` from `results`
|
|
79
|
+
const eslint = new ESLint({
|
|
80
|
+
...this.baseOptions,
|
|
81
|
+
overrideConfig: { plugins },
|
|
82
|
+
});
|
|
83
|
+
// NOTE: `getRulesMetaForResults` is a feature added in ESLint 7.29.0.
|
|
84
|
+
// Therefore, the function may not exist in versions lower than 7.29.0.
|
|
85
|
+
const rulesMeta = (_b = (_a = eslint.getRulesMetaForResults) === null || _a === void 0 ? void 0 : _a.call(eslint, results)) !== null && _b !== void 0 ? _b : {};
|
|
86
|
+
return format(results, { rulesMeta: rulesMeta, cwd: (_c = this.config.cwd) !== null && _c !== void 0 ? _c : process.cwd() });
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Returns details of lint results.
|
|
90
|
+
* @param results The lint results of the project to print summary
|
|
91
|
+
* @param ruleIds The rule ids to print details
|
|
92
|
+
*/
|
|
93
|
+
async formatResultDetails(results, ruleIds) {
|
|
94
|
+
var _a;
|
|
95
|
+
const eslint = new ESLint(this.baseOptions);
|
|
96
|
+
const formatterName = (_a = this.config.formatterName) !== null && _a !== void 0 ? _a : DEFAULT_BASE_CONFIG.formatterName;
|
|
97
|
+
// When eslint-interactive is installed globally, eslint-formatter-codeframe will also be installed globally.
|
|
98
|
+
// On the other hand, `eslint.loadFormatter` cannot load the globally installed formatter by name. So here it loads them by path.
|
|
99
|
+
const resolvedFormatterNameOrPath = isInstalledGlobally && formatterName === 'codeframe'
|
|
100
|
+
? fileURLToPath(
|
|
101
|
+
// @ts-expect-error
|
|
102
|
+
await import.meta.resolve('eslint-formatter-codeframe',
|
|
103
|
+
// @ts-expect-error
|
|
104
|
+
await import.meta.resolve('eslint-interactive')))
|
|
105
|
+
: formatterName;
|
|
106
|
+
const formatter = await eslint.loadFormatter(resolvedFormatterNameOrPath);
|
|
107
|
+
return formatter.format(filterResultsByRuleId(results, ruleIds));
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Run `eslint --fix`.
|
|
111
|
+
* @param ruleIds The rule ids to fix
|
|
112
|
+
*/
|
|
113
|
+
async applyAutoFixes(results, ruleIds) {
|
|
114
|
+
return await this.fix(results, ruleIds, { name: 'applyAutoFixes', args: {} });
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Add disable comments per line.
|
|
118
|
+
* @param results The lint results of the project to add disable comments
|
|
119
|
+
* @param ruleIds The rule ids to add disable comments
|
|
120
|
+
* @param description The description of the disable comments
|
|
121
|
+
*/
|
|
122
|
+
async disablePerLine(results, ruleIds, description) {
|
|
123
|
+
return await this.fix(results, ruleIds, { name: 'disablePerLine', args: { description } });
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Add disable comments per file.
|
|
127
|
+
* @param results The lint results of the project to add disable comments
|
|
128
|
+
* @param ruleIds The rule ids to add disable comments
|
|
129
|
+
* @param description The description of the disable comments
|
|
130
|
+
*/
|
|
131
|
+
async disablePerFile(results, ruleIds, description) {
|
|
132
|
+
return await this.fix(results, ruleIds, { name: 'disablePerFile', args: { description } });
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Apply suggestions.
|
|
136
|
+
* @param results The lint results of the project to apply suggestions
|
|
137
|
+
* @param ruleIds The rule ids to apply suggestions
|
|
138
|
+
* @param filter The script to filter suggestions
|
|
139
|
+
* */
|
|
140
|
+
async applySuggestions(results, ruleIds, filter) {
|
|
141
|
+
return await this.fix(results, ruleIds, { name: 'applySuggestions', args: { filter } });
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Make forcibly fixable and run `eslint --fix`.
|
|
145
|
+
* @param results The lint results of the project to apply suggestions
|
|
146
|
+
* @param ruleIds The rule ids to apply suggestions
|
|
147
|
+
* @param fixableMaker The function to make `Linter.LintMessage` forcibly fixable.
|
|
148
|
+
* */
|
|
149
|
+
async makeFixableAndFix(results, ruleIds, fixableMaker) {
|
|
150
|
+
return await this.fix(results, ruleIds, { name: 'makeFixableAndFix', args: { fixableMaker } });
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Fix source codes.
|
|
154
|
+
* @param fix The fix information to do.
|
|
155
|
+
*/
|
|
156
|
+
async fix(resultsOfLint, ruleIds, fix) {
|
|
157
|
+
// NOTE: Extract only necessary results and files for performance
|
|
158
|
+
const filteredResultsOfLint = filterResultsByRuleId(resultsOfLint, ruleIds);
|
|
159
|
+
const targetFilePaths = filteredResultsOfLint.map((result) => result.filePath);
|
|
160
|
+
const usedRuleIds = await getUsedRuleIds(targetFilePaths, this.baseOptions);
|
|
161
|
+
// TODO: refactor
|
|
162
|
+
let results = filteredResultsOfLint;
|
|
163
|
+
for (let i = 0; i < MAX_AUTOFIX_PASSES; i++) {
|
|
164
|
+
const eslint = new ESLint({
|
|
165
|
+
...this.baseOptions,
|
|
166
|
+
// This is super hack to load ESM plugin/rule.
|
|
167
|
+
// ref: https://github.com/eslint/eslint/issues/15453#issuecomment-1001200953
|
|
168
|
+
plugins: {
|
|
169
|
+
'eslint-interactive': eslintInteractivePlugin,
|
|
170
|
+
},
|
|
171
|
+
overrideConfig: {
|
|
172
|
+
plugins: ['eslint-interactive'],
|
|
173
|
+
rules: {
|
|
174
|
+
'eslint-interactive/fix': [2, { results, ruleIds, fix }],
|
|
175
|
+
// Turn off all rules except `eslint-interactive/fix` when fixing for performance.
|
|
176
|
+
...Object.fromEntries(usedRuleIds.map((ruleId) => [ruleId, 'off'])),
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
// NOTE: Only fix the `fix` rule problems.
|
|
180
|
+
fix: (message) => message.ruleId === 'eslint-interactive/fix',
|
|
181
|
+
// Don't interpret lintFiles arguments as glob patterns for performance.
|
|
182
|
+
globInputPaths: false,
|
|
183
|
+
});
|
|
184
|
+
const resultsToFix = await eslint.lintFiles(targetFilePaths);
|
|
185
|
+
await ESLint.outputFixes(resultsToFix);
|
|
186
|
+
if (!hasOverlappedProblems(resultsToFix))
|
|
187
|
+
break;
|
|
188
|
+
results = await this.lint();
|
|
189
|
+
}
|
|
190
|
+
return async () => {
|
|
191
|
+
const resultsToUndo = generateResultsToUndo(filteredResultsOfLint);
|
|
192
|
+
await ESLint.outputFixes(resultsToUndo);
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=core.js.map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AAM,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;YACvC,IAAI,CAAC,qBAAqB,CAAC,YAAY,CAAC;gBAAE,MAAM;YAChD,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;SAC7B;QAED,OAAO,KAAK,IAAI,EAAE;YAChB,MAAM,aAAa,GAAG,qBAAqB,CAAC,qBAAqB,CAAC,CAAC;YACnE,MAAM,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;QAC1C,CAAC,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/formatter/colors.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,aAAuB,CAAC;AACjD,eAAO,MAAM,WAAW,OAAiB,CAAC;AAC1C,eAAO,MAAM,aAAa,UAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors.js","sourceRoot":"","sources":["../../src/formatter/colors.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B,MAAM,CAAC,MAAM,YAAY,GAAG,WAAoB,CAAC;AACjD,MAAM,CAAC,MAAM,WAAW,GAAG,KAAc,CAAC;AAC1C,MAAM,CAAC,MAAM,aAAa,GAAG,QAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-by-files.d.ts","sourceRoot":"","sources":["../../src/formatter/format-by-files.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAOhC,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,GAAG,MAAM,CAuClE"}
|