shuvi 1.0.22 → 1.0.23

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 (68) hide show
  1. package/lib/cli.js +37 -65
  2. package/lib/commands/build.d.ts +3 -0
  3. package/lib/{cmds → commands}/build.js +22 -18
  4. package/lib/commands/dev.d.ts +3 -0
  5. package/lib/{cmds → commands}/dev.js +21 -18
  6. package/lib/commands/eslint/compile-error.d.ts +2 -0
  7. package/lib/commands/eslint/compile-error.js +6 -0
  8. package/lib/commands/eslint/core/customFormatter.d.ts +26 -0
  9. package/lib/commands/eslint/core/customFormatter.js +91 -0
  10. package/lib/commands/eslint/core/hasEslintConfiguration.d.ts +9 -0
  11. package/lib/commands/eslint/core/hasEslintConfiguration.js +42 -0
  12. package/lib/commands/eslint/core/runLintCheck.d.ts +31 -0
  13. package/lib/commands/eslint/core/runLintCheck.js +300 -0
  14. package/lib/commands/eslint/core/writeDefaultConfig.d.ts +4 -0
  15. package/lib/commands/eslint/core/writeDefaultConfig.js +78 -0
  16. package/lib/commands/eslint/core/writeOutputFile.d.ts +8 -0
  17. package/lib/commands/eslint/core/writeOutputFile.js +65 -0
  18. package/lib/commands/eslint/fatal-error.d.ts +2 -0
  19. package/lib/commands/eslint/fatal-error.js +6 -0
  20. package/lib/commands/eslint/file-exists.d.ts +1 -0
  21. package/lib/commands/eslint/file-exists.js +43 -0
  22. package/lib/commands/eslint/find-pages-dir.d.ts +3 -0
  23. package/lib/commands/eslint/find-pages-dir.js +34 -0
  24. package/lib/commands/eslint/has-necessary-dependencies.d.ts +10 -0
  25. package/lib/commands/eslint/has-necessary-dependencies.js +55 -0
  26. package/lib/commands/eslint/helpers/get-npx-command.d.ts +1 -0
  27. package/lib/commands/eslint/helpers/get-npx-command.js +21 -0
  28. package/lib/commands/eslint/helpers/get-online.d.ts +1 -0
  29. package/lib/commands/eslint/helpers/get-online.js +42 -0
  30. package/lib/commands/eslint/helpers/get-pkg-manager.d.ts +2 -0
  31. package/lib/commands/eslint/helpers/get-pkg-manager.js +43 -0
  32. package/lib/commands/eslint/helpers/get-registry.d.ts +6 -0
  33. package/lib/commands/eslint/helpers/get-registry.js +26 -0
  34. package/lib/commands/eslint/helpers/install.d.ts +22 -0
  35. package/lib/commands/eslint/helpers/install.js +103 -0
  36. package/lib/commands/eslint/install-dependencies.d.ts +4 -0
  37. package/lib/commands/eslint/install-dependencies.js +38 -0
  38. package/lib/commands/eslint/is-error.d.ts +8 -0
  39. package/lib/commands/eslint/is-error.js +33 -0
  40. package/lib/commands/eslint/options.d.ts +22 -0
  41. package/lib/commands/eslint/options.js +25 -0
  42. package/lib/commands/eslint/oxford-comma-list.d.ts +1 -0
  43. package/lib/commands/eslint/oxford-comma-list.js +15 -0
  44. package/lib/commands/eslint/printAndExit.d.ts +1 -0
  45. package/lib/commands/eslint/printAndExit.js +13 -0
  46. package/lib/commands/eslint/recursive-readdir.d.ts +15 -0
  47. package/lib/commands/eslint/recursive-readdir.js +60 -0
  48. package/lib/commands/eslint/resolve-from.d.ts +1 -0
  49. package/lib/commands/eslint/resolve-from.js +49 -0
  50. package/lib/commands/inspect.d.ts +3 -0
  51. package/lib/{cmds → commands}/inspect.js +21 -21
  52. package/lib/commands/lint.d.ts +28 -0
  53. package/lib/commands/lint.js +146 -0
  54. package/lib/commands/serve.d.ts +3 -0
  55. package/lib/{cmds → commands}/serve.js +21 -18
  56. package/lib/commands/utils/options.d.ts +39 -0
  57. package/lib/commands/utils/options.js +28 -0
  58. package/lib/constants.d.ts +2 -0
  59. package/lib/constants.js +25 -0
  60. package/lib/utils.d.ts +21 -2
  61. package/lib/utils.js +28 -7
  62. package/package.json +16 -10
  63. package/lib/agent.d.ts +0 -5
  64. package/lib/agent.js +0 -24
  65. package/lib/cmds/build.d.ts +0 -1
  66. package/lib/cmds/dev.d.ts +0 -1
  67. package/lib/cmds/inspect.d.ts +0 -1
  68. package/lib/cmds/serve.d.ts +0 -1
package/lib/cli.js CHANGED
@@ -1,73 +1,45 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || function (mod) {
20
- if (mod && mod.__esModule) return mod;
21
- var result = {};
22
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
- __setModuleDefault(result, mod);
24
- return result;
25
- };
26
3
  var __importDefault = (this && this.__importDefault) || function (mod) {
27
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
28
5
  };
29
6
  Object.defineProperty(exports, "__esModule", { value: true });
30
- const commander_1 = __importDefault(require("commander"));
31
- const spawn = __importStar(require("cross-spawn"));
32
- const logger_1 = __importDefault(require("@shuvi/utils/logger"));
7
+ const commander_1 = require("commander");
8
+ const dev_1 = __importDefault(require("./commands/dev"));
9
+ const build_1 = __importDefault(require("./commands/build"));
10
+ const inspect_1 = __importDefault(require("./commands/inspect"));
11
+ const serve_1 = __importDefault(require("./commands/serve"));
12
+ const lint_1 = __importDefault(require("./commands/lint"));
13
+ const constants_1 = require("./constants");
14
+ const options_1 = require("./commands/utils/options");
33
15
  const utils_1 = require("./utils");
34
- const Commands = ['dev', 'build', 'serve', 'inspect'];
35
- const pkgInfo = (0, utils_1.getPackageInfo)();
36
- // must be before .parse()
37
- commander_1.default.on('--help', () => {
38
- logger_1.default.info('');
39
- logger_1.default.info('Avaliable cmds:');
40
- logger_1.default.info(` ${Commands.join(', ')}`);
41
- });
42
- commander_1.default.name('shuvi').version(pkgInfo.version).usage('<cmd> [options]');
43
- commander_1.default.allowUnknownOption().parse();
44
- const args = commander_1.default.args;
45
- const [cmd, ...commandArgs] = args.length ? args : ['dev'];
46
- if (!Commands.includes(cmd)) {
47
- logger_1.default.error('Unknown command "' + cmd + '".');
48
- commander_1.default.outputHelp();
49
- process.exit(1);
50
- }
51
- const nodeEnv = cmd === 'dev' ? 'development' : 'production';
52
- const result = spawn.sync('node', [
53
- require.resolve('./agent'),
54
- require.resolve('./cmds/' + cmd),
55
- ...commandArgs
56
- ], {
57
- stdio: 'inherit',
58
- env: Object.assign(Object.assign({}, process.env), { NODE_ENV: nodeEnv })
59
- });
60
- if (result.signal) {
61
- if (result.signal === 'SIGKILL') {
62
- logger_1.default.error('The build failed because the process exited too early. ' +
63
- 'This probably means the system ran out of memory or someone called ' +
64
- '`kill -9` on the process.');
65
- }
66
- else if (result.signal === 'SIGTERM') {
67
- logger_1.default.error('The build failed because the process exited too early. ' +
68
- 'Someone might have called `kill` or `killall`, or the system could ' +
69
- 'be shutting down.');
16
+ const { name, description, version } = (0, utils_1.getPackageInfo)();
17
+ const program = new commander_1.Command();
18
+ const devCommand = (0, dev_1.default)().copyInheritedSettings(program);
19
+ const buildCommand = (0, build_1.default)().copyInheritedSettings(program);
20
+ const inspectCommand = (0, inspect_1.default)().copyInheritedSettings(program);
21
+ const serveCommand = (0, serve_1.default)().copyInheritedSettings(program);
22
+ const lintCommand = (0, lint_1.default)().copyInheritedSettings(program);
23
+ program
24
+ .name(name)
25
+ .description(description)
26
+ .version(version)
27
+ .showHelpAfterError('(add --help for additional information)')
28
+ .addOption(options_1.optionNoColor)
29
+ .addCommand(devCommand)
30
+ .addCommand(buildCommand)
31
+ .addCommand(inspectCommand)
32
+ .addCommand(serveCommand)
33
+ .addCommand(lintCommand)
34
+ .usage(`[command] [dir] [options]`)
35
+ .configureHelp({
36
+ subcommandTerm: cmd => {
37
+ return `${cmd.name()} ${cmd.usage()}`;
70
38
  }
71
- process.exit(1);
72
- }
73
- process.exit(result.status);
39
+ })
40
+ .addHelpText('beforeAll', constants_1.TITLE)
41
+ .addHelpText('after', constants_1.HELPER)
42
+ .configureOutput({
43
+ outputError: (str, write) => write(utils_1.color.error(str)) // Highlight errors in color.
44
+ })
45
+ .parseAsync(process.argv);
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ declare const _default: () => Command;
3
+ export default _default;
@@ -35,13 +35,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
35
  return (mod && mod.__esModule) ? mod : { "default": mod };
36
36
  };
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
- const commander_1 = __importDefault(require("commander"));
38
+ const commander_1 = require("commander");
39
39
  const path = __importStar(require("path"));
40
40
  const logger_1 = __importDefault(require("@shuvi/utils/logger"));
41
41
  const build_1 = require("../tasks/build");
42
42
  const utils_1 = require("../utils");
43
43
  const config_1 = require("../config");
44
- const pkgInfo = (0, utils_1.getPackageInfo)();
44
+ const options_1 = require("./utils/options");
45
45
  const cliConfigMap = {
46
46
  analyze: 'analyze',
47
47
  publicPath: 'publicPath',
@@ -52,22 +52,27 @@ const cliConfigMap = {
52
52
  }
53
53
  }
54
54
  };
55
- function main(argv) {
55
+ exports.default = () => {
56
+ const subCommand = new commander_1.Command('build');
57
+ subCommand
58
+ .usage(`[dir] [options]`)
59
+ .description('build your project')
60
+ .addArgument(options_1.argumentDir)
61
+ .addOption(options_1.optionPublicPath)
62
+ .addOption(options_1.optionTarget)
63
+ .addOption(options_1.optionRouterHistory)
64
+ .addOption(options_1.optionAnalyze)
65
+ .addOption(options_1.optionConfig)
66
+ .addOption(options_1.optionOverrides)
67
+ .action(buildAction);
68
+ return subCommand;
69
+ };
70
+ function buildAction(dir, options) {
56
71
  return __awaiter(this, void 0, void 0, function* () {
57
- commander_1.default
58
- .name(pkgInfo.name)
59
- .usage(`build [dir] [options]`)
60
- .helpOption()
61
- .option('--public-path <url>', 'specify the asset prefix. eg: https://some.cdn.com')
62
- .option('--target <target>', 'specify the app output target. eg: spa')
63
- .option('--router-history <history>', "specify the hisotry type. 'browser' or 'hash'")
64
- .option('--analyze', 'generate html file to help analyze webpack bundle')
65
- .option('--config <file>', 'path to config file')
66
- .option('--config-overrides <json>', 'config overrides json')
67
- .parse(argv, { from: 'user' });
68
- const cwd = (0, utils_1.getProjectDir)(commander_1.default);
69
- const configFile = commander_1.default.config && path.resolve(cwd, commander_1.default.config);
70
- const config = yield (0, config_1.getConfigFromCli)(commander_1.default, cliConfigMap);
72
+ process.env.NODE_ENV = 'production';
73
+ const cwd = (0, utils_1.getProjectDir)(dir);
74
+ const configFile = options.config && path.resolve(cwd, options.config);
75
+ const config = yield (0, config_1.getConfigFromCli)(options, cliConfigMap);
71
76
  try {
72
77
  yield (0, build_1.build)({
73
78
  cwd,
@@ -83,4 +88,3 @@ function main(argv) {
83
88
  }
84
89
  });
85
90
  }
86
- exports.default = main;
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ declare const _default: () => Command;
3
+ export default _default;
@@ -35,31 +35,35 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
35
  return (mod && mod.__esModule) ? mod : { "default": mod };
36
36
  };
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
- const commander_1 = __importDefault(require("commander"));
38
+ const commander_1 = require("commander");
39
39
  const path = __importStar(require("path"));
40
40
  const service_1 = require("@shuvi/service");
41
41
  const logger_1 = __importDefault(require("@shuvi/utils/logger"));
42
42
  const utils_1 = require("../utils");
43
43
  const config_1 = require("../config");
44
44
  const shuvi_1 = require("../shuvi");
45
- function main(argv) {
45
+ const options_1 = require("./utils/options");
46
+ exports.default = () => {
47
+ const subCommand = new commander_1.Command('dev');
48
+ subCommand
49
+ .usage(`[dir] [options]`)
50
+ .description('run your project locally in development')
51
+ .addArgument(options_1.argumentDir)
52
+ .addOption(options_1.optionHostDev)
53
+ .addOption(options_1.optionPort)
54
+ .addOption(options_1.optionConfig)
55
+ .addOption(options_1.optionOverrides)
56
+ .action(devAction);
57
+ return subCommand;
58
+ };
59
+ function devAction(dir, options) {
46
60
  return __awaiter(this, void 0, void 0, function* () {
61
+ process.env.NODE_ENV = 'development';
47
62
  const startTime = performance.now();
48
- const pkgInfo = (0, utils_1.getPackageInfo)();
49
- commander_1.default
50
- .name(pkgInfo.name)
51
- .usage(`dev [dir] [options]`)
52
- .helpOption()
53
- .option('--host <host>', 'specify host')
54
- .option('--port <port>', 'specify port')
55
- .option('--config <file>', 'path to config file')
56
- .option('--config-overrides <json>', 'config overrides json')
57
- .parse(argv, { from: 'user' });
58
- const cwd = (0, utils_1.getProjectDir)(commander_1.default);
59
- const port = Number(commander_1.default.port) || 3000;
60
- const host = commander_1.default.host || 'localhost';
61
- const configFile = commander_1.default.config && path.resolve(cwd, commander_1.default.config);
62
- const config = yield (0, config_1.getConfigFromCli)(commander_1.default);
63
+ const cwd = (0, utils_1.getProjectDir)(dir);
64
+ const { host, port } = options;
65
+ const configFile = options.config && path.resolve(cwd, options.config);
66
+ const config = yield (0, config_1.getConfigFromCli)(options);
63
67
  const api = yield (0, shuvi_1.initShuvi)({
64
68
  cwd,
65
69
  config,
@@ -93,4 +97,3 @@ function main(argv) {
93
97
  }
94
98
  });
95
99
  }
96
- exports.default = main;
@@ -0,0 +1,2 @@
1
+ export declare class CompileError extends Error {
2
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CompileError = void 0;
4
+ class CompileError extends Error {
5
+ }
6
+ exports.CompileError = CompileError;
@@ -0,0 +1,26 @@
1
+ export declare enum MessageSeverity {
2
+ Warning = 1,
3
+ Error = 2
4
+ }
5
+ interface LintMessage {
6
+ ruleId: string | null;
7
+ severity: 1 | 2;
8
+ message: string;
9
+ line: number;
10
+ column: number;
11
+ }
12
+ export interface LintResult {
13
+ filePath: string;
14
+ messages: LintMessage[];
15
+ errorCount: number;
16
+ warningCount: number;
17
+ output?: string;
18
+ source?: string;
19
+ }
20
+ export declare function formatResults(baseDir: string, results: LintResult[], format: (r: LintResult[]) => string): {
21
+ output: string;
22
+ outputWithMessages: string;
23
+ totalShuviPluginErrorCount: number;
24
+ totalShuviPluginWarningCount: number;
25
+ };
26
+ export {};
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.formatResults = exports.MessageSeverity = void 0;
7
+ /* eslint-disable prefer-template */
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ const path_1 = __importDefault(require("path"));
10
+ // eslint-disable-next-line no-shadow
11
+ var MessageSeverity;
12
+ (function (MessageSeverity) {
13
+ MessageSeverity[MessageSeverity["Warning"] = 1] = "Warning";
14
+ MessageSeverity[MessageSeverity["Error"] = 2] = "Error";
15
+ })(MessageSeverity = exports.MessageSeverity || (exports.MessageSeverity = {}));
16
+ function pluginCount(messages) {
17
+ let pluginWarningCount = 0;
18
+ let pluginErrorCount = 0;
19
+ for (let i = 0; i < messages.length; i++) {
20
+ const { severity, ruleId } = messages[i];
21
+ if (ruleId === null || ruleId === void 0 ? void 0 : ruleId.includes('@shuvi/shuvi')) {
22
+ if (severity === MessageSeverity.Warning) {
23
+ pluginWarningCount += 1;
24
+ }
25
+ else {
26
+ pluginErrorCount += 1;
27
+ }
28
+ }
29
+ }
30
+ return {
31
+ pluginErrorCount,
32
+ pluginWarningCount
33
+ };
34
+ }
35
+ function formatMessage(dir, messages, filePath) {
36
+ let fileName = path_1.default.posix.normalize(path_1.default.relative(dir, filePath).replace(/\\/g, '/'));
37
+ if (!fileName.startsWith('.')) {
38
+ fileName = './' + fileName;
39
+ }
40
+ let output = '\n' + chalk_1.default.cyan(fileName);
41
+ for (let i = 0; i < messages.length; i++) {
42
+ const { message, severity, line, column, ruleId } = messages[i];
43
+ output = output + '\n';
44
+ if (line && column) {
45
+ output =
46
+ output +
47
+ chalk_1.default.yellow(line.toString()) +
48
+ ':' +
49
+ chalk_1.default.yellow(column.toString()) +
50
+ ' ';
51
+ }
52
+ if (severity === MessageSeverity.Warning) {
53
+ output += chalk_1.default.yellow.bold('Warning') + ': ';
54
+ }
55
+ else {
56
+ output += chalk_1.default.red.bold('Error') + ': ';
57
+ }
58
+ output += message;
59
+ if (ruleId) {
60
+ output += ' ' + chalk_1.default.gray.bold(ruleId);
61
+ }
62
+ }
63
+ return output;
64
+ }
65
+ function formatResults(baseDir, results, format) {
66
+ let totalShuviPluginErrorCount = 0;
67
+ let totalShuviPluginWarningCount = 0;
68
+ let resultsWithMessages = results.filter(({ messages }) => messages === null || messages === void 0 ? void 0 : messages.length);
69
+ // Track number of shuvi.js plugin errors and warnings
70
+ resultsWithMessages.forEach(({ messages }) => {
71
+ const res = pluginCount(messages);
72
+ totalShuviPluginErrorCount += res.pluginErrorCount;
73
+ totalShuviPluginWarningCount += res.pluginWarningCount;
74
+ });
75
+ // Use user defined formatter or Shuvi.js's built-in custom formatter
76
+ const output = format
77
+ ? format(resultsWithMessages)
78
+ : resultsWithMessages
79
+ .map(({ messages, filePath }) => formatMessage(baseDir, messages, filePath))
80
+ .join('\n');
81
+ return {
82
+ output: output,
83
+ outputWithMessages: resultsWithMessages.length > 0
84
+ ? output +
85
+ `\n\n${chalk_1.default.cyan('info')} - Need to disable some ESLint rules?`
86
+ : '',
87
+ totalShuviPluginErrorCount,
88
+ totalShuviPluginWarningCount
89
+ };
90
+ }
91
+ exports.formatResults = formatResults;
@@ -0,0 +1,9 @@
1
+ export declare type ConfigAvailable = {
2
+ exists: boolean;
3
+ emptyEslintrc?: boolean;
4
+ emptyPkgJsonConfig?: boolean;
5
+ firstTimeSetup?: true;
6
+ };
7
+ export declare function hasEslintConfiguration(eslintrcFile: string | null, packageJsonConfig: {
8
+ eslintConfig: any;
9
+ } | null): Promise<ConfigAvailable>;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.hasEslintConfiguration = void 0;
13
+ const fs_1 = require("fs");
14
+ function hasEslintConfiguration(eslintrcFile,
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
+ packageJsonConfig) {
17
+ return __awaiter(this, void 0, void 0, function* () {
18
+ const configObject = {
19
+ exists: false,
20
+ emptyEslintrc: false,
21
+ emptyPkgJsonConfig: false
22
+ };
23
+ if (eslintrcFile) {
24
+ const content = yield fs_1.promises.readFile(eslintrcFile, { encoding: 'utf8' }).then(txt => txt.trim().replace(/\n/g, ''), () => null);
25
+ if (content === '' ||
26
+ content === '{}' ||
27
+ content === '---' ||
28
+ content === 'module.exports = {}') {
29
+ return Object.assign(Object.assign({}, configObject), { emptyEslintrc: true });
30
+ }
31
+ return Object.assign(Object.assign({}, configObject), { exists: true });
32
+ }
33
+ else if (packageJsonConfig === null || packageJsonConfig === void 0 ? void 0 : packageJsonConfig.eslintConfig) {
34
+ if (Object.keys(packageJsonConfig === null || packageJsonConfig === void 0 ? void 0 : packageJsonConfig.eslintConfig).length) {
35
+ return Object.assign(Object.assign({}, configObject), { exists: true });
36
+ }
37
+ return Object.assign(Object.assign({}, configObject), { emptyPkgJsonConfig: true });
38
+ }
39
+ return configObject;
40
+ });
41
+ }
42
+ exports.hasEslintConfiguration = hasEslintConfiguration;
@@ -0,0 +1,31 @@
1
+ export declare const ESLINT_PROMPT_VALUES: ({
2
+ title: string;
3
+ config: {
4
+ extends: string;
5
+ };
6
+ } | {
7
+ title: string;
8
+ config: null;
9
+ })[];
10
+ declare function lint(baseDir: string, lintDirs: string[], eslintrcFile: string | null, pkgJsonPath: string | null, { lintDuringBuild, eslintOptions, reportErrorsOnly, maxWarnings, formatter, outputFile }: {
11
+ lintDuringBuild: boolean;
12
+ eslintOptions: any;
13
+ reportErrorsOnly: boolean;
14
+ maxWarnings: number;
15
+ formatter: string | null;
16
+ outputFile: string | null;
17
+ }): Promise<string | null | {
18
+ output: string | null;
19
+ isError: boolean;
20
+ eventInfo: any;
21
+ }>;
22
+ export declare function runLintCheck(baseDir: string, lintDirs: string[], opts: {
23
+ lintDuringBuild?: boolean;
24
+ eslintOptions?: any;
25
+ reportErrorsOnly?: boolean;
26
+ maxWarnings?: number;
27
+ formatter?: string | null;
28
+ outputFile?: string | null;
29
+ strict?: boolean;
30
+ }): ReturnType<typeof lint>;
31
+ export {};