Skip to content

Commit 7e7ba2f

Browse files
committed
Create our own isExcluded check
1 parent 908ea96 commit 7e7ba2f

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ const PluginError = require('plugin-error');
44
const Lesshint = require('lesshint').Lesshint;
55
const through = require('through2');
66

7+
const { isExcluded } = require('./utils');
8+
79
const lesshintPlugin = (options = {}) => {
810
const lesshint = new Lesshint();
911
const config = lesshint.getConfig(options.configPath);
@@ -23,7 +25,7 @@ const lesshintPlugin = (options = {}) => {
2325
return cb(new PluginError('gulp-lesshint', 'Streaming not supported'));
2426
}
2527

26-
if (file.isNull() || lesshint.isExcluded(file.path)) {
28+
if (file.isNull() || isExcluded(config, file.path)) {
2729
return cb(null, file);
2830
}
2931

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@
2727
"index.js"
2828
],
2929
"dependencies": {
30-
"lesshint": "^5.0.0",
30+
"lesshint": "^5.1.0",
3131
"lesshint-reporter-stylish": "^3.0.0",
32+
"minimatch": "^3.0.4",
3233
"plugin-error": "^1.0.0",
3334
"through2": "^2.0.0"
3435
},

utils.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'use strict';
2+
3+
const minimatch = require('minimatch');
4+
5+
module.exports = {
6+
isExcluded (config, checkPath) {
7+
const excludedFiles = config && config.excludedFiles || [];
8+
9+
return excludedFiles.some((pattern) => {
10+
return minimatch(checkPath, pattern, {
11+
matchBase: true,
12+
});
13+
});
14+
},
15+
};

0 commit comments

Comments
 (0)