@toreda/build-tools
Version:

70 lines (69 loc) • 4.41 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConfigLinter = void 0;
class ConfigLinter {
constructor(o) {
this.quiet = typeof (o === null || o === void 0 ? void 0 : o.quiet) === 'boolean' ? o === null || o === void 0 ? void 0 : o.quiet : false;
this.autofix = typeof (o === null || o === void 0 ? void 0 : o.autofix) === 'boolean' ? o === null || o === void 0 ? void 0 : o.autofix : false;
this.cwd = typeof (o === null || o === void 0 ? void 0 : o.cwd) === 'string' ? o === null || o === void 0 ? void 0 : o.cwd : undefined;
this.allowInlineConfig = typeof (o === null || o === void 0 ? void 0 : o.allowInlineConfig) === 'boolean' ? o === null || o === void 0 ? void 0 : o.allowInlineConfig : false;
this.useEslintrc = typeof (o === null || o === void 0 ? void 0 : o.useEslintrc) === 'boolean' ? o === null || o === void 0 ? void 0 : o.useEslintrc : true;
this.cache = typeof (o === null || o === void 0 ? void 0 : o.cache) === 'boolean' ? o === null || o === void 0 ? void 0 : o.cache : false;
this.globInputPaths = typeof (o === null || o === void 0 ? void 0 : o.globInputPaths) === 'boolean' ? o === null || o === void 0 ? void 0 : o.globInputPaths : undefined;
this.ignorePath = typeof (o === null || o === void 0 ? void 0 : o.ignorePath) === 'string' ? o === null || o === void 0 ? void 0 : o.ignorePath : undefined;
this.extensions = Array.isArray(o === null || o === void 0 ? void 0 : o.extensions) ? o === null || o === void 0 ? void 0 : o.extensions : undefined;
this.cacheLocation = typeof (o === null || o === void 0 ? void 0 : o.cacheLocation) === 'string' ? o === null || o === void 0 ? void 0 : o.cacheLocation : undefined;
this.fixTypes = Array.isArray(o === null || o === void 0 ? void 0 : o.fixTypes) ? o === null || o === void 0 ? void 0 : o.fixTypes : undefined;
this.rulePaths = Array.isArray(o === null || o === void 0 ? void 0 : o.rulePaths) ? o === null || o === void 0 ? void 0 : o.rulePaths : undefined;
this.resolvePluginsRelativeTo =
typeof (o === null || o === void 0 ? void 0 : o.resolvePluginsRelativeTo) === 'string' ? o === null || o === void 0 ? void 0 : o.resolvePluginsRelativeTo : undefined;
this.plugins = this.mkPlugins(o === null || o === void 0 ? void 0 : o.plugins);
this.baseConfig = this.mkConfig(o === null || o === void 0 ? void 0 : o.baseConfig);
this.overrideConfig = this.mkConfig(o === null || o === void 0 ? void 0 : o.overrideConfig);
this.cacheStrategy =
(o === null || o === void 0 ? void 0 : o.cacheStrategy) === 'content' || (o === null || o === void 0 ? void 0 : o.cacheStrategy) === 'metadata' ? o === null || o === void 0 ? void 0 : o.cacheStrategy : undefined;
this.overrideConfigFile =
typeof (o === null || o === void 0 ? void 0 : o.overrideConfigFile) === 'string' ? o === null || o === void 0 ? void 0 : o.overrideConfigFile : undefined;
this.ignore = typeof (o === null || o === void 0 ? void 0 : o.ignore) === 'boolean' ? o === null || o === void 0 ? void 0 : o.ignore : false;
this.reportUnusedDisableDirectives =
typeof (o === null || o === void 0 ? void 0 : o.reportUnusedDisableDirectives) === 'boolean'
? o === null || o === void 0 ? void 0 : o.reportUnusedDisableDirectives
: undefined;
}
mkConfig(o) {
if (!o) {
return undefined;
}
if (Array.isArray(o) || typeof o !== 'object') {
return undefined;
}
return o;
}
mkPlugins(o) {
if (!o) {
return undefined;
}
if (Array.isArray(o)) {
return undefined;
}
if (typeof o !== 'object') {
return undefined;
}
return o;
}
eslintOptions() {
return {
cwd: this.cwd,
globInputPaths: this.globInputPaths,
cache: this.cache,
cacheStrategy: this.cacheStrategy,
allowInlineConfig: this.allowInlineConfig,
useEslintrc: this.useEslintrc,
ignorePath: this.ignorePath,
extensions: this.extensions,
cacheLocation: this.cacheLocation,
fixTypes: this.fixTypes
};
}
}
exports.ConfigLinter = ConfigLinter;