Skip to content

Commit

Permalink
feat(eslint): Set complexity
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewMi11er committed Feb 18, 2018
1 parent 249972d commit fa3211b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const ERROR = 2;
const rules = {
'no-param-reassign': [ERROR, { props: false }],
'valid-jsdoc': [ERROR],
complexity: [ERROR, 6],
};

if (extendedConfigs.plugins.includes('optimize-regex')) {
Expand Down
20 changes: 7 additions & 13 deletions lib/extendedConfigs.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,15 @@ const extendedConfigs = {
plugins: [],
};

optionalConfigs.forEach(element => {
if ('name' in element && !isInstalled(element.name, 'config')) {
return;
}
optionalConfigs.forEach(({ name, plugins = [] }) => {
const localName = [name].filter(Boolean);

if (
'plugins' in element &&
!element.plugins.every(plugin => isInstalled(plugin, 'plugin'))
localName.every(config => isInstalled(config, 'config')) &&
plugins.every(plugin => isInstalled(plugin, 'plugin'))
) {
return;
}
if ('name' in element) {
extendedConfigs.extends.push(element.name);
}
if ('plugins' in element) {
extendedConfigs.plugins.push(...element.plugins);
extendedConfigs.extends.push(...localName);
extendedConfigs.plugins.push(...plugins);
}
});

Expand Down

0 comments on commit fa3211b

Please sign in to comment.