{"version":3,"file":"cli.js","names":[],"sources":["../../../src/checkers/eslint/cli.ts"],"sourcesContent":["/* eslint-disable */\n\n/**\n * This file is directly copied from https://github.com/eslint/eslint/blob/6f940c3ce715327f282c197d0f71b91848e5d83d/lib/cli.js\n *\n * Usually, developer rarely use JS programming API to run ESLint. So we let\n * developers to write their own ESLint commands just like in CI or lint-staged.\n * And the config will be translated and pass to `new ESLint(translatedOptions)`.\n * So in build mode, it's the same as the command you pass in.\n * In dev mode, some flag will be ignored (such as `max-warnings`) because it\n * will be only respected in ESLint CLI.\n */\n\nfunction quietFixPredicate(message: { severity: number }) {\n return message.severity === 2\n}\n\n/**\n * Translate parsed CLI options to ESLint legacy (eslintrc) API options.\n * This is the original translateOptions from ESLint's CLI, used for\n * ESLint v9 in legacy eslintrc mode.\n */\nfunction translateOptionsLegacy({\n cache,\n cacheFile,\n cacheLocation,\n cacheStrategy,\n config,\n env,\n errorOnUnmatchedPattern,\n eslintrc,\n ext,\n fix,\n fixDryRun,\n fixType,\n global,\n ignore,\n ignorePath,\n ignorePattern,\n inlineConfig,\n parser,\n parserOptions,\n plugin,\n quiet,\n reportUnusedDisableDirectives,\n resolvePluginsRelativeTo,\n rule,\n rulesdir,\n}: any) {\n return {\n allowInlineConfig: inlineConfig,\n cache,\n cacheLocation: cacheLocation || cacheFile,\n cacheStrategy,\n errorOnUnmatchedPattern,\n extensions: ext,\n fix: (fix || fixDryRun) && (quiet ? quietFixPredicate : true),\n fixTypes: fixType,\n ignore,\n ignorePath,\n overrideConfig: {\n env:\n // @ts-expect-error\n env?.reduce((obj, name) => {\n obj[name] = true\n return obj\n }, {}),\n // @ts-expect-error\n globals: global?.reduce((obj, name) => {\n if (name.endsWith(':true')) {\n obj[name.slice(0, -5)] = 'writable'\n } else {\n obj[name] = 'readonly'\n }\n return obj\n }, {}),\n ignorePatterns: ignorePattern,\n parser,\n parserOptions,\n plugins: plugin,\n rules: rule,\n },\n overrideConfigFile: config,\n reportUnusedDisableDirectives: reportUnusedDisableDirectives\n ? 'error'\n : void 0,\n resolvePluginsRelativeTo,\n rulePaths: rulesdir,\n useEslintrc: eslintrc,\n }\n}\n\n/**\n * Translate parsed CLI options to ESLint flat config API options (v9 flat / v10+).\n */\nfunction translateOptionsFlatConfig({\n cache,\n cacheFile,\n cacheLocation,\n cacheStrategy,\n config,\n errorOnUnmatchedPattern,\n fix,\n fixDryRun,\n fixType,\n global,\n ignore,\n ignorePattern,\n inlineConfig,\n parser,\n parserOptions,\n plugin,\n quiet,\n rule,\n}: any) {\n const languageOptions: any = {\n globals:\n global?.reduce((obj: Record, name: string) => {\n if (name.endsWith(':true')) {\n obj[name.slice(0, -5)] = 'writable'\n } else {\n obj[name] = 'readonly'\n }\n return obj\n }, {}) || {},\n }\n if (parser) languageOptions.parser = parser\n if (parserOptions) languageOptions.parserOptions = parserOptions\n\n const overrideConfig: any = {\n languageOptions,\n ignores: ignorePattern || [],\n rules: rule || {},\n }\n if (plugin) overrideConfig.plugins = plugin\n\n return {\n allowInlineConfig: inlineConfig,\n cache,\n cacheLocation: cacheLocation || cacheFile,\n cacheStrategy,\n errorOnUnmatchedPattern,\n fix: (fix || fixDryRun) && (quiet ? quietFixPredicate : true),\n fixTypes: fixType,\n ignore,\n overrideConfig,\n overrideConfigFile: config,\n }\n}\n\n/**\n * Translate parsed CLI options, choosing the appropriate format based on\n * whether flat config mode is being used.\n */\nexport function translateOptions(options: any, useFlatConfig = true) {\n if (useFlatConfig) {\n return translateOptionsFlatConfig(options)\n }\n return translateOptionsLegacy(options)\n}\n"],"mappings":";;;;;;;;;;;AAaA,SAAS,kBAAkB,SAA+B;CACxD,OAAO,QAAQ,aAAa;AAC9B;;;;;;AAOA,SAAS,uBAAuB,EAC9B,OACA,WACA,eACA,eACA,QACA,KACA,yBACA,UACA,KACA,KACA,WACA,SACA,QACA,QACA,YACA,eACA,cACA,QACA,eACA,QACA,OACA,+BACA,0BACA,MACA,YACM;CACN,OAAO;EACL,mBAAmB;EACnB;EACA,eAAe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