diff options
author | Markus Doits <markus.doits@stellenticket.de> | 2016-07-25 14:36:23 +0200 |
---|---|---|
committer | Markus Doits <markus.doits@stellenticket.de> | 2016-07-25 14:51:26 +0200 |
commit | fb94b0e6df4da3026b9fb4714ee7ceab6bbfa9bc (patch) | |
tree | 57d22b50d28eab271a8db6fe201a7f18bbe069f4 /spec | |
parent | 604e30d99fdbb7c822efe31d05a0238064220037 (diff) | |
download | pronto-hlint-fb94b0e6df4da3026b9fb4714ee7ceab6bbfa9bc.tar.gz pronto-hlint-fb94b0e6df4da3026b9fb4714ee7ceab6bbfa9bc.tar.zst pronto-hlint-fb94b0e6df4da3026b9fb4714ee7ceab6bbfa9bc.zip |
Respect `.eslintignore`
If an `.eslintignore` is present, it's patterns are now respected.
See http://eslint.org/docs/user-guide/configuring#ignoring-files-and-directories
for more info.
Due to the file format of `.eslintignore`, the gem `globby` has to be
used for those patterns (which respects negations etc.).
Diffstat (limited to 'spec')
20 files changed, 47 insertions, 6 deletions
diff --git a/spec/fixtures/eslintignore.git/.eslintignore b/spec/fixtures/eslintignore.git/.eslintignore new file mode 100644 index 0000000..d85195b --- /dev/null +++ b/spec/fixtures/eslintignore.git/.eslintignore | |||
@@ -0,0 +1,2 @@ | |||
1 | ignored/**/*.js | ||
2 | !ignored/not_ignored.js | ||
diff --git a/spec/fixtures/eslintignore.git/git/HEAD b/spec/fixtures/eslintignore.git/git/HEAD new file mode 100644 index 0000000..fac958f --- /dev/null +++ b/spec/fixtures/eslintignore.git/git/HEAD | |||
@@ -0,0 +1 @@ | |||
ref: refs/heads/eslintignore | |||
diff --git a/spec/fixtures/eslintignore.git/git/config b/spec/fixtures/eslintignore.git/git/config new file mode 100644 index 0000000..6c9406b --- /dev/null +++ b/spec/fixtures/eslintignore.git/git/config | |||
@@ -0,0 +1,7 @@ | |||
1 | [core] | ||
2 | repositoryformatversion = 0 | ||
3 | filemode = true | ||
4 | bare = false | ||
5 | logallrefupdates = true | ||
6 | ignorecase = true | ||
7 | precomposeunicode = true | ||
diff --git a/spec/fixtures/eslintignore.git/git/index b/spec/fixtures/eslintignore.git/git/index new file mode 100644 index 0000000..8c5575c --- /dev/null +++ b/spec/fixtures/eslintignore.git/git/index | |||
Binary files differ | |||
diff --git a/spec/fixtures/eslintignore.git/git/logs/HEAD b/spec/fixtures/eslintignore.git/git/logs/HEAD new file mode 100644 index 0000000..8750baa --- /dev/null +++ b/spec/fixtures/eslintignore.git/git/logs/HEAD | |||
@@ -0,0 +1,3 @@ | |||
1 | 0000000000000000000000000000000000000000 d43de0396c81608113f99f7afd00f7f363e1cae8 Markus Doits <markus.doits@stellenticket.de> 1469450052 +0200 commit (initial): empty init commit | ||
2 | d43de0396c81608113f99f7afd00f7f363e1cae8 d43de0396c81608113f99f7afd00f7f363e1cae8 Markus Doits <markus.doits@stellenticket.de> 1469450062 +0200 checkout: moving from master to eslintignore | ||
3 | d43de0396c81608113f99f7afd00f7f363e1cae8 5ffc9b3c7f8e8d8f2e8c91cb69c9698405d1ca53 Markus Doits <markus.doits@stellenticket.de> 1469450067 +0200 commit: add .eslintignore and files with errors | ||
diff --git a/spec/fixtures/eslintignore.git/git/logs/refs/heads/eslintignore b/spec/fixtures/eslintignore.git/git/logs/refs/heads/eslintignore new file mode 100644 index 0000000..3467ecc --- /dev/null +++ b/spec/fixtures/eslintignore.git/git/logs/refs/heads/eslintignore | |||
@@ -0,0 +1,2 @@ | |||
1 | 0000000000000000000000000000000000000000 d43de0396c81608113f99f7afd00f7f363e1cae8 Markus Doits <markus.doits@stellenticket.de> 1469450062 +0200 branch: Created from HEAD | ||
2 | d43de0396c81608113f99f7afd00f7f363e1cae8 5ffc9b3c7f8e8d8f2e8c91cb69c9698405d1ca53 Markus Doits <markus.doits@stellenticket.de> 1469450067 +0200 commit: add .eslintignore and files with errors | ||
diff --git a/spec/fixtures/eslintignore.git/git/logs/refs/heads/master b/spec/fixtures/eslintignore.git/git/logs/refs/heads/master new file mode 100644 index 0000000..8105749 --- /dev/null +++ b/spec/fixtures/eslintignore.git/git/logs/refs/heads/master | |||
@@ -0,0 +1 @@ | |||
0000000000000000000000000000000000000000 d43de0396c81608113f99f7afd00f7f363e1cae8 Markus Doits <markus.doits@stellenticket.de> 1469450052 +0200 commit (initial): empty init commit | |||
diff --git a/spec/fixtures/eslintignore.git/git/objects/2d/1b9966feb19d665a9e5bb6a5bde410203a68f7 b/spec/fixtures/eslintignore.git/git/objects/2d/1b9966feb19d665a9e5bb6a5bde410203a68f7 new file mode 100644 index 0000000..f5fbdc5 --- /dev/null +++ b/spec/fixtures/eslintignore.git/git/objects/2d/1b9966feb19d665a9e5bb6a5bde410203a68f7 | |||
Binary files differ | |||
diff --git a/spec/fixtures/eslintignore.git/git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 b/spec/fixtures/eslintignore.git/git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 new file mode 100644 index 0000000..adf6411 --- /dev/null +++ b/spec/fixtures/eslintignore.git/git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 | |||
Binary files differ | |||
diff --git a/spec/fixtures/eslintignore.git/git/objects/5f/fc9b3c7f8e8d8f2e8c91cb69c9698405d1ca53 b/spec/fixtures/eslintignore.git/git/objects/5f/fc9b3c7f8e8d8f2e8c91cb69c9698405d1ca53 new file mode 100644 index 0000000..832698f --- /dev/null +++ b/spec/fixtures/eslintignore.git/git/objects/5f/fc9b3c7f8e8d8f2e8c91cb69c9698405d1ca53 | |||
Binary files differ | |||
diff --git a/spec/fixtures/eslintignore.git/git/objects/69/7ffd3c693fce9abcb871b9b47e2d116e6241d3 b/spec/fixtures/eslintignore.git/git/objects/69/7ffd3c693fce9abcb871b9b47e2d116e6241d3 new file mode 100644 index 0000000..c23a96f --- /dev/null +++ b/spec/fixtures/eslintignore.git/git/objects/69/7ffd3c693fce9abcb871b9b47e2d116e6241d3 | |||
Binary files differ | |||
diff --git a/spec/fixtures/eslintignore.git/git/objects/d4/3de0396c81608113f99f7afd00f7f363e1cae8 b/spec/fixtures/eslintignore.git/git/objects/d4/3de0396c81608113f99f7afd00f7f363e1cae8 new file mode 100644 index 0000000..e3c829c --- /dev/null +++ b/spec/fixtures/eslintignore.git/git/objects/d4/3de0396c81608113f99f7afd00f7f363e1cae8 | |||
@@ -0,0 +1,2 @@ | |||
1 | xK | ||
2 | 0@]&!n=D>SmZIo#|xihi@i%ZdCqtz#cmpm:"u!څ)ib2_D֓A4Uzק,SE \ No newline at end of file | ||
diff --git a/spec/fixtures/eslintignore.git/git/objects/d8/5195b5ff74cc05d121b758f00da43018f53b6f b/spec/fixtures/eslintignore.git/git/objects/d8/5195b5ff74cc05d121b758f00da43018f53b6f new file mode 100644 index 0000000..ee9657e --- /dev/null +++ b/spec/fixtures/eslintignore.git/git/objects/d8/5195b5ff74cc05d121b758f00da43018f53b6f | |||
Binary files differ | |||
diff --git a/spec/fixtures/eslintignore.git/git/objects/ec/7b4537cbd327a580ee44b74ff02fffc74feb46 b/spec/fixtures/eslintignore.git/git/objects/ec/7b4537cbd327a580ee44b74ff02fffc74feb46 new file mode 100644 index 0000000..9a642e0 --- /dev/null +++ b/spec/fixtures/eslintignore.git/git/objects/ec/7b4537cbd327a580ee44b74ff02fffc74feb46 | |||
Binary files differ | |||
diff --git a/spec/fixtures/eslintignore.git/git/refs/heads/eslintignore b/spec/fixtures/eslintignore.git/git/refs/heads/eslintignore new file mode 100644 index 0000000..d02562a --- /dev/null +++ b/spec/fixtures/eslintignore.git/git/refs/heads/eslintignore | |||
@@ -0,0 +1 @@ | |||
5ffc9b3c7f8e8d8f2e8c91cb69c9698405d1ca53 | |||
diff --git a/spec/fixtures/eslintignore.git/git/refs/heads/master b/spec/fixtures/eslintignore.git/git/refs/heads/master new file mode 100644 index 0000000..5dcf161 --- /dev/null +++ b/spec/fixtures/eslintignore.git/git/refs/heads/master | |||
@@ -0,0 +1 @@ | |||
d43de0396c81608113f99f7afd00f7f363e1cae8 | |||
diff --git a/spec/fixtures/eslintignore.git/ignored/ignored.js b/spec/fixtures/eslintignore.git/ignored/ignored.js new file mode 100644 index 0000000..2d1b996 --- /dev/null +++ b/spec/fixtures/eslintignore.git/ignored/ignored.js | |||
@@ -0,0 +1,5 @@ | |||
1 | function HelloWorld(name) | ||
2 | { | ||
3 | if (foo) foo++; | ||
4 | alert(name); | ||
5 | } | ||
diff --git a/spec/fixtures/eslintignore.git/ignored/not_ignored.js b/spec/fixtures/eslintignore.git/ignored/not_ignored.js new file mode 100644 index 0000000..2d1b996 --- /dev/null +++ b/spec/fixtures/eslintignore.git/ignored/not_ignored.js | |||
@@ -0,0 +1,5 @@ | |||
1 | function HelloWorld(name) | ||
2 | { | ||
3 | if (foo) foo++; | ||
4 | alert(name); | ||
5 | } | ||
diff --git a/spec/pronto/eslint_spec.rb b/spec/pronto/eslint_spec.rb index 7af0aa2..1117e15 100644 --- a/spec/pronto/eslint_spec.rb +++ b/spec/pronto/eslint_spec.rb | |||
@@ -25,6 +25,15 @@ module Pronto | |||
25 | its(:count) { should == 9 } | 25 | its(:count) { should == 9 } |
26 | its(:'first.msg') { should == "Expected { after 'if' condition." } | 26 | its(:'first.msg') { should == "Expected { after 'if' condition." } |
27 | end | 27 | end |
28 | |||
29 | context 'repo with ignored and not ignored file, each with five warnings' do | ||
30 | include_context 'eslintignore repo' | ||
31 | |||
32 | let(:patches) { repo.diff('master') } | ||
33 | |||
34 | its(:count) { should == 5 } | ||
35 | its(:'first.msg') { should == "Use the function form of 'use strict'." } | ||
36 | end | ||
28 | end | 37 | end |
29 | end | 38 | end |
30 | end | 39 | end |
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 4d1ff71..5769c2d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb | |||
@@ -2,13 +2,15 @@ require 'rspec' | |||
2 | require 'rspec/its' | 2 | require 'rspec/its' |
3 | require 'pronto/eslint' | 3 | require 'pronto/eslint' |
4 | 4 | ||
5 | RSpec.shared_context 'test repo' do | 5 | %w(test eslintignore).each do |repo_name| |
6 | let(:git) { 'spec/fixtures/test.git/git' } | 6 | RSpec.shared_context "#{repo_name} repo" do |
7 | let(:dot_git) { 'spec/fixtures/test.git/.git' } | 7 | let(:git) { "spec/fixtures/#{repo_name}.git/git" } |
8 | let(:dot_git) { "spec/fixtures/#{repo_name}.git/.git" } | ||
8 | 9 | ||
9 | before { FileUtils.mv(git, dot_git) } | 10 | before { FileUtils.mv(git, dot_git) } |
10 | let(:repo) { Pronto::Git::Repository.new('spec/fixtures/test.git') } | 11 | let(:repo) { Pronto::Git::Repository.new("spec/fixtures/#{repo_name}.git") } |
11 | after { FileUtils.mv(dot_git, git) } | 12 | after { FileUtils.mv(dot_git, git) } |
13 | end | ||
12 | end | 14 | end |
13 | 15 | ||
14 | RSpec.configure do |config| | 16 | RSpec.configure do |config| |