Skip to content
This repository has been archived by the owner on Oct 4, 2020. It is now read-only.

Support dot files #106

Merged
merged 1 commit into from
Nov 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/cli.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ describe('eclint cli', function() {
describe('check', () => {
it('All Files', () => {
return eclint(['check']).then(files => {
files = files.map(file => file.path);
expect(files).to.have.length.above(10);
expect(files).that.include(path.resolve(__dirname, '../.gitignore'));
});
});
it('Directories', () => {
Expand Down Expand Up @@ -109,6 +111,15 @@ describe('eclint cli', function() {
expect(files).have.lengthOf(0);
});
});
it('error of gulp-exclude-gitignore', () => {
return expect(() => {
eclint(['check', '/etc/hosts'], {
'gulp-exclude-gitignore': () => {
throw new Error('test: gulp-exclude-gitignore mock');
}
});
}).throws('test: gulp-exclude-gitignore mock');
});
});
describe('infer', function() {

Expand Down Expand Up @@ -142,6 +153,7 @@ describe('eclint cli', function() {
});
});
});

describe('fix', function() {
it('README.md', () => {
eclint(['fix', 'README.md']).then(files => {
Expand Down
18 changes: 10 additions & 8 deletions lib/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import _ = require('lodash');
import tap = require('gulp-tap');
import vfs = require('vinyl-fs');
import eclint = require('./eclint');
import excludeGitignore = require('gulp-exclude-gitignore');
import yargs = require('yargs');
import reporter = require('gulp-reporter');
import filter = require('gulp-filter');
Expand All @@ -13,15 +14,15 @@ import i18n = require('./i18n');
import path = require('path');
import fs = require('fs');

/*
* bugfix for thomas-lebeau/gulp-gitignore#2
*/
function gitignore(): Stream {
const stream = require('gulp-gitignore')();
if (stream instanceof Stream) {
return stream;
} else {
return gutil.noop();
try {
return excludeGitignore();
} catch (ex) {
if (ex.code === 'ENOENT') {
return gutil.noop();
} else {
throw ex;
}
}
}

Expand Down Expand Up @@ -191,6 +192,7 @@ function handler(yargs: Argv): Stream.Transform {
globs = globs.concat(ignore);
yargs.globs = globs;
return vfs.src(globs, {
dot: true,
stripBOM: false,
removeBOM: false,
})
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eclint",
"version": "2.4.3",
"version": "2.5.0",
"description": "Validate or fix code that doesn't adhere to EditorConfig settings or infer settings from existing code.",
"keywords": [
"editorconfig",
Expand Down Expand Up @@ -62,8 +62,8 @@
"dependencies": {
"editorconfig": "^0.15.0",
"file-type": "^7.2.0",
"gulp-exclude-gitignore": "^1.2.0",
"gulp-filter": "^5.0.1",
"gulp-gitignore": "^0.1.0",
"gulp-reporter": "^2.4.2",
"gulp-tap": "^1.0.1",
"gulp-util": "^3.0.8",
Expand Down