Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
option: 'clear',
type: 'Boolean',
description: 'Clear terminal when running lint',
},
{
option: 'esw-version',
type: 'Boolean',
description: "Prints Eslint-Watch's Version",
},
];
const eslintOptions = getOptions();
const newOptions = _.union(myOptions, eslintOptions);
settings.options = newOptions;
export default optionator(settings);
import { basename, dirname, extname, join, relative, resolve } from 'path'
import { log, logError } from './logger'
import compile from './compile'
import compose from 'cumpa'
import glob from 'glob'
import help from './help'
import optionatorFactory from 'optionator'
import options from './options'
import pkg from '../package.json'
import { statSync } from 'fs'
import watch from './watch'
const optionator = optionatorFactory(options)
const isJsFilePath = path => path.slice(-3) === '.js'
/**
* Map the user options to valid rollup options
* @param {string} input - source file path
* @param {string} userInputPath - path provided by the user
* @param {Object} options - user options
* @returns {Object} RollupOptions object
*/
export function mapOptions(input, userInputPath, options) {
const componentName = basename(input, extname(input))
return {
input,
sourcemap: options.sourcemap,
watch: options.watch,
createOptions(eswOptions, eslintOptions = []) {
const mergedOptions = unionwith(eswOptions, eslintOptions, areEqual);
logger.debug(mergedOptions);
const opsor = optionator({ ...settings, options: mergedOptions });
return {
helpText: opsor.generateHelp(),
parse(rawArgs) {
const options = opsor.parse(rawArgs, { slice: 0 });
const dirs = options._;
if (dirs.length === 0) {
dirs.push(path.resolve('.'));
}
options._ = dirs;
return options;
},
};