Skip to content

Commit

Permalink
fix(filter): filter files correctly when no exclude is given
Browse files Browse the repository at this point in the history
This is currently a quickfix and should be reworked later

closes #18
  • Loading branch information
mstruebing committed Dec 18, 2017
1 parent 7ceadca commit b35a8db
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/utils/exclude-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,35 @@ const getDefaultExcludes = () => {
];
};

// Quickfix for this issue
// https://github.com/editorconfig-checker/editorconfig-checker.javascript/issues/18
const getDefaultExcludesRegexp = () => {
return [
'vendor',
'node_modules',
'coverage/',
'.DS_Store/',
'.git/',
'.gif',
'.png',
'.bmp',
'.jpg',
'.svg',
'.ico',
'.lock',
'.eot',
'.woff',
'.woff2',
'.ttf',
'.bak',
'.bin',
'.min.js',
'.min.css',
'.pdf',
'.jpeg'
];
};

const getExcludePatternFromArgs = args => {
const excludesArray = [];

Expand All @@ -45,6 +74,10 @@ const getExcludeRegexpFromArgs = args => {
excludesArray.push(args['exclude-regexp']);
}

if (!args['ignore-defaults']) {
excludesArray.push(getDefaultExcludesRegexp());
}

const excludeString = []
.concat.apply([], excludesArray)
.join('|');
Expand Down

0 comments on commit b35a8db

Please sign in to comment.