jshint 1.0.1 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/config/jshint.yml +1 -0
- data/lib/jshint/configuration.rb +16 -0
- data/lib/jshint/lint.rb +6 -12
- data/lib/jshint/version.rb +1 -1
- data/spec/fixtures/jshint.yml +1 -0
- data/spec/lib/configuration_spec.rb +19 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb33d17c8ae2ee25b5a20763ffe9d10380d89de4
|
4
|
+
data.tar.gz: caa6f24f81d5e86a88de551a131196de1547b762
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf8025f93a454251e03d141f8487b842065addd1310ecf9eb95aec1c7b3ba29b69ffec00a7c4960a74dbb78ae98fbb151430aa77ae50e9f081dbdc6d095bbed2
|
7
|
+
data.tar.gz: 65e3068d5789c6c3aa432738785ec45c02aae33de54aed96c08e16825ae1d4da99ce5f075f2b992e809ddbe8fc2e70a9f64ca7e1065a79aa7572ac95f9424407
|
data/config/jshint.yml
CHANGED
data/lib/jshint/configuration.rb
CHANGED
@@ -64,6 +64,22 @@ module Jshint
|
|
64
64
|
options["files"]
|
65
65
|
end
|
66
66
|
|
67
|
+
def excluded_search_paths
|
68
|
+
options.fetch("exclude_paths", [])
|
69
|
+
end
|
70
|
+
|
71
|
+
def search_paths
|
72
|
+
default_search_paths - excluded_search_paths
|
73
|
+
end
|
74
|
+
|
75
|
+
def default_search_paths
|
76
|
+
[
|
77
|
+
'app/assets/javascripts',
|
78
|
+
'vendor/assets/javascripts',
|
79
|
+
'lib/assets/javascripts'
|
80
|
+
]
|
81
|
+
end
|
82
|
+
|
67
83
|
private
|
68
84
|
|
69
85
|
def read_config_file
|
data/lib/jshint/lint.rb
CHANGED
@@ -12,13 +12,6 @@ module Jshint
|
|
12
12
|
# @return [Jshint::Configuration] The configuration object
|
13
13
|
attr_reader :config
|
14
14
|
|
15
|
-
# @return [Array] The standard location for JavaScript assets in a Rails project
|
16
|
-
RAILS_JS_ASSET_PATHS = [
|
17
|
-
'app/assets/javascripts',
|
18
|
-
'vendor/assets/javascripts',
|
19
|
-
'lib/assets/javascripts'
|
20
|
-
]
|
21
|
-
|
22
15
|
# Sets up our Linting behaviour
|
23
16
|
#
|
24
17
|
# @param config_path [String] The absolute path to a configuration YAML file
|
@@ -61,14 +54,15 @@ module Jshint
|
|
61
54
|
get_json(content)
|
62
55
|
end
|
63
56
|
|
64
|
-
def
|
65
|
-
paths =
|
57
|
+
def file_paths
|
58
|
+
paths = []
|
59
|
+
|
66
60
|
if files.is_a? Array
|
67
61
|
files.each do |file|
|
68
|
-
|
62
|
+
config.search_paths.each { |path| paths << File.join(path, file) }
|
69
63
|
end
|
70
64
|
else
|
71
|
-
|
65
|
+
config.search_paths.each { |path| paths << File.join(path, files) }
|
72
66
|
end
|
73
67
|
|
74
68
|
paths
|
@@ -100,7 +94,7 @@ module Jshint
|
|
100
94
|
|
101
95
|
def javascript_files
|
102
96
|
js_asset_files = []
|
103
|
-
|
97
|
+
file_paths.each do |path|
|
104
98
|
Dir.glob(path) do |file|
|
105
99
|
js_asset_files << file
|
106
100
|
end
|
data/lib/jshint/version.rb
CHANGED
data/spec/fixtures/jshint.yml
CHANGED
@@ -30,5 +30,24 @@ describe Jshint::Configuration do
|
|
30
30
|
config = described_class.new
|
31
31
|
config.files.should == ["**/*.js"]
|
32
32
|
end
|
33
|
+
|
34
|
+
context "search paths" do
|
35
|
+
subject { described_class.new }
|
36
|
+
|
37
|
+
it "should default the exclusion paths to an empty array" do
|
38
|
+
subject.excluded_search_paths.should == []
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should set the exclusion paths to those in the config" do
|
42
|
+
subject.options["exclude_paths"] << 'vendor/assets/javascripts'
|
43
|
+
subject.excluded_search_paths.should == ["vendor/assets/javascripts"]
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should be the default search paths minus the exclude paths" do
|
47
|
+
subject.search_paths.should == subject.default_search_paths
|
48
|
+
subject.options["exclude_paths"] << 'vendor/assets/javascripts'
|
49
|
+
subject.search_paths.should == ['app/assets/javascripts', 'lib/assets/javascripts']
|
50
|
+
end
|
51
|
+
end
|
33
52
|
end
|
34
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jshint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Damian Nicholson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: therubyracer
|