Skip to content

Commit

Permalink
fix: enforce posix delimiter on all gitignore filtered paths
Browse files Browse the repository at this point in the history
  • Loading branch information
marionebl committed Apr 3, 2017
1 parent 3a15763 commit 9bdc40a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions index.js
Expand Up @@ -5,7 +5,6 @@ const globby = require('globby');
const isEqual = require('lodash.isequal');
const multimatch = require('multimatch');
const arrify = require('arrify');
const slash = require('slash');
const optionsManager = require('./options-manager');

exports.lintText = (str, opts) => {
Expand All @@ -31,7 +30,7 @@ exports.lintText = (str, opts) => {
if (opts.filename) {
const filename = path.relative(opts.cwd, opts.filename);
const isIgnored = multimatch(filename, opts.ignores).length > 0;
const isGitIgnored = !optionsManager.getGitIgnoreFilter(opts)(slash(opts.filename));
const isGitIgnored = !optionsManager.getGitIgnoreFilter(opts)(opts.filename);

if (isIgnored || isGitIgnored) {
return {
Expand Down Expand Up @@ -62,6 +61,7 @@ exports.lintFiles = (patterns, opts) => {
return globby(patterns, {ignore: opts.ignores, nodir: true}).then(paths => {
// Filter out unwanted file extensions
// for silly users that don't specify an extension in the glob pattern

paths = paths
.filter(ignoreFilter)
.filter(x => {
Expand Down
2 changes: 1 addition & 1 deletion options-manager.js
Expand Up @@ -255,7 +255,7 @@ const getGitIgnoreFilter = opts => {
i.add(lines)
});

return p => !i.ignores(path.relative(opts.cwd, p));
return p => !i.ignores(slash(path.relative(opts.cwd, p)));
}

const preprocess = opts => {
Expand Down

0 comments on commit 9bdc40a

Please sign in to comment.