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E,MAAM,CAAC;IAC5C,SAAgB,6BAA6B,CAAC,EAAE,OAAO,CAAC;gBAE5C,CAAC,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC;IA6B/B,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;IAY1D,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;IAgB3D,aAAa,IAAI,MAAM,CAAC,OAAO;CActC","file":"linter.d.ts","sourcesContent":["/**\n *\tMIT License\n *\n *\tCopyright (c) 2019 - 2022 Toreda, Inc.\n *\n *\tPermission is hereby granted, free of charge, to any person obtaining a copy\n *\tof this software and associated documentation files (the \"Software\"), to deal\n *\tin the Software without restriction, including without limitation the rights\n *\tto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n *\tcopies of the Software, and to permit persons to whom the Software is\n *\tfurnished to do so, subject to the following conditions:\n\n * \tThe above copyright notice and this permission notice shall be included in all\n * \tcopies or substantial portions of the Software.\n *\n * \tTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n *\tIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n *\tFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * \tAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n *\tLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n *\tOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * \tSOFTWARE.\n *\n */\n\nimport {ESLint, Linter, Rule} from 'eslint';\n\nimport type {BaseObject} from '@toreda/types';\nimport type {LinterOptions} from '../linter/options';\n\n/**\n * Managed config data for a single linter execution.\n *\n * @category Linter\n */\nexport class ConfigLinter {\n\tpublic readonly quiet: boolean;\n\tpublic readonly autofix: boolean;\n\tpublic readonly cwd?: string;\n\tpublic readonly allowInlineConfig: boolean;\n\tpublic readonly useEslintrc?: boolean;\n\tpublic readonly cache: boolean;\n\tpublic readonly cacheStrategy?: 'content' | 'metadata';\n\tpublic readonly cacheLocation?: string;\n\tpublic readonly globInputPaths?: boolean;\n\tpublic readonly ignore?: boolean;\n\tpublic readonly ignorePath?: string;\n\tpublic readonly extensions?: string[];\n\tpublic readonly fix?: boolean | ((message: Linter.LintMessage) => boolean);\n\tpublic readonly fixTypes?: Array<Rule.RuleMetaData['type']>;\n\tpublic readonly rulePaths?: string[];\n\tpublic readonly resolvePluginsRelativeTo?: string;\n\tpublic readonly plugins?: Record<string, unknown>;\n\tpublic readonly baseConfig?: Linter.Config;\n\tpublic readonly overrideConfig?: Linter.Config;\n\tpublic readonly overrideConfigFile?: string;\n\tpublic readonly reportUnusedDisableDirectives?: boolean;\n\n\tconstructor(o?: Partial<LinterOptions>) {\n\t\tthis.quiet = typeof o?.quiet === 'boolean' ? o?.quiet : false;\n\t\tthis.autofix = typeof o?.autofix === 'boolean' ? o?.autofix : false;\n\t\tthis.cwd = typeof o?.cwd === 'string' ? o?.cwd : undefined;\n\t\tthis.allowInlineConfig = typeof o?.allowInlineConfig === 'boolean' ? o?.allowInlineConfig : false;\n\t\tthis.useEslintrc = typeof o?.useEslintrc === 'boolean' ? o?.useEslintrc : true;\n\t\tthis.cache = typeof o?.cache === 'boolean' ? o?.cache : false;\n\t\tthis.globInputPaths = typeof o?.globInputPaths === 'boolean' ? o?.globInputPaths : undefined;\n\t\tthis.ignorePath = typeof o?.ignorePath === 'string' ? o?.ignorePath : undefined;\n\t\tthis.extensions = Array.isArray(o?.extensions) ? o?.extensions : undefined;\n\t\tthis.cacheLocation = typeof o?.cacheLocation === 'string' ? o?.cacheLocation : undefined;\n\t\tthis.fixTypes = Array.isArray(o?.fixTypes) ? o?.fixTypes : undefined;\n\t\tthis.rulePaths = Array.isArray(o?.rulePaths) ? o?.rulePaths : undefined;\n\t\tthis.resolvePluginsRelativeTo =\n\t\t\ttypeof o?.resolvePluginsRelativeTo === 'string' ? o?.resolvePluginsRelativeTo : undefined;\n\t\tthis.plugins = this.mkPlugins(o?.plugins);\n\t\tthis.baseConfig = this.mkConfig(o?.baseConfig);\n\t\tthis.overrideConfig = this.mkConfig(o?.overrideConfig);\n\t\tthis.cacheStrategy =\n\t\t\to?.cacheStrategy === 'content' || o?.cacheStrategy === 'metadata' ? o?.cacheStrategy : undefined;\n\t\tthis.overrideConfigFile =\n\t\t\ttypeof o?.overrideConfigFile === 'string' ? o?.overrideConfigFile : undefined;\n\t\tthis.ignore = typeof o?.ignore === 'boolean' ? o?.ignore : false;\n\t\tthis.reportUnusedDisableDirectives =\n\t\t\ttypeof o?.reportUnusedDisableDirectives === 'boolean'\n\t\t\t\t? o?.reportUnusedDisableDirectives\n\t\t\t\t: undefined;\n\t}\n\n\tpublic mkConfig(o?: unknown): Record<string, unknown> | undefined {\n\t\tif (!o) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (Array.isArray(o) || typeof o !== 'object') {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn o as BaseObject;\n\t}\n\n\tpublic mkPlugins(o?: unknown): Record<string, unknown> | undefined {\n\t\tif (!o) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (Array.isArray(o)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (typeof o !== 'object') {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn o as BaseObject;\n\t}\n\n\tpublic eslintOptions(): ESLint.Options {\n\t\treturn {\n\t\t\tcwd: this.cwd,\n\t\t\tglobInputPaths: this.globInputPaths,\n\t\t\tcache: this.cache,\n\t\t\tcacheStrategy: this.cacheStrategy,\n\t\t\tallowInlineConfig: this.allowInlineConfig,\n\t\t\tuseEslintrc: this.useEslintrc,\n\t\t\tignorePath: this.ignorePath,\n\t\t\textensions: this.extensions,\n\t\t\tcacheLocation: this.cacheLocation,\n\t\t\tfixTypes: this.fixTypes\n\t\t};\n\t}\n}\n"]}