{"version":3,"sources":["../../../src/checkers/stylelint/options.ts"],"sourcesContent":["/* eslint-disable */\n\n/**\n * This file is copied and modified from https://github.com/stylelint/stylelint/blob/97ea6f7446b861fd8940f69e90b41fa9ab1fffb5/lib/cli.js\n *\n */\n\n'use strict'\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport meow from 'meow'\nimport type Stylelint from 'stylelint'\nimport { parseArgsStringToArgv } from './argv.js'\n\n//------------------------------------------------------------------------------\n// Typedefs\n//------------------------------------------------------------------------------\n\n/**\n * @typedef {object} CLIFlags\n * @property {boolean} [cache]\n * @property {string} [cacheLocation]\n * @property {string | false} config\n * @property {string} [configBasedir]\n * @property {string} [customSyntax]\n * @property {string} [printConfig]\n * @property {string} [color]\n * @property {string} [customFormatter]\n * @property {boolean} [disableDefaultIgnores]\n * @property {boolean} [fix]\n * @property {string} [formatter=\"json\"]\n * @property {string} [help]\n * @property {boolean} [ignoreDisables]\n * @property {string} [ignorePath]\n * @property {string[]} [ignorePattern]\n * @property {string} [noColor]\n * @property {string} [outputFile]\n * @property {boolean} [stdin]\n * @property {string} [stdinFilename]\n * @property {boolean} [reportNeedlessDisables]\n * @property {boolean} [reportInvalidScopeDisables]\n * @property {boolean} [reportDescriptionlessDisables]\n * @property {number} [maxWarnings]\n * @property {boolean} quiet\n * @property {string} [syntax]\n * @property {string} [version]\n * @property {boolean} [allowEmptyInput]\n */\n\n/**\n * @typedef {object} CLIOptions\n * @property {any} input\n * @property {any} help\n * @property {any} pkg\n * @property {Function} showHelp\n * @property {Function} showVersion\n * @property {CLIFlags} flags\n */\n\n/**\n * @typedef {object} OptionBaseType\n * @property {any} formatter\n * @property {boolean} [cache]\n * @property {string} [configFile]\n * @property {string} [cacheLocation]\n * @property {string} [customSyntax]\n * @property {string} [codeFilename]\n * @property {string} [configBasedir]\n * @property {boolean} [quiet]\n * @property {any} [printConfig]\n * @property {boolean} [fix]\n * @property {boolean} [ignoreDisables]\n * @property {any} [ignorePath]\n * @property {string} [outputFile]\n * @property {boolean} [reportNeedlessDisables]\n * @property {boolean} [reportInvalidScopeDisables]\n * @property {boolean} [reportDescriptionlessDisables]\n * @property {boolean} [disableDefaultIgnores]\n * @property {number} [maxWarnings]\n * @property {string} [syntax]\n * @property {string[]} [ignorePattern]\n * @property {boolean} [allowEmptyInput]\n * @property {string} [files]\n * @property {string} [code]\n */\n\n//------------------------------------------------------------------------------\n// Initialization and Public Interface\n//------------------------------------------------------------------------------\n\nconst EXIT_CODE_ERROR = 2\n\nexport const translateOptions = async (command: string) => {\n const result = meow({\n autoHelp: false,\n autoVersion: false,\n importMeta: import.meta,\n help: `\n Usage: stylelint [input] [options]\n Input: Files(s), glob(s), or nothing to use stdin.\n If an input argument is wrapped in quotation marks, it will be passed to\n globby for cross-platform glob support. node_modules are always ignored.\n You can also pass no input and use stdin, instead.\n Options:\n --config\n Path to a specific configuration file (JSON, YAML, or CommonJS), or the\n name of a module in node_modules that points to one. If no --config\n argument is provided, stylelint will search for configuration files in\n the following places, in this order:\n - a stylelint property in package.json\n - a .stylelintrc file (with or without filename extension:\n .json, .yaml, .yml, and .js are available)\n - a stylelint.config.js file exporting a JS object\n The search will begin in the working directory and move up the directory\n tree until a configuration file is found.\n --config-basedir\n An absolute path to the directory that relative paths defining \"extends\"\n and \"plugins\" are *relative to*. Only necessary if these values are\n relative paths.\n --print-config\n Print the configuration for the given path.\n --ignore-path, -i\n Path to a file containing patterns that describe files to ignore. The\n path can be absolute or relative to process.cwd(). By default, stylelint\n looks for .stylelintignore in process.cwd().\n --ignore-pattern, --ip\n Pattern of files to ignore (in addition to those in .stylelintignore)\n --fix\n Automatically fix problems of certain rules.\n --custom-syntax\n Module name or path to a JS file exporting a PostCSS-compatible syntax.\n --stdin\n Accept stdin input even if it is empty.\n --stdin-filename\n A filename to assign stdin input.\n --ignore-disables, --id\n Ignore stylelint-disable comments.\n --disable-default-ignores, --di\n Allow linting of node_modules.\n --cache [default: false]\n Store the info about processed files in order to only operate on the\n changed ones the next time you run stylelint. By default, the cache\n is stored in \"./.stylelintcache\". To adjust this, use --cache-location.\n --cache-location [default: '.stylelintcache']\n Path to a file or directory to be used for the cache location.\n Default is \"./.stylelintcache\". If a directory is specified, a cache\n file will be created inside the specified folder, with a name derived\n from a hash of the current working directory.\n If the directory for the cache does not exist, make sure you add a trailing \"/\"\n on *nix systems or \"\\\\\" on Windows. Otherwise the path will be assumed to be a file.\n --formatter, -f [default: \"string\"]\n The output formatter: \"compact\", \"json\", \"tap\", \"unix\" or \"verbose\"\n --custom-formatter\n Path to a JS file exporting a custom formatting function.\n --quiet, -q\n Only register problems for rules with an \"error\"-level severity (ignore\n \"warning\"-level).\n --color\n --no-color\n Force enabling/disabling of color.\n --report-needless-disables, --rd\n Also report errors for stylelint-disable comments that are not blocking a lint warning.\n The process will exit with code ${EXIT_CODE_ERROR} if needless disables are found.\n --report-invalid-scope-disables, --risd\n Report stylelint-disable comments that used for rules that don't exist within the configuration object.\n The process will exit with code ${EXIT_CODE_ERROR} if invalid scope disables are found.\n --report-descriptionless-disables, --rdd\n Report stylelint-disable comments without a description.\n The process will exit with code ${EXIT_CODE_ERROR} if descriptionless disables are found.\n --max-warnings, --mw\n Number of warnings above which the process will exit with code ${EXIT_CODE_ERROR}.\n Useful when setting \"defaultSeverity\" to \"warning\" and expecting the\n process to fail on warnings (e.g. CI build).\n --output-file, -o\n Path of file to write report.\n --version, -v\n Show the currently installed version of stylelint.\n --allow-empty-input, --aei\n When glob pattern matches no files, the process will exit without throwing an error.\n\t`,\n flags: {\n allowEmptyInput: {\n shortFlag: 'aei',\n type: 'boolean',\n },\n cache: {\n type: 'boolean',\n },\n cacheLocation: {\n type: 'string',\n },\n cacheStrategy: {\n type: 'string',\n },\n color: {\n type: 'boolean',\n },\n config: {\n type: 'string',\n },\n configBasedir: {\n type: 'string',\n },\n customFormatter: {\n type: 'string',\n },\n customSyntax: {\n type: 'string',\n },\n disableDefaultIgnores: {\n shortFlag: 'di',\n type: 'boolean',\n },\n fix: {\n type: 'boolean',\n },\n formatter: {\n shortFlag: 'f',\n default: 'string',\n type: 'string',\n },\n help: {\n shortFlag: 'h',\n type: 'boolean',\n },\n ignoreDisables: {\n shortFlag: 'id',\n type: 'boolean',\n },\n ignorePath: {\n shortFlag: 'i',\n type: 'string',\n isMultiple: true,\n },\n ignorePattern: {\n shortFlag: 'ip',\n type: 'string',\n isMultiple: true,\n },\n maxWarnings: {\n shortFlag: 'mw',\n type: 'number',\n },\n outputFile: {\n shortFlag: 'o',\n type: 'string',\n },\n printConfig: {\n type: 'boolean',\n },\n quiet: {\n shortFlag: 'q',\n type: 'boolean',\n },\n reportDescriptionlessDisables: {\n shortFlag: 'rdd',\n type: 'boolean',\n },\n reportInvalidScopeDisables: {\n shortFlag: 'risd',\n type: 'boolean',\n },\n reportNeedlessDisables: {\n shortFlag: 'rd',\n type: 'boolean',\n },\n stdin: {\n type: 'boolean',\n },\n stdinFilename: {\n type: 'string',\n },\n version: {\n shortFlag: 'v',\n type: 'boolean',\n },\n globbyOptions: {\n shortFlag: 'go',\n type: 'string',\n },\n },\n argv: parseArgsStringToArgv(command),\n })\n\n const optionsBase = {\n ...Object.fromEntries(\n Object.entries(result.flags).filter(([key]) =>\n [\n 'files',\n 'globbyOptions',\n 'cache',\n 'cacheLocation',\n 'code',\n 'codeFilename',\n 'config',\n 'configFile',\n 'configBasedir',\n 'cwd',\n 'ignoreDisables',\n 'ignorePath',\n 'ignorePattern',\n 'reportDescriptionlessDisables',\n 'reportNeedlessDisables',\n 'reportInvalidScopeDisables',\n 'maxWarnings',\n 'customSyntax',\n 'formatter',\n 'disableDefaultIgnores',\n 'fix',\n 'allowEmptyInput',\n 'quiet',\n ].includes(key)\n )\n ),\n formatter: result.flags.formatter === 'string' ? 'json' : result.flags.formatter,\n files: result.input[1],\n } as Stylelint.LinterOptions\n\n return optionsBase\n}\n"],"mappings":"AAaA,OAAO,UAAU;AAEjB,SAAS,6BAA6B;AA8EtC,MAAM,kBAAkB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