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

Commit 2b76bcf

Browse files
committed
update: [email protected] & fix errors
1 parent a29006e commit 2b76bcf

File tree

7 files changed

+193
-193
lines changed

7 files changed

+193
-193
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ env:
1111

1212
rules:
1313
indent: [2, 2] # 2 spaces indentation
14-
max-len: [2, 80, 4]
14+
max-len: [2, 120, 4]
1515
quotes: [2, "double"]
1616
semi: [2, "never"]
1717
no-multiple-empty-lines: [2, {"max": 1}]

index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ function printLinterOutput(res, config, webpack) {
8888
reportOutput = messages
8989
}
9090
var filePath = loaderUtils.interpolateName(webpack,
91-
config.outputReport.filePath, {
92-
content: res.results.map(function(r) {
93-
return r.source
94-
}).join("\n"),
95-
}
91+
config.outputReport.filePath, {
92+
content: res.results.map(function(r) {
93+
return r.source
94+
}).join("\n"),
95+
}
9696
)
9797
webpack.emitFile(filePath, reportOutput)
9898
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
},
2929
"devDependencies": {
3030
"ava": "^0.17.0",
31-
"eslint": "^3.0.0",
31+
"eslint": "^4.0.0-rc.0",
3232
"eslint-friendly-formatter": "^2.0.4",
3333
"npmpub": "^3.0.1",
3434
"webpack": "^2.2.0"

test/autofix.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,33 @@ test.before(function() {
1212
})
1313

1414
test.cb("loader doesn't throw error if file ok after auto-fixing",
15-
function(t) {
16-
t.plan(2)
17-
webpack(conf(
18-
{
19-
entry: "./test/fixtures/fixable-clone.js",
20-
module: {
21-
loaders: [
22-
{
23-
test: /\.js$/,
24-
loader: "./index?fix=true",
25-
exclude: /node_modules/,
26-
},
27-
],
28-
},
29-
}
30-
),
31-
function(err, stats) {
32-
if (err) {
33-
throw err
34-
}
35-
// console.log(stats.compilation.errors)
36-
t.false(stats.hasErrors(), "a good file doesn't give any error")
37-
// console.log(stats.compilation.warnings)
38-
t.false(stats.hasWarnings(), "a good file doesn't give any warning")
39-
t.end()
15+
function(t) {
16+
t.plan(2)
17+
webpack(conf(
18+
{
19+
entry: "./test/fixtures/fixable-clone.js",
20+
module: {
21+
loaders: [
22+
{
23+
test: /\.js$/,
24+
loader: "./index?fix=true",
25+
exclude: /node_modules/,
26+
},
27+
],
28+
},
29+
}
30+
),
31+
function(err, stats) {
32+
if (err) {
33+
throw err
34+
}
35+
// console.log(stats.compilation.errors)
36+
t.false(stats.hasErrors(), "a good file doesn't give any error")
37+
// console.log(stats.compilation.warnings)
38+
t.false(stats.hasWarnings(), "a good file doesn't give any warning")
39+
t.end()
40+
})
4041
})
41-
})
4242

4343
// remove the clone
4444
test.after.always(function() {

test/cache.js

Lines changed: 77 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -79,106 +79,106 @@ test.cb("should output files to cache directory", (t) => {
7979
})
8080

8181
test.cb.serial("should output json.gz files to standard cache dir by default",
82-
(t) => {
83-
var config = assign({}, globalConfig, {
84-
output: {
85-
path: t.context.directory,
86-
},
87-
module: {
88-
loaders: [
89-
{
90-
test: /\.jsx?/,
91-
loader: eslintLoader,
92-
exclude: /node_modules/,
93-
query: {
94-
cache: true,
82+
(t) => {
83+
var config = assign({}, globalConfig, {
84+
output: {
85+
path: t.context.directory,
86+
},
87+
module: {
88+
loaders: [
89+
{
90+
test: /\.jsx?/,
91+
loader: eslintLoader,
92+
exclude: /node_modules/,
93+
query: {
94+
cache: true,
95+
},
9596
},
96-
},
97-
],
98-
},
99-
})
97+
],
98+
},
99+
})
100100

101-
webpack(config, (err) => {
102-
t.is(err, null)
101+
webpack(config, (err) => {
102+
t.is(err, null)
103103

104-
fs.readdir(defaultCacheDir, (err, files) => {
104+
fs.readdir(defaultCacheDir, (err, files) => {
105105
// console.log("CACHE SETTING:", t.context.cache)
106-
files = files.filter((file) => /\b[0-9a-f]{5,40}\.json\.gz\b/.test(file))
107-
t.is(err, null)
108-
t.true(files.length > 0)
109-
t.end()
106+
files = files.filter((file) => /\b[0-9a-f]{5,40}\.json\.gz\b/.test(file))
107+
t.is(err, null)
108+
t.true(files.length > 0)
109+
t.end()
110+
})
110111
})
111112
})
112-
})
113113

114114
test.cb.serial(
115-
"should output files to standard cache dir if set to true in query",
116-
(t) => {
117-
var config = assign({}, globalConfig, {
118-
output: {
119-
path: t.context.directory,
120-
},
121-
module: {
122-
loaders: [
123-
{
124-
test: /\.jsx?/,
125-
loader: `${eslintLoader}?cache=true`,
126-
exclude: /node_modules/,
127-
},
128-
],
129-
},
130-
})
115+
"should output files to standard cache dir if set to true in query",
116+
(t) => {
117+
var config = assign({}, globalConfig, {
118+
output: {
119+
path: t.context.directory,
120+
},
121+
module: {
122+
loaders: [
123+
{
124+
test: /\.jsx?/,
125+
loader: `${eslintLoader}?cache=true`,
126+
exclude: /node_modules/,
127+
},
128+
],
129+
},
130+
})
131131

132-
webpack(config, (err) => {
133-
t.is(err, null)
132+
webpack(config, (err) => {
133+
t.is(err, null)
134134

135-
fs.readdir(defaultCacheDir, (err, files) => {
135+
fs.readdir(defaultCacheDir, (err, files) => {
136136
// console.log("CACHE SETTING:", t.context.cache)
137-
files = files.filter((file) => /\b[0-9a-f]{5,40}\.json\.gz\b/.test(file))
137+
files = files.filter((file) => /\b[0-9a-f]{5,40}\.json\.gz\b/.test(file))
138138

139-
t.is(err, null)
140-
t.true(files.length > 0)
141-
t.end()
139+
t.is(err, null)
140+
t.true(files.length > 0)
141+
t.end()
142+
})
142143
})
143144
})
144-
})
145145

146146
test.cb.serial("should read from cache directory if cached file exists",
147-
(t) => {
148-
var config = assign({}, globalConfig, {
149-
output: {
150-
path: t.context.directory,
151-
},
152-
module: {
153-
loaders: [
154-
{
155-
test: /\.jsx?/,
156-
loader: eslintLoader,
157-
exclude: /node_modules/,
158-
query: {
159-
cache: t.context.cache,
147+
(t) => {
148+
var config = assign({}, globalConfig, {
149+
output: {
150+
path: t.context.directory,
151+
},
152+
module: {
153+
loaders: [
154+
{
155+
test: /\.jsx?/,
156+
loader: eslintLoader,
157+
exclude: /node_modules/,
158+
query: {
159+
cache: t.context.cache,
160+
},
160161
},
161-
},
162-
],
163-
},
164-
})
165-
166-
// @TODO Find a way to know if the file as correctly read without relying on
167-
// Istanbul for coverage.
168-
webpack(config, (err) => {
169-
t.is(err, null)
162+
],
163+
},
164+
})
170165

166+
// @TODO Find a way to know if the file as correctly read without relying on
167+
// Istanbul for coverage.
171168
webpack(config, (err) => {
172169
t.is(err, null)
173-
fs.readdir(t.context.cache, (err, files) => {
170+
171+
webpack(config, (err) => {
174172
t.is(err, null)
175-
t.true(files.length > 0)
176-
t.end()
173+
fs.readdir(t.context.cache, (err, files) => {
174+
t.is(err, null)
175+
t.true(files.length > 0)
176+
t.end()
177+
})
177178
})
178179
})
179-
})
180180

181-
})
181+
})
182182

183183
test.cb.serial("should have one file per module", (t) => {
184184
var config = assign({}, globalConfig, {
@@ -283,5 +283,5 @@ function createTestDirectory(baseDirectory, testTitle, cb) {
283283
}
284284

285285
function escapeDirectory(directory) {
286-
return directory.replace(/[\/?<>\\:*|"\s]/g, "_")
286+
return directory.replace(/[/?<>\\:*|"\s]/g, "_")
287287
}

test/formatter-multiple-entries.js

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,53 +5,53 @@ var fs = require("fs")
55
var path = require("path")
66

77
test.cb("eslint-loader can be configured to write multiple eslint result files",
8-
function(t) {
9-
var outputFilename = "outputReport-[name].txt"
10-
var config = conf(
11-
{
12-
entry: [
13-
"./test/fixtures/error-multi-two.js",
14-
"./test/fixtures/error-multi-one.js",
15-
"./test/fixtures/error-multi.js",
16-
],
17-
},
18-
{
19-
formatter: require("eslint/lib/formatters/checkstyle"),
20-
outputReport: {
21-
filePath: outputFilename,
8+
function(t) {
9+
var outputFilename = "outputReport-[name].txt"
10+
var config = conf(
11+
{
12+
entry: [
13+
"./test/fixtures/error-multi-two.js",
14+
"./test/fixtures/error-multi-one.js",
15+
"./test/fixtures/error-multi.js",
16+
],
2217
},
23-
}
24-
)
18+
{
19+
formatter: require("eslint/lib/formatters/checkstyle"),
20+
outputReport: {
21+
filePath: outputFilename,
22+
},
23+
}
24+
)
2525

26-
/* Plan for the success count. Failure cases are going to fail anyway so the
26+
/* Plan for the success count. Failure cases are going to fail anyway so the
2727
* count being off for those cases doesn't matter. */
28-
t.plan(config.entry.length * 2)
28+
t.plan(config.entry.length * 2)
2929

30-
webpack(config,
31-
function(err, stats) {
32-
if (err) {
33-
throw err
34-
}
30+
webpack(config,
31+
function(err, stats) {
32+
if (err) {
33+
throw err
34+
}
3535

36-
stats.compilation.errors.forEach(function(error) {
37-
var basename = path.basename(error.module.resource, ".js")
38-
var filename = config.output.path + "outputReport-" + basename + ".txt"
36+
stats.compilation.errors.forEach(function(error) {
37+
var basename = path.basename(error.module.resource, ".js")
38+
var filename = config.output.path + "outputReport-" + basename + ".txt"
3939

40-
try {
41-
var contents = fs.readFileSync(filename, "utf8")
40+
try {
41+
var contents = fs.readFileSync(filename, "utf8")
4242

43-
t.pass("File '" + filename + "' has been created")
44-
t.is(
45-
error.message,
46-
contents,
47-
"File '" + filename + "' Contents should equal output"
48-
)
49-
}
50-
catch (e) {
51-
t.fail("Expected file '" + filename + "' to have been created:" + e)
52-
}
53-
})
43+
t.pass("File '" + filename + "' has been created")
44+
t.is(
45+
error.message,
46+
contents,
47+
"File '" + filename + "' Contents should equal output"
48+
)
49+
}
50+
catch (e) {
51+
t.fail("Expected file '" + filename + "' to have been created:" + e)
52+
}
53+
})
5454

55-
t.end()
55+
t.end()
56+
})
5657
})
57-
})

0 commit comments

Comments
 (0)