add Eslint option for --resolve-plugins-relative-to, fix maxWarnings 0 (#200)

* add resolvePluginsPath option, make it possible to set maxWarnings to 0

* Change files
This commit is contained in:
Andy Himberger 2019-08-07 15:08:11 -07:00 коммит произвёл Kenneth Chau
Родитель 2a79bc80c1
Коммит d4c98a4dee
2 изменённых файлов: 12 добавлений и 2 удалений

Просмотреть файл

@ -0,0 +1,8 @@
{
"comment": "add resolvePluginsPath option, make it possible to set maxWarnings to 0",
"type": "minor",
"packageName": "just-scripts",
"email": "andrewh@microsoft.com",
"commit": "986346455fe33c3ff1de70404d679cf18c60806c",
"date": "2019-08-05T18:21:26.706Z"
}

Просмотреть файл

@ -6,6 +6,7 @@ export interface EsLintTaskOptions {
files?: string[];
configPath?: string;
ignorePath?: string;
resolvePluginsPath?: string;
fix?: boolean;
extensions?: string;
noEslintRc?: boolean;
@ -14,7 +15,7 @@ export interface EsLintTaskOptions {
export function eslintTask(options: EsLintTaskOptions = {}): TaskFunction {
return function eslint() {
const { files, configPath, ignorePath, fix, extensions, noEslintRc, maxWarnings } = options;
const { files, configPath, ignorePath, fix, extensions, noEslintRc, maxWarnings, resolvePluginsPath } = options;
const eslintCmd = resolve('eslint/bin/eslint.js');
const eslintConfigPath = configPath || resolveCwd('.eslintrc');
if (eslintCmd && eslintConfigPath && fs.existsSync(eslintConfigPath)) {
@ -27,8 +28,9 @@ export function eslintTask(options: EsLintTaskOptions = {}): TaskFunction {
...(noEslintRc ? '--no-eslintrc' : []),
...(eslintConfigPath ? ['--config', eslintConfigPath] : []),
...(eslintIgnorePath ? ['--ignore-path', eslintIgnorePath] : []),
...(resolvePluginsPath ? ['--resolve-plugins-relative-to', resolvePluginsPath] : []),
...(fix ? ['--fix'] : []),
...(maxWarnings ? ['--max-warnings', `${maxWarnings}`] : []),
...(maxWarnings !== undefined ? ['--max-warnings', `${maxWarnings}`] : []),
'--color'
];