Fix strapi-helper-lint

This commit is contained in:
cyril lopez 2018-06-21 15:28:49 +02:00
parent 0b1241300c
commit 48a2afe6bd
2 changed files with 6 additions and 5 deletions

View File

@ -76,7 +76,6 @@
"class-methods-use-this": 0,
"react/forbid-prop-types": 0,
"react/react-in-jsx-scope": 0,
"react/forbid-prop-types": 0,
"react/jsx-first-prop-new-line": [
2,
"multiline"

View File

@ -6,7 +6,7 @@ const glob = require('glob');
const fs = require('fs');
const listChangedFiles = require('../packages/strapi-lint/lib/internals/shared/listChangedFiles.js');
const changedFiles = listChangedFiles();
const { take } = require('lodash');
const { includes, take } = require('lodash');
const frontCmd =
'node ../../node_modules/strapi-lint/node_modules/.bin/eslint --ignore-path .gitignore --ignore-pattern \'/admin/build/\' --config ../../node_modules/strapi-lint/lib/internals/eslint/front/.eslintrc.json admin';
@ -19,7 +19,8 @@ const backCmd =
const watcher = (label, pckgName, type = 'front') => {
shell.echo(label);
shell.cd(pckgName);
const cmd = pckgName === 'strapi-helper-plugin' ? helperCmd : `${frontCmd} && ${backCmd}`;
const cmd = includes(pckgName, 'strapi-helper-plugin') ? helperCmd : `${frontCmd} && ${backCmd}`;
const data = shell.exec(cmd, { silent: true });
shell.echo(chalk(eslintErrorsFormatter(data.stdout)));
shell.cd('../..');
@ -34,7 +35,7 @@ const files = glob
.sync('**/*.js', { ignore: '**/node_modules/**' })
.filter(f => changedFiles.has(f))
.filter(
package =>
package =>
!package.includes('README.md') &&
!package.includes('strapi-middleware-views') &&
!package.includes('strapi-lint') &&
@ -49,8 +50,9 @@ const files = glob
return take(directoryArray, toTake).join('/');
});
files
.filter((directory, index) => files.indexOf(directory) === index)
.forEach(package => {
watcher(`Testing ${package}`, package);
});
});