Skip to content
This repository was archived by the owner on Sep 28, 2020. It is now read-only.

Commit 6a3c1cb

Browse files
committed
Fixed: support for eslint 1.x-rc (0.14.2)
Close #54 Close #55
1 parent 7a73a4c commit 6a3c1cb

12 files changed

+130
-55
lines changed

.eslintrc

+21-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
---
2+
extends: eslint:recommended
3+
24
ecmaFeatures:
35
modules: true
46

@@ -7,20 +9,27 @@ env:
79
browser: true
810
node: true
911

10-
# 0: off, 1: warning, 2: error
1112
rules:
12-
# semicolons are useless
13-
semi: [2, "never"]
14-
13+
indent: [2, 2] # 2 spaces indentation
14+
max-len: [2, 80, 4]
1515
quotes: [2, "double"]
16+
semi: [2, "never"]
17+
no-multiple-empty-lines: [2, {"max": 1}]
1618

17-
# 2 spaces indentation
18-
indent: [2, 2]
19-
20-
# trailing coma are cool for diff
21-
comma-dangle: [2, "always"]
22-
23-
# enforce comma at eol (never before)
19+
brace-style: [2, "stroustrup"]
20+
comma-dangle: [2, "always-multiline"]
2421
comma-style: [2, "last"]
22+
computed-property-spacing: [2, "never"]
23+
dot-location: [2, "property"]
24+
25+
one-var: [2, "never"]
26+
no-bitwise: [2]
2527

26-
valid-jsdoc: 2
28+
object-curly-spacing: [2, "never"]
29+
array-bracket-spacing: [2, "never"]
30+
space-unary-ops: [2, {"words": true, "nonwords": false}]
31+
space-after-keywords: [2, "always"]
32+
space-before-blocks: [2, "always"]
33+
space-before-function-paren: [2, "never"]
34+
space-in-parens: [2, "never"]
35+
spaced-comment: [2, "always"]

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 0.14.2 - 2015-07-18
2+
3+
- Fixed: support for eslint 1.x-rc
4+
15
# 0.14.1 - 2015-06-15
26

37
- Fixed: support for eslint 0.24.x

index.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ function lint(input, config, webpack, callback) {
4040
if (res.warningCount && config.quiet) {
4141
res.warningCount = 0
4242
res.results[0].warningCount = 0
43-
res.results[0].messages = res.results[0].messages.filter(function(message) {
44-
return message.severity !== 1
45-
})
43+
res.results[0].messages = res.results[0].messages
44+
.filter(function(message) {
45+
return message.severity !== 1
46+
})
4647
}
4748

4849
if (res.errorCount || res.warningCount) {
@@ -73,7 +74,11 @@ function lint(input, config, webpack, callback) {
7374
}
7475
}
7576
else {
76-
throw new Error("Your module system doesn't support emitWarning. Update available? \n" + messages)
77+
throw new Error(
78+
"Your module system doesn't support emitWarning. " +
79+
"Update available? \n" +
80+
messages
81+
)
7782
}
7883
}
7984
}

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-loader",
3-
"version": "0.14.1",
3+
"version": "0.14.2",
44
"description": "eslint loader (for webpack)",
55
"keywords": [
66
"lint",
@@ -25,14 +25,14 @@
2525
"index.js"
2626
],
2727
"peerDependencies": {
28-
"eslint": "0.21 - 0.24"
28+
"eslint": "0.21 - 0.24 || ~1.0.0-rc-0"
2929
},
3030
"dependencies": {
3131
"loader-utils": "^0.2.7",
32-
"object-assign": "^2.0.0"
32+
"object-assign": "^3.0.0"
3333
},
3434
"devDependencies": {
35-
"eslint": "^0.24.0",
35+
"eslint": "^1.0.0-rc-1",
3636
"eslint-friendly-formatter": "^1.0.3",
3737
"tape": "^4.0.0",
3838
"webpack": "^1.8.4"

test/error.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@ test("eslint-loader can return error if file is bad", function(t) {
1111
}
1212
),
1313
function(err, stats) {
14-
if (err) {throw err}
14+
if (err) {
15+
throw err
16+
}
1517

1618
// console.log(stats.compilation.errors)
17-
t.ok(stats.hasErrors(), "a file that contains eslint errors should return error")
19+
t.ok(
20+
stats.hasErrors(),
21+
"a file that contains eslint errors should return error"
22+
)
1823
t.end()
1924
})
2025
})

test/eslintignore.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ test("eslint-loader ignores files present in .eslintignore", function(t) {
1616
}
1717
),
1818
function(err, stats) {
19-
if (err) {throw err}
19+
if (err) {
20+
throw err
21+
}
2022

2123
// console.log(stats.compilation.warnings)
2224
t.notOk(stats.hasWarnings(), "an ignored doesn't give a warning")

test/force-emit.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,17 @@ test("eslint-loader can force to emit error", function(t) {
1414
}
1515
),
1616
function(err, stats) {
17-
if (err) {throw err}
17+
if (err) {
18+
throw err
19+
}
1820

1921
// console.log(stats.compilation.errors)
2022
t.ok(stats.hasErrors(), "a file should return error if asked")
2123
// console.log(stats.compilation.warnings)
22-
t.notOk(stats.hasWarnings(), "a file should return no warning if error asked")
24+
t.notOk(
25+
stats.hasWarnings(),
26+
"a file should return no warning if error asked"
27+
)
2328
t.end()
2429
})
2530
})
@@ -35,7 +40,9 @@ test("eslint-loader can force to emit warning", function(t) {
3540
}
3641
),
3742
function(err, stats) {
38-
if (err) {throw err}
43+
if (err) {
44+
throw err
45+
}
3946

4047
// console.log(stats.compilation.warnings)
4148
t.ok(stats.hasWarnings(), "a file should return warning if asked")

test/formatter.js

+23-5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ var webpack = require("webpack")
33
var assign = require("object-assign")
44
var conf = require("./utils/conf")
55

6+
/* eslint-disable no-console */
67
test("eslint-loader can use eslint formatter", function(t) {
78
webpack(assign({},
89
conf,
@@ -11,10 +12,17 @@ test("eslint-loader can use eslint formatter", function(t) {
1112
}
1213
),
1314
function(err, stats) {
14-
if (err) {throw err}
15+
if (err) {
16+
throw err
17+
}
1518

1619
console.log("### Here is a example of the default formatter")
17-
console.log("# " + stats.compilation.errors[0].message.split("\n").join("\n# "))
20+
console.log(
21+
"# " +
22+
stats.compilation.errors[0].message
23+
.split("\n")
24+
.join("\n# ")
25+
)
1826
t.ok(stats.compilation.errors[0].message, "webpack have some output")
1927
t.end()
2028
})
@@ -31,11 +39,21 @@ test("eslint-loader can use custom formatter", function(t) {
3139
}
3240
),
3341
function(err, stats) {
34-
if (err) {throw err}
42+
if (err) {
43+
throw err
44+
}
3545

3646
console.log("### Here is a example of another formatter")
37-
console.log("# " + stats.compilation.errors[0].message.split("\n").join("\n# "))
38-
t.ok(stats.compilation.errors[0].message, "webpack have some output with custom formatters")
47+
console.log(
48+
"# " +
49+
stats.compilation.errors[0].message
50+
.split("\n")
51+
.join("\n# ")
52+
)
53+
t.ok(
54+
stats.compilation.errors[0].message,
55+
"webpack have some output with custom formatters"
56+
)
3957
t.end()
4058
})
4159
})

test/ok.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ test("eslint-loader don't throw error if file is ok", function(t) {
1111
}
1212
),
1313
function(err, stats) {
14-
if (err) {throw err}
14+
if (err) {
15+
throw err
16+
}
1517

1618
// console.log(stats.compilation.errors)
1719
t.notOk(stats.hasErrors(), "a good file doesn't give any error")

test/parameters.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ test("eslint-loader supports query strings parameters", function(t) {
2020
}
2121
),
2222
function(err, stats) {
23-
if (err) {throw err}
23+
if (err) {
24+
throw err
25+
}
2426

2527
// console.log(stats.compilation.errors)
2628
t.notOk(stats.hasErrors(), "a good file doesn't give any error")

test/quiet.js

+32-19
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,36 @@ var webpack = require("webpack")
33
var assign = require("object-assign")
44
var conf = require("./utils/conf")
55

6-
test("eslint-loader only returns errors and not warnings if quiet is set", function(t) {
7-
webpack(assign({},
8-
conf,
9-
{
10-
entry: "./test/fixtures/warn.js",
11-
eslint: assign({}, conf.eslint, {
12-
quiet: true,
13-
}),
14-
}
15-
),
16-
function(err, stats) {
17-
if (err) {throw err}
6+
test(
7+
"eslint-loader only returns errors and not warnings if quiet is set",
8+
function(t) {
9+
webpack(assign({},
10+
conf,
11+
{
12+
entry: "./test/fixtures/warn.js",
13+
eslint: assign({}, conf.eslint, {
14+
quiet: true,
15+
}),
16+
}
17+
),
18+
function(err, stats) {
19+
if (err) {
20+
throw err
21+
}
1822

19-
// console.log(stats.compilation.warnings)
20-
t.notOk(stats.hasWarnings(), "a file that contains eslint warning should return nothing if quiet option is true")
21-
// console.log(stats.compilation.errors)
22-
t.notOk(stats.hasErrors(), "a file that contains eslint warning should return no error if it contains only warning in quiet mode")
23-
t.end()
24-
})
25-
})
23+
// console.log(stats.compilation.warnings)
24+
t.notOk(
25+
stats.hasWarnings(),
26+
"a file that contains eslint warning should return nothing if quiet " +
27+
"option is true"
28+
)
29+
// console.log(stats.compilation.errors)
30+
t.notOk(
31+
stats.hasErrors(),
32+
"a file that contains eslint warning should return no error if it " +
33+
"contains only warning in quiet mode"
34+
)
35+
t.end()
36+
})
37+
}
38+
)

test/warning.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,21 @@ test("eslint-loader can return warning", function(t) {
1111
}
1212
),
1313
function(err, stats) {
14-
if (err) {throw err}
14+
if (err) {
15+
throw err
16+
}
1517

1618
// console.log(stats.compilation.warnings)
17-
t.ok(stats.hasWarnings(), "a file that contains eslint warning should return warning")
19+
t.ok(
20+
stats.hasWarnings(),
21+
"a file that contains eslint warning should return warning"
22+
)
1823

1924
// console.log(stats.compilation.errors)
20-
t.notOk(stats.hasErrors(), "a bad file should return no error if it contains only warning by default")
25+
t.notOk(
26+
stats.hasErrors(),
27+
"a bad file should return no error if it contains only warning by default"
28+
)
2129
t.end()
2230
})
2331
})

0 commit comments

Comments
 (0)