eslint-interactive 13.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/dist/action/convert-error-to-warning-per-file.d.ts +6 -0
- package/dist/action/convert-error-to-warning-per-file.d.ts.map +1 -0
- package/dist/action/convert-error-to-warning-per-file.js +8 -0
- package/dist/action/convert-error-to-warning-per-file.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 +12 -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 +12 -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 +6 -0
- package/dist/action/index.d.ts.map +1 -0
- package/dist/action/index.js +6 -0
- package/dist/action/index.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 +35 -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 +10 -0
- package/dist/cli/log.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/pager.d.ts +2 -0
- package/dist/cli/pager.d.ts.map +1 -0
- package/dist/cli/pager.js +34 -0
- package/dist/cli/pager.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 +82 -0
- package/dist/cli/parse-argv.js.map +1 -0
- package/dist/cli/prompt.d.ts +51 -0
- package/dist/cli/prompt.d.ts.map +1 -0
- package/dist/cli/prompt.js +135 -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 +52 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/spinner.d.ts +4 -0
- package/dist/cli/spinner.d.ts.map +1 -0
- package/dist/cli/spinner.js +20 -0
- package/dist/cli/spinner.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 +47 -0
- package/dist/core-worker.js.map +1 -0
- package/dist/core.d.ts +82 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +186 -0
- package/dist/core.js.map +1 -0
- package/dist/eslint/linter.d.ts +18 -0
- package/dist/eslint/linter.d.ts.map +1 -0
- package/dist/eslint/linter.js +71 -0
- package/dist/eslint/linter.js.map +1 -0
- package/dist/eslint/report-translator.d.ts +9 -0
- package/dist/eslint/report-translator.d.ts.map +1 -0
- package/dist/eslint/report-translator.js +75 -0
- package/dist/eslint/report-translator.js.map +1 -0
- package/dist/eslint/rule-fixer.d.ts +80 -0
- package/dist/eslint/rule-fixer.d.ts.map +1 -0
- package/dist/eslint/rule-fixer.js +114 -0
- package/dist/eslint/rule-fixer.js.map +1 -0
- package/dist/eslint/source-code-fixer.d.ts +15 -0
- package/dist/eslint/source-code-fixer.d.ts.map +1 -0
- package/dist/eslint/source-code-fixer.js +131 -0
- package/dist/eslint/source-code-fixer.js.map +1 -0
- package/dist/fix/apply-auto-fixes.d.ts +8 -0
- package/dist/fix/apply-auto-fixes.d.ts.map +1 -0
- package/dist/fix/apply-auto-fixes.js +8 -0
- package/dist/fix/apply-auto-fixes.js.map +1 -0
- package/dist/fix/apply-suggestions.d.ts +11 -0
- package/dist/fix/apply-suggestions.d.ts.map +1 -0
- package/dist/fix/apply-suggestions.js +25 -0
- package/dist/fix/apply-suggestions.js.map +1 -0
- package/dist/fix/convert-error-to-warning-per-file.d.ts +10 -0
- package/dist/fix/convert-error-to-warning-per-file.d.ts.map +1 -0
- package/dist/fix/convert-error-to-warning-per-file.js +28 -0
- package/dist/fix/convert-error-to-warning-per-file.js.map +1 -0
- package/dist/fix/disable-per-file.d.ts +12 -0
- package/dist/fix/disable-per-file.d.ts.map +1 -0
- package/dist/fix/disable-per-file.js +63 -0
- package/dist/fix/disable-per-file.js.map +1 -0
- package/dist/fix/disable-per-line.d.ts +12 -0
- package/dist/fix/disable-per-line.d.ts.map +1 -0
- package/dist/fix/disable-per-line.js +72 -0
- package/dist/fix/disable-per-line.js.map +1 -0
- package/dist/fix/index.d.ts +19 -0
- package/dist/fix/index.d.ts.map +1 -0
- package/dist/fix/index.js +8 -0
- package/dist/fix/index.js.map +1 -0
- package/dist/fix/make-fixable-and-fix.d.ts +11 -0
- package/dist/fix/make-fixable-and-fix.d.ts.map +1 -0
- package/dist/fix/make-fixable-and-fix.js +35 -0
- package/dist/fix/make-fixable-and-fix.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 +42 -0
- package/dist/formatter/format-by-files.js.map +1 -0
- package/dist/formatter/format-by-rules.d.ts +8 -0
- package/dist/formatter/format-by-rules.d.ts.map +1 -0
- package/dist/formatter/format-by-rules.js +31 -0
- package/dist/formatter/format-by-rules.js.map +1 -0
- package/dist/formatter/format-table.d.ts +4 -0
- package/dist/formatter/format-table.d.ts.map +1 -0
- package/dist/formatter/format-table.js +62 -0
- package/dist/formatter/format-table.js.map +1 -0
- package/dist/formatter/index.d.ts +6 -0
- package/dist/formatter/index.d.ts.map +1 -0
- package/dist/formatter/index.js +8 -0
- package/dist/formatter/index.js.map +1 -0
- 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/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 +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +4 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +87 -0
- package/dist/plugin.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 +30 -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 +44 -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/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/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/eslint.d.ts +103 -0
- package/dist/util/eslint.d.ts.map +1 -0
- package/dist/util/eslint.js +220 -0
- package/dist/util/eslint.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 +18 -19
- package/src/index.ts +0 -0
package/dist/cli/run.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { dirname, join } from 'node:path';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { Worker } from 'node:worker_threads';
|
|
4
|
+
import { wrap } from 'comlink';
|
|
5
|
+
import nodeEndpoint from 'comlink/dist/esm/node-adapter.mjs';
|
|
6
|
+
import terminalLink from 'terminal-link';
|
|
7
|
+
import { parseArgv } from '../cli/parse-argv.js';
|
|
8
|
+
import { checkResults, lint, selectAction, selectRuleIds } from '../scene/index.js';
|
|
9
|
+
/**
|
|
10
|
+
* Run eslint-interactive.
|
|
11
|
+
*/
|
|
12
|
+
export async function run(options) {
|
|
13
|
+
const config = parseArgv(options.argv);
|
|
14
|
+
// Directly executing the Core API will hog the main thread and halt the spinner.
|
|
15
|
+
// So we wrap it with comlink and run it on the Worker.
|
|
16
|
+
const worker = new Worker(join(dirname(fileURLToPath(import.meta.url)), '..', 'core-worker.js'), {
|
|
17
|
+
env: {
|
|
18
|
+
// In worker threads, stdin is recognized as noTTY. Therefore, `util.styleText` and `terminalLink` disable colors and links.
|
|
19
|
+
// To work around this, we use environment variables to force colors and links to be enabled.
|
|
20
|
+
// ref: https://github.com/nodejs/node/issues/26946
|
|
21
|
+
FORCE_COLOR: process.stdin.isTTY ? '1' : '0',
|
|
22
|
+
FORCE_HYPERLINK: terminalLink.isSupported ? '1' : '0',
|
|
23
|
+
...process.env,
|
|
24
|
+
},
|
|
25
|
+
// NOTE: Pass CLI options (--unhandled-rejections=strict, etc.) to the worker
|
|
26
|
+
execArgv: process.execArgv,
|
|
27
|
+
});
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
|
+
const ProxiedCore = wrap(nodeEndpoint(worker));
|
|
30
|
+
const core = await new ProxiedCore(config);
|
|
31
|
+
let nextScene = { name: 'lint' };
|
|
32
|
+
while (nextScene.name !== 'exit') {
|
|
33
|
+
if (nextScene.name === 'lint') {
|
|
34
|
+
// eslint-disable-next-line no-await-in-loop
|
|
35
|
+
nextScene = await lint(core);
|
|
36
|
+
}
|
|
37
|
+
else if (nextScene.name === 'selectRuleIds') {
|
|
38
|
+
// eslint-disable-next-line no-await-in-loop
|
|
39
|
+
nextScene = await selectRuleIds(core, nextScene.args);
|
|
40
|
+
}
|
|
41
|
+
else if (nextScene.name === 'selectAction') {
|
|
42
|
+
// eslint-disable-next-line no-await-in-loop
|
|
43
|
+
nextScene = await selectAction(core, nextScene.args);
|
|
44
|
+
}
|
|
45
|
+
else if (nextScene.name === 'checkResults') {
|
|
46
|
+
// eslint-disable-next-line no-await-in-loop
|
|
47
|
+
nextScene = await checkResults(nextScene.args);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
await worker.terminate();
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,YAAY,MAAM,mCAAmC,CAAC;AAC7D,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAMpF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AC;aAAM,IAAI,SAAS,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YAC7C,4CAA4C;YAC5C,SAAS,GAAG,MAAM,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;QACvD,CAAC;aAAM,IAAI,SAAS,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YAC7C,4CAA4C;YAC5C,SAAS,GAAG,MAAM,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IACD,MAAM,MAAM,CAAC,SAAS,EAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../src/cli/spinner.ts"],"names":[],"mappings":"AAEA,wBAAsB,cAAc,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAKxE;AAED,wBAAsB,aAAa,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAKvE;AAED,wBAAsB,cAAc,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAKxE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createSpinner } from 'nanospinner';
|
|
2
|
+
export async function lintingSpinner(cb) {
|
|
3
|
+
const spinner = createSpinner('Linting...').start();
|
|
4
|
+
const result = await cb();
|
|
5
|
+
spinner.success();
|
|
6
|
+
return result;
|
|
7
|
+
}
|
|
8
|
+
export async function fixingSpinner(cb) {
|
|
9
|
+
const spinner = createSpinner('Fixing...').start();
|
|
10
|
+
const result = await cb();
|
|
11
|
+
spinner.success();
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
export async function undoingSpinner(cb) {
|
|
15
|
+
const spinner = createSpinner('Undoing...').start();
|
|
16
|
+
const result = await cb();
|
|
17
|
+
spinner.success();
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=spinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spinner.js","sourceRoot":"","sources":["../../src/cli/spinner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,CAAC,KAAK,UAAU,cAAc,CAAI,EAAoB;IAC1D,MAAM,OAAO,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC,KAAK,EAAE,CAAC;IACpD,MAAM,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC;IAC1B,OAAO,CAAC,OAAO,EAAE,CAAC;IAClB,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CAAI,EAAoB;IACzD,MAAM,OAAO,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC,KAAK,EAAE,CAAC;IACnD,MAAM,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC;IAC1B,OAAO,CAAC,OAAO,EAAE,CAAC;IAClB,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAAI,EAAoB;IAC1D,MAAM,OAAO,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC,KAAK,EAAE,CAAC;IACpD,MAAM,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC;IAC1B,OAAO,CAAC,OAAO,EAAE,CAAC;IAClB,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Core } from './core.js';
|
|
2
|
+
import type { Config } from './type.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
|
+
getSortedRuleIdsInResults(...args: Parameters<Core['getSortedRuleIdsInResults']>): ReturnType<Core['getSortedRuleIdsInResults']>;
|
|
15
|
+
formatResultDetails(...args: Parameters<Core['formatResultDetails']>): ReturnType<Core['formatResultDetails']>;
|
|
16
|
+
applyAutoFixes(...args: Parameters<Core['applyAutoFixes']>): ReturnType<Core['applyAutoFixes']>;
|
|
17
|
+
disablePerLine(...args: Parameters<Core['disablePerLine']>): ReturnType<Core['disablePerLine']>;
|
|
18
|
+
disablePerFile(...args: Parameters<Core['disablePerFile']>): ReturnType<Core['disablePerFile']>;
|
|
19
|
+
convertErrorToWarningPerFile(...args: Parameters<Core['convertErrorToWarningPerFile']>): ReturnType<Core['convertErrorToWarningPerFile']>;
|
|
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,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAQxC;;;;;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;IAG9G,yBAAyB,CACvB,GAAG,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC,GACrD,UAAU,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IAG1C,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,4BAA4B,CAChC,GAAG,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,GACxD,UAAU,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;CAGpD"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { parentPort } from 'node: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
|
+
getSortedRuleIdsInResults(...args) {
|
|
27
|
+
return this.core.getSortedRuleIdsInResults(...args);
|
|
28
|
+
}
|
|
29
|
+
async formatResultDetails(...args) {
|
|
30
|
+
return this.core.formatResultDetails(...args);
|
|
31
|
+
}
|
|
32
|
+
async applyAutoFixes(...args) {
|
|
33
|
+
return proxy(await this.core.applyAutoFixes(...args));
|
|
34
|
+
}
|
|
35
|
+
async disablePerLine(...args) {
|
|
36
|
+
return proxy(await this.core.disablePerLine(...args));
|
|
37
|
+
}
|
|
38
|
+
async disablePerFile(...args) {
|
|
39
|
+
return proxy(await this.core.disablePerFile(...args));
|
|
40
|
+
}
|
|
41
|
+
async convertErrorToWarningPerFile(...args) {
|
|
42
|
+
return proxy(await this.core.convertErrorToWarningPerFile(...args));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
46
|
+
expose(SerializableCore, nodeEndpoint(parentPort));
|
|
47
|
+
//# 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,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,YAAY,MAAM,mCAAmC,CAA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D,CAAC;IACD,KAAK,CAAC,4BAA4B,CAChC,GAAG,IAAsD;QAEzD,OAAO,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,4BAA4B,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IACtE,CAAC;CACF;AAED,8DAA8D;AAC9D,MAAM,CAAC,gBAAgB,EAAG,YAAoB,CAAC,UAAU,CAAC,CAAC,CAAC"}
|
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { ESLint } from 'eslint';
|
|
2
|
+
import type { DescriptionPosition } from './cli/prompt.js';
|
|
3
|
+
import type { FixableMaker, SuggestionFilter } from './fix/index.js';
|
|
4
|
+
import type { Config } from './type.js';
|
|
5
|
+
export type Undo = () => Promise<void>;
|
|
6
|
+
/**
|
|
7
|
+
* The core of eslint-interactive.
|
|
8
|
+
* It uses ESLint's Node.js API to output a summary of problems, fix problems, apply suggestions, etc.
|
|
9
|
+
*/
|
|
10
|
+
export declare class Core {
|
|
11
|
+
#private;
|
|
12
|
+
constructor(config: Config);
|
|
13
|
+
/**
|
|
14
|
+
* Lint project.
|
|
15
|
+
* @returns The results of linting
|
|
16
|
+
*/
|
|
17
|
+
lint(): Promise<ESLint.LintResult[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Returns summary of lint results.
|
|
20
|
+
* @param results The lint results of the project to print summary
|
|
21
|
+
*/
|
|
22
|
+
formatResultSummary(results: ESLint.LintResult[]): string;
|
|
23
|
+
/**
|
|
24
|
+
* Returns ruleIds from lint results, sorted according to the configured sort options.
|
|
25
|
+
* @param results The lint results of the project
|
|
26
|
+
*/
|
|
27
|
+
getSortedRuleIdsInResults(results: ESLint.LintResult[]): string[];
|
|
28
|
+
/**
|
|
29
|
+
* Returns details of lint results.
|
|
30
|
+
* @param results The lint results of the project to print summary
|
|
31
|
+
* @param ruleIds The rule ids to print details
|
|
32
|
+
*/
|
|
33
|
+
formatResultDetails(results: ESLint.LintResult[], ruleIds: (string | null)[]): Promise<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Run `eslint --fix`.
|
|
36
|
+
* @param ruleIds The rule ids to fix
|
|
37
|
+
*/
|
|
38
|
+
applyAutoFixes(results: ESLint.LintResult[], ruleIds: string[]): Promise<Undo>;
|
|
39
|
+
/**
|
|
40
|
+
* Add disable comments per line.
|
|
41
|
+
* @param results The lint results of the project to add disable comments
|
|
42
|
+
* @param ruleIds The rule ids to add disable comments
|
|
43
|
+
* @param description The description of the disable comments
|
|
44
|
+
* @param descriptionPosition The position of the description
|
|
45
|
+
*/
|
|
46
|
+
disablePerLine(results: ESLint.LintResult[], ruleIds: string[], description?: string, descriptionPosition?: DescriptionPosition): Promise<Undo>;
|
|
47
|
+
/**
|
|
48
|
+
* Add disable comments per file.
|
|
49
|
+
* @param results The lint results of the project to add disable comments
|
|
50
|
+
* @param ruleIds The rule ids to add disable comments
|
|
51
|
+
* @param description The description of the disable comments
|
|
52
|
+
* @param descriptionPosition The position of the description
|
|
53
|
+
*/
|
|
54
|
+
disablePerFile(results: ESLint.LintResult[], ruleIds: string[], description?: string, descriptionPosition?: DescriptionPosition): Promise<Undo>;
|
|
55
|
+
/**
|
|
56
|
+
* Convert error to warning per file.
|
|
57
|
+
* @param results The lint results of the project to convert
|
|
58
|
+
* @param ruleIds The rule ids to convert
|
|
59
|
+
* @param description The comment explaining the reason for converting
|
|
60
|
+
*/
|
|
61
|
+
convertErrorToWarningPerFile(results: ESLint.LintResult[], ruleIds: string[], description?: string): Promise<Undo>;
|
|
62
|
+
/**
|
|
63
|
+
* Apply suggestions.
|
|
64
|
+
* @param results The lint results of the project to apply suggestions
|
|
65
|
+
* @param ruleIds The rule ids to apply suggestions
|
|
66
|
+
* @param filter The script to filter suggestions
|
|
67
|
+
*/
|
|
68
|
+
applySuggestions(results: ESLint.LintResult[], ruleIds: string[], filter: SuggestionFilter): Promise<Undo>;
|
|
69
|
+
/**
|
|
70
|
+
* Make forcibly fixable and run `eslint --fix`.
|
|
71
|
+
* @param results The lint results of the project to apply suggestions
|
|
72
|
+
* @param ruleIds The rule ids to apply suggestions
|
|
73
|
+
* @param fixableMaker The function to make `Linter.LintMessage` forcibly fixable.
|
|
74
|
+
*/
|
|
75
|
+
makeFixableAndFix(results: ESLint.LintResult[], ruleIds: string[], fixableMaker: FixableMaker): Promise<Undo>;
|
|
76
|
+
/**
|
|
77
|
+
* Fix source codes.
|
|
78
|
+
* @param fix The fix information to do.
|
|
79
|
+
*/
|
|
80
|
+
private fix;
|
|
81
|
+
}
|
|
82
|
+
//# 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;AAChC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAc,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAYjF,OAAO,KAAK,EAAE,MAAM,EAAwB,MAAM,WAAW,CAAC;AAe9D,MAAM,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvC;;;GAGG;AACH,qBAAa,IAAI;;gBASH,MAAM,EAAE,MAAM;IA6B1B;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;IAM1C;;;OAGG;IACH,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,GAAG,MAAM;IAKzD;;;OAGG;IACH,yBAAyB,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,GAAG,MAAM,EAAE;IAQjE;;;;OAIG;IACG,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAKpG;;;OAGG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpF;;;;;;OAMG;IACG,cAAc,CAClB,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,EAC5B,OAAO,EAAE,MAAM,EAAE,EACjB,WAAW,CAAC,EAAE,MAAM,EACpB,mBAAmB,CAAC,EAAE,mBAAmB,GACxC,OAAO,CAAC,IAAI,CAAC;IAMhB;;;;;;OAMG;IACG,cAAc,CAClB,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,EAC5B,OAAO,EAAE,MAAM,EAAE,EACjB,WAAW,CAAC,EAAE,MAAM,EACpB,mBAAmB,CAAC,EAAE,mBAAmB,GACxC,OAAO,CAAC,IAAI,CAAC;IAMhB;;;;;OAKG;IACG,4BAA4B,CAChC,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,EAC5B,OAAO,EAAE,MAAM,EAAE,EACjB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC;IAIhB;;;;;OAKG;IACG,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhH;;;;;OAKG;IACG,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;CA2BlB"}
|
package/dist/core.js
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _Core_cwd, _Core_patterns, _Core_quiet, _Core_formatterName, _Core_sort, _Core_sortOrder, _Core_eslint;
|
|
13
|
+
import { writeFile } from 'node:fs/promises';
|
|
14
|
+
import { ESLint } from 'eslint';
|
|
15
|
+
import { createFixToApplyAutoFixes, createFixToApplySuggestions, createFixToConvertErrorToWarningPerFile, createFixToDisablePerFile, createFixToDisablePerLine, createFixToMakeFixableAndFix, verifyAndFix, } from './fix/index.js';
|
|
16
|
+
import { format, sortRuleStatistics, takeRuleStatistics } from './formatter/index.js';
|
|
17
|
+
import { plugin } from './plugin.js';
|
|
18
|
+
import { filterResultsByRuleId } from './util/eslint.js';
|
|
19
|
+
/**
|
|
20
|
+
* Generate results to undo.
|
|
21
|
+
* @param resultsOfLint The results of lint.
|
|
22
|
+
* @returns The results to undo.
|
|
23
|
+
*/
|
|
24
|
+
function generateResultsToUndo(resultsOfLint) {
|
|
25
|
+
return resultsOfLint.map((resultOfLint) => {
|
|
26
|
+
// NOTE: THIS IS HACK.
|
|
27
|
+
return { ...resultOfLint, output: resultOfLint.source };
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The core of eslint-interactive.
|
|
32
|
+
* It uses ESLint's Node.js API to output a summary of problems, fix problems, apply suggestions, etc.
|
|
33
|
+
*/
|
|
34
|
+
export class Core {
|
|
35
|
+
constructor(config) {
|
|
36
|
+
_Core_cwd.set(this, void 0);
|
|
37
|
+
_Core_patterns.set(this, void 0);
|
|
38
|
+
_Core_quiet.set(this, void 0);
|
|
39
|
+
_Core_formatterName.set(this, void 0);
|
|
40
|
+
_Core_sort.set(this, void 0);
|
|
41
|
+
_Core_sortOrder.set(this, void 0);
|
|
42
|
+
_Core_eslint.set(this, void 0);
|
|
43
|
+
__classPrivateFieldSet(this, _Core_cwd, config.cwd ?? process.cwd(), "f");
|
|
44
|
+
__classPrivateFieldSet(this, _Core_patterns, config.patterns, "f");
|
|
45
|
+
__classPrivateFieldSet(this, _Core_quiet, config.quiet ?? false, "f");
|
|
46
|
+
__classPrivateFieldSet(this, _Core_formatterName, config.formatterName, "f");
|
|
47
|
+
__classPrivateFieldSet(this, _Core_sort, config.sort, "f");
|
|
48
|
+
__classPrivateFieldSet(this, _Core_sortOrder, config.sortOrder, "f");
|
|
49
|
+
// NOTE: Passing an option that does not exist to `new ESLint(...)` will throw an error.
|
|
50
|
+
// Therefore, only options supported by ESLint are extracted into the `eslintOptions` variable.
|
|
51
|
+
const { formatterName, patterns, quiet, sort, sortOrder, ...eslintOptions } = config;
|
|
52
|
+
const overrideConfigs = Array.isArray(eslintOptions.overrideConfig) ? eslintOptions.overrideConfig
|
|
53
|
+
: eslintOptions.overrideConfig ? [eslintOptions.overrideConfig]
|
|
54
|
+
: [];
|
|
55
|
+
__classPrivateFieldSet(this, _Core_eslint, new ESLint({
|
|
56
|
+
...eslintOptions,
|
|
57
|
+
overrideConfig: [
|
|
58
|
+
...overrideConfigs,
|
|
59
|
+
{
|
|
60
|
+
plugins: { 'eslint-interactive': plugin },
|
|
61
|
+
rules: {
|
|
62
|
+
'eslint-interactive/source-code-snatcher': 'error',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
}), "f");
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Lint project.
|
|
70
|
+
* @returns The results of linting
|
|
71
|
+
*/
|
|
72
|
+
async lint() {
|
|
73
|
+
let results = await __classPrivateFieldGet(this, _Core_eslint, "f").lintFiles(__classPrivateFieldGet(this, _Core_patterns, "f"));
|
|
74
|
+
if (__classPrivateFieldGet(this, _Core_quiet, "f"))
|
|
75
|
+
results = ESLint.getErrorResults(results);
|
|
76
|
+
return results;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Returns summary of lint results.
|
|
80
|
+
* @param results The lint results of the project to print summary
|
|
81
|
+
*/
|
|
82
|
+
formatResultSummary(results) {
|
|
83
|
+
const rulesMeta = __classPrivateFieldGet(this, _Core_eslint, "f").getRulesMetaForResults(results);
|
|
84
|
+
return format(results, { rulesMeta, cwd: __classPrivateFieldGet(this, _Core_cwd, "f") }, { sort: __classPrivateFieldGet(this, _Core_sort, "f"), sortOrder: __classPrivateFieldGet(this, _Core_sortOrder, "f") });
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Returns ruleIds from lint results, sorted according to the configured sort options.
|
|
88
|
+
* @param results The lint results of the project
|
|
89
|
+
*/
|
|
90
|
+
getSortedRuleIdsInResults(results) {
|
|
91
|
+
let ruleStatistics = takeRuleStatistics(results);
|
|
92
|
+
if (__classPrivateFieldGet(this, _Core_sort, "f")) {
|
|
93
|
+
ruleStatistics = sortRuleStatistics(ruleStatistics, __classPrivateFieldGet(this, _Core_sort, "f"), __classPrivateFieldGet(this, _Core_sortOrder, "f"));
|
|
94
|
+
}
|
|
95
|
+
return ruleStatistics.map((s) => s.ruleId);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Returns details of lint results.
|
|
99
|
+
* @param results The lint results of the project to print summary
|
|
100
|
+
* @param ruleIds The rule ids to print details
|
|
101
|
+
*/
|
|
102
|
+
async formatResultDetails(results, ruleIds) {
|
|
103
|
+
const formatter = await __classPrivateFieldGet(this, _Core_eslint, "f").loadFormatter(__classPrivateFieldGet(this, _Core_formatterName, "f"));
|
|
104
|
+
return formatter.format(filterResultsByRuleId(results, ruleIds));
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Run `eslint --fix`.
|
|
108
|
+
* @param ruleIds The rule ids to fix
|
|
109
|
+
*/
|
|
110
|
+
async applyAutoFixes(results, ruleIds) {
|
|
111
|
+
return this.fix(results, ruleIds, (context) => createFixToApplyAutoFixes(context, {}));
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Add disable comments per line.
|
|
115
|
+
* @param results The lint results of the project to add disable comments
|
|
116
|
+
* @param ruleIds The rule ids to add disable comments
|
|
117
|
+
* @param description The description of the disable comments
|
|
118
|
+
* @param descriptionPosition The position of the description
|
|
119
|
+
*/
|
|
120
|
+
async disablePerLine(results, ruleIds, description, descriptionPosition) {
|
|
121
|
+
return this.fix(results, ruleIds, (context) => createFixToDisablePerLine(context, { description, descriptionPosition }));
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Add disable comments per file.
|
|
125
|
+
* @param results The lint results of the project to add disable comments
|
|
126
|
+
* @param ruleIds The rule ids to add disable comments
|
|
127
|
+
* @param description The description of the disable comments
|
|
128
|
+
* @param descriptionPosition The position of the description
|
|
129
|
+
*/
|
|
130
|
+
async disablePerFile(results, ruleIds, description, descriptionPosition) {
|
|
131
|
+
return this.fix(results, ruleIds, (context) => createFixToDisablePerFile(context, { description, descriptionPosition }));
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Convert error to warning per file.
|
|
135
|
+
* @param results The lint results of the project to convert
|
|
136
|
+
* @param ruleIds The rule ids to convert
|
|
137
|
+
* @param description The comment explaining the reason for converting
|
|
138
|
+
*/
|
|
139
|
+
async convertErrorToWarningPerFile(results, ruleIds, description) {
|
|
140
|
+
return this.fix(results, ruleIds, (context) => createFixToConvertErrorToWarningPerFile(context, { description }));
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Apply suggestions.
|
|
144
|
+
* @param results The lint results of the project to apply suggestions
|
|
145
|
+
* @param ruleIds The rule ids to apply suggestions
|
|
146
|
+
* @param filter The script to filter suggestions
|
|
147
|
+
*/
|
|
148
|
+
async applySuggestions(results, ruleIds, filter) {
|
|
149
|
+
return this.fix(results, ruleIds, (context) => createFixToApplySuggestions(context, { filter }));
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Make forcibly fixable and run `eslint --fix`.
|
|
153
|
+
* @param results The lint results of the project to apply suggestions
|
|
154
|
+
* @param ruleIds The rule ids to apply suggestions
|
|
155
|
+
* @param fixableMaker The function to make `Linter.LintMessage` forcibly fixable.
|
|
156
|
+
*/
|
|
157
|
+
async makeFixableAndFix(results, ruleIds, fixableMaker) {
|
|
158
|
+
return this.fix(results, ruleIds, (context) => createFixToMakeFixableAndFix(context, { fixableMaker }));
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Fix source codes.
|
|
162
|
+
* @param fix The fix information to do.
|
|
163
|
+
*/
|
|
164
|
+
async fix(resultsOfLint, ruleIds, fixCreator) {
|
|
165
|
+
// NOTE: Extract only necessary results and files for performance
|
|
166
|
+
const filteredResultsOfLint = filterResultsByRuleId(resultsOfLint, ruleIds);
|
|
167
|
+
// eslint-disable-next-line prefer-const
|
|
168
|
+
for (let { filePath, source } of filteredResultsOfLint) {
|
|
169
|
+
if (!source)
|
|
170
|
+
throw new Error('Source code is required to apply fixes.');
|
|
171
|
+
// eslint-disable-next-line no-await-in-loop
|
|
172
|
+
const fixedResult = await verifyAndFix(__classPrivateFieldGet(this, _Core_eslint, "f"), source, filePath, ruleIds, fixCreator);
|
|
173
|
+
// Write the fixed source code to the file
|
|
174
|
+
if (fixedResult.fixed) {
|
|
175
|
+
// eslint-disable-next-line no-await-in-loop
|
|
176
|
+
await writeFile(filePath, fixedResult.output);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return async () => {
|
|
180
|
+
const resultsToUndo = generateResultsToUndo(filteredResultsOfLint);
|
|
181
|
+
await ESLint.outputFixes(resultsToUndo);
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
_Core_cwd = new WeakMap(), _Core_patterns = new WeakMap(), _Core_quiet = new WeakMap(), _Core_formatterName = new WeakMap(), _Core_sort = new WeakMap(), _Core_sortOrder = new WeakMap(), _Core_eslint = new WeakMap();
|
|
186
|
+
//# sourceMappingURL=core.js.map
|
package/dist/core.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EACL,yBAAyB,EACzB,2BAA2B,EAC3B,uCAAuC,EACvC,yBAAyB,EACzB,yBAAyB,EACzB,4BAA4B,EAC5B,YAAY,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD;;;;GAIG;AACH,SAAS,qBAAqB,CAAC,aAAkC;IAC/D,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE;QACxC,sBAAsB;QACtB,OAAO,EAAE,GAAG,YAAY,EAAE,MAAM,EAAE,YAAY,CAAC,MAAM,EAAE,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC;AAID;;;GAGG;AACH,MAAM,OAAO,IAAI;IASf,YAAY,MAAc;QARjB,4BAAa;QACb,iCAAoB;QACpB,8BAAgB;QAChB,sCAAmC;QACnC,6BAA6B;QAC7B,kCAAkC;QAClC,+BAAgB;QAGvB,u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AE,YAAY,EAAE,CAAC,CAAC,CAAC;IAC1G,CAAC;IAED;;;OAGG;IACK,KAAK,CAAC,GAAG,CACf,aAAkC,EAClC,OAAiB,EACjB,UAA+C;QAE/C,iEAAiE;QACjE,MAAM,qBAAqB,GAAG,qBAAqB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QAE5E,wCAAwC;QACxC,KAAK,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,qBAAqB,EAAE,CAAC;YACvD,IAAI,CAAC,MAAM;gBAAE,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;YAExE,4CAA4C;YAC5C,MAAM,WAAW,GAAG,MAAM,YAAY,CAAC,uBAAA,IAAI,oBAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;YAE5F,0CAA0C;YAC1C,IAAI,WAAW,CAAC,KAAK,EAAE,CAAC;gBACtB,4CAA4C;gBAC5C,MAAM,SAAS,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;YAChD,CAAC;QACH,CAAC;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,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Main Linter Class
|
|
3
|
+
* @author Gyandeep Singh
|
|
4
|
+
* @author aladdin-add
|
|
5
|
+
*/
|
|
6
|
+
import type { ESLint, Rule } from 'eslint';
|
|
7
|
+
import type { FixContext } from '../fix/index.js';
|
|
8
|
+
type FixedResult = {
|
|
9
|
+
fixed: boolean;
|
|
10
|
+
output: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Performs multiple autofix passes over the text until as many fixes as possible have been applied.
|
|
14
|
+
* @param linter
|
|
15
|
+
*/
|
|
16
|
+
export declare function verifyAndFix(eslint: ESLint, text: string, filePath: string, ruleIds: string[], fixCreator: (context: FixContext) => Rule.Fix[]): Promise<FixedResult>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=linter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../../src/eslint/linter.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAOlD,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;GAGG;AAEH,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EAAE,EACjB,UAAU,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK,IAAI,CAAC,GAAG,EAAE,GAC9C,OAAO,CAAC,WAAW,CAAC,CAuEtB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// forked from: https://github.com/eslint/eslint/blob/d191bdd67214c33e65bd605e616ca7cc947fd045/lib/linter/linter.js
|
|
2
|
+
// I wanted a customized `linter.verifyAndFix`, so I forked the original `linter.verifyAndFix`.
|
|
3
|
+
import { getLastSourceCode } from '../plugin.js';
|
|
4
|
+
import { ruleFixer } from './rule-fixer.js';
|
|
5
|
+
import { SourceCodeFixer } from './source-code-fixer.js';
|
|
6
|
+
const MAX_AUTOFIX_PASSES = 10;
|
|
7
|
+
/**
|
|
8
|
+
* Performs multiple autofix passes over the text until as many fixes as possible have been applied.
|
|
9
|
+
* @param linter
|
|
10
|
+
*/
|
|
11
|
+
export async function verifyAndFix(eslint, text, filePath, ruleIds, fixCreator) {
|
|
12
|
+
let fixedResult;
|
|
13
|
+
let fixed = false;
|
|
14
|
+
let passNumber = 0;
|
|
15
|
+
let currentText = text;
|
|
16
|
+
/**
|
|
17
|
+
* This loop continues until one of the following is true:
|
|
18
|
+
*
|
|
19
|
+
* 1. No more fixes have been applied.
|
|
20
|
+
* 2. Ten passes have been made.
|
|
21
|
+
*
|
|
22
|
+
* That means anytime a fix is successfully applied, there will be another pass.
|
|
23
|
+
* Essentially, guaranteeing a minimum of two passes.
|
|
24
|
+
*/
|
|
25
|
+
do {
|
|
26
|
+
passNumber++;
|
|
27
|
+
// eslint-disable-next-line no-await-in-loop
|
|
28
|
+
const results = await eslint.lintText(currentText, { filePath });
|
|
29
|
+
const messages = results
|
|
30
|
+
.flatMap((result) => result.messages)
|
|
31
|
+
.filter((message) => message.ruleId && ruleIds.includes(message.ruleId));
|
|
32
|
+
const sourceCode = getLastSourceCode();
|
|
33
|
+
if (!sourceCode)
|
|
34
|
+
throw new Error('Failed to get the last source code.');
|
|
35
|
+
// Create `Rule.Fix[]`
|
|
36
|
+
const fixContext = {
|
|
37
|
+
filename: filePath,
|
|
38
|
+
sourceCode,
|
|
39
|
+
messages,
|
|
40
|
+
ruleIds,
|
|
41
|
+
fixer: ruleFixer,
|
|
42
|
+
};
|
|
43
|
+
const fixes = fixCreator(fixContext);
|
|
44
|
+
fixedResult = SourceCodeFixer.applyFixes(currentText, fixes.map((fix) => {
|
|
45
|
+
return {
|
|
46
|
+
ruleId: 'eslint-interactive/fix',
|
|
47
|
+
severity: 2,
|
|
48
|
+
message: 'fix',
|
|
49
|
+
line: 0,
|
|
50
|
+
column: 0,
|
|
51
|
+
fix,
|
|
52
|
+
};
|
|
53
|
+
}), true);
|
|
54
|
+
/**
|
|
55
|
+
* stop if there are any syntax errors.
|
|
56
|
+
* 'fixedResult.output' is a empty string.
|
|
57
|
+
*/
|
|
58
|
+
if (messages.length === 1 && messages[0] && messages[0].fatal) {
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
// keep track if any fixes were ever applied - important for return value
|
|
62
|
+
fixed = fixed || fixedResult.fixed;
|
|
63
|
+
// update to use the fixed output instead of the original text
|
|
64
|
+
currentText = fixedResult.output;
|
|
65
|
+
} while (fixedResult.fixed && passNumber < MAX_AUTOFIX_PASSES);
|
|
66
|
+
// ensure the last result properly reflects if fixes were done
|
|
67
|
+
fixedResult.fixed = fixed;
|
|
68
|
+
fixedResult.output = currentText;
|
|
69
|
+
return fixedResult;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=linter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linter.js","sourceRoot":"","sources":["../../src/eslint/linter.ts"],"names":[],"mappings":"AAAA,mHAAmH;AACnH,+FAA+F;AAU/F,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAO9B;;;GAGG;AAEH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAc,EACd,IAAY,EACZ,QAAgB,EAChB,OAAiB,EACjB,UAA+C;IAE/C,IAAI,WAAwB,CAAC;IAC7B,IAAI,KAAK,GAAG,KAAK,CAAC;IAClB,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,IAAI,WAAW,GAAG,IAAI,CAAC;IAEvB;;;;;;;;OAQG;IACH,GAAG,CAAC;QACF,UAAU,EAAE,CAAC;QAEb,4CAA4C;QAC5C,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;QACjE,MAAM,QAAQ,GAAG,OAAO;aACrB,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC;aACpC,MAAM,CA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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Rule, SourceCode } from 'eslint';
|
|
2
|
+
/**
|
|
3
|
+
* Merges the given fixes array into one.
|
|
4
|
+
* @param {Fix[]} fixes The fixes to merge.
|
|
5
|
+
* @param {SourceCode} sourceCode The source code object to get the text between fixes.
|
|
6
|
+
* @returns {{text: string, range: number[]}} The merged fixes
|
|
7
|
+
*/
|
|
8
|
+
export declare function mergeFixes(fixes: Rule.Fix[], sourceCode: SourceCode): Rule.Fix | null;
|
|
9
|
+
//# sourceMappingURL=report-translator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-translator.d.ts","sourceRoot":"","sources":["../../src/eslint/report-translator.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AA2C/C;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC,GAAG,GAAG,IAAI,CAkCrF"}
|