Skip to content

Commit 8772814

Browse files
committedAug 4, 2018
style(standard): fix linting issues
1 parent 8ef443f commit 8772814

10 files changed

+95
-92
lines changed
 

‎lib/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ module.exports = function loader (css, map, meta) {
9090
}
9191
}
9292

93-
rc.ctx.webpack = this;
93+
rc.ctx.webpack = this
9494

9595
return postcssrc(rc.ctx, rc.path)
9696
}).then((config) => {

‎test/fixtures/config/context/plugin.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ const postcss = require('postcss')
55
// This plugin creates asset file in webpack compilation
66
module.exports = postcss.plugin('plugin', (ctx) => {
77
ctx.webpack._compilation.assets['asset.txt'] = {
8-
source() {
9-
return '123';
8+
source () {
9+
return '123'
1010
},
11-
size() {
12-
return 0;
11+
size () {
12+
return 0
1313
}
1414
}
1515
})

‎test/loader.test.js

+11-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const webpack = require('./helpers/compiler')
44
const { loader } = require('./helpers/compilation')
5-
const { copyFile, deleteFile } = require('./helpers/fs');
5+
const { copyFile, deleteFile } = require('./helpers/fs')
66

77
describe('Loader', () => {
88
test('Default', () => {
@@ -15,11 +15,11 @@ describe('Loader', () => {
1515
}
1616

1717
return webpack('css/index.js', config).then((stats) => {
18-
const src = loader(stats).src
18+
const src = loader(stats).src
1919

20-
expect(src).toEqual("module.exports = \"a { color: black }\\n\"")
21-
expect(src).toMatchSnapshot()
22-
})
20+
expect(src).toEqual('module.exports = "a { color: black }\\n"')
21+
expect(src).toMatchSnapshot()
22+
})
2323
})
2424

2525
describe('Watching', () => {
@@ -40,7 +40,7 @@ describe('Loader', () => {
4040
options: {
4141
plugins: [
4242
require('postcss-import')
43-
],
43+
]
4444
}
4545
}
4646
}
@@ -66,7 +66,7 @@ describe('Loader', () => {
6666
const { err, src } = loader(stats)
6767

6868
expect(src).toMatchSnapshot()
69-
expect(src).toEqual("module.exports = \"a { color: black }\\n\"")
69+
expect(src).toEqual('module.exports = "a { color: black }\\n"')
7070
expect(err.length).toEqual(0)
7171

7272
return close()
@@ -77,6 +77,10 @@ describe('Loader', () => {
7777

7878
const options = {
7979
watch (err, stats, close) {
80+
if (err) {
81+
throw err
82+
}
83+
8084
steps[step](stats, close)
8185

8286
step++

‎test/options/config.test.js

+20-21
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ describe('Options', () => {
1010
}
1111

1212
return webpack('css/index.js', config).then((stats) => {
13-
const src = loader(stats).src
13+
const src = loader(stats).src
1414

15-
expect(src).toEqual("module.exports = \"a { color: rgba(255, 0, 0, 1.0) }\\n\"")
16-
expect(src).toMatchSnapshot()
17-
})
15+
expect(src).toEqual('module.exports = "a { color: rgba(255, 0, 0, 1.0) }\\n"')
16+
expect(src).toMatchSnapshot()
17+
})
1818
})
1919

2020
test('Config - Path - {String}', () => {
@@ -27,11 +27,11 @@ describe('Options', () => {
2727
}
2828

2929
return webpack('css/index.js', config).then((stats) => {
30-
const src = loader(stats).src
30+
const src = loader(stats).src
3131

32-
expect(src).toEqual("module.exports = \"a { color: black }\\n\"")
33-
expect(src).toMatchSnapshot()
34-
})
32+
expect(src).toEqual('module.exports = "a { color: black }\\n"')
33+
expect(src).toMatchSnapshot()
34+
})
3535
})
3636

3737
test('Config - Context - {Object}', () => {
@@ -47,14 +47,13 @@ describe('Options', () => {
4747
}
4848

4949
return webpack('css/index.js', config).then((stats) => {
50-
const src = loader(stats).src
50+
const src = loader(stats).src
5151

52-
expect(src).toEqual("module.exports = \"a { color: rgba(255, 0, 0, 1.0) }\\n\"")
53-
expect(src).toMatchSnapshot()
54-
})
52+
expect(src).toEqual('module.exports = "a { color: rgba(255, 0, 0, 1.0) }\\n"')
53+
expect(src).toMatchSnapshot()
54+
})
5555
})
5656

57-
5857
test('Config - Context - {Object} - with ident', () => {
5958
const config = {
6059
loader: {
@@ -69,11 +68,11 @@ describe('Options', () => {
6968
}
7069

7170
return webpack('css/index.js', config).then((stats) => {
72-
const src = loader(stats).src
71+
const src = loader(stats).src
7372

74-
expect(src).toEqual("module.exports = \"a { color: rgba(255, 0, 0, 1.0) }\\n\"")
75-
expect(src).toMatchSnapshot()
76-
})
73+
expect(src).toEqual('module.exports = "a { color: rgba(255, 0, 0, 1.0) }\\n"')
74+
expect(src).toMatchSnapshot()
75+
})
7776
})
7877

7978
test('Pass loader object to config context', () => {
@@ -88,11 +87,11 @@ describe('Options', () => {
8887
}
8988

9089
return webpack('css/index.js', config).then((stats) => {
91-
const assets = stats.compilation.assets;
92-
const expectedAssetName = 'asset.txt';
90+
const assets = stats.compilation.assets
91+
const expectedAssetName = 'asset.txt'
9392

94-
expect(expectedAssetName in assets).toBeTruthy();
95-
expect(assets[expectedAssetName].source()).toBe('123');
93+
expect(expectedAssetName in assets).toBeTruthy()
94+
expect(assets[expectedAssetName].source()).toBe('123')
9695
})
9796
})
9897
})

‎test/options/exec.test.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ describe('Options', () => {
1515
}
1616

1717
return webpack('jss/exec/index.js', config).then((stats) => {
18-
const src = loader(stats).src
18+
const src = loader(stats).src
1919

20-
expect(src).toEqual("module.exports = \"a {\\n color: green\\n}\"")
21-
expect(src).toMatchSnapshot()
22-
})
20+
expect(src).toEqual('module.exports = "a {\\n color: green\\n}"')
21+
expect(src).toMatchSnapshot()
22+
})
2323
})
2424

2525
test('JSS - {String}', () => {
@@ -32,9 +32,9 @@ describe('Options', () => {
3232
}
3333

3434
return webpack('jss/index.js', config).then((stats) => {
35-
const src = loader(stats).src
35+
const src = loader(stats).src
3636

37-
expect(src).toMatchSnapshot()
38-
})
37+
expect(src).toMatchSnapshot()
38+
})
3939
})
4040
})

‎test/options/parser.test.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ describe('Options', () => {
1414
}
1515

1616
return webpack('sss/index.js', config).then((stats) => {
17-
const src = loader(stats).src
17+
const src = loader(stats).src
1818

19-
expect(src).toEqual("module.exports = \"a {\\n color: black\\n}\\n\"")
20-
expect(src).toMatchSnapshot()
21-
})
19+
expect(src).toEqual('module.exports = "a {\\n color: black\\n}\\n"')
20+
expect(src).toMatchSnapshot()
21+
})
2222
})
2323

2424
test('Parser - {Object}', () => {
@@ -32,10 +32,10 @@ describe('Options', () => {
3232
}
3333

3434
return webpack('sss/index.js', config).then((stats) => {
35-
const src = loader(stats).src
35+
const src = loader(stats).src
3636

37-
expect(src).toEqual("module.exports = \"a {\\n color: black\\n}\\n\"")
38-
expect(src).toMatchSnapshot()
39-
})
37+
expect(src).toEqual('module.exports = "a {\\n color: black\\n}\\n"')
38+
expect(src).toMatchSnapshot()
39+
})
4040
})
4141
})

‎test/options/plugins.test.js

+16-16
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ describe('Options', () => {
1515
}
1616

1717
return webpack('css/index.js', config).then((stats) => {
18-
const src = loader(stats).src
18+
const src = loader(stats).src
1919

20-
expect(src).toEqual("module.exports = \"a { color: rgba(255, 0, 0, 1.0) }\\n\"")
21-
expect(src).toMatchSnapshot()
22-
})
20+
expect(src).toEqual('module.exports = "a { color: rgba(255, 0, 0, 1.0) }\\n"')
21+
expect(src).toMatchSnapshot()
22+
})
2323
})
2424

2525
test('Plugins - {Object}', () => {
@@ -33,11 +33,11 @@ describe('Options', () => {
3333
}
3434

3535
return webpack('css/index.js', config).then((stats) => {
36-
const src = loader(stats).src
36+
const src = loader(stats).src
3737

38-
expect(src).toEqual("module.exports = \"a { color: rgba(255, 0, 0, 1.0) }\\n\"")
39-
expect(src).toMatchSnapshot()
40-
})
38+
expect(src).toEqual('module.exports = "a { color: rgba(255, 0, 0, 1.0) }\\n"')
39+
expect(src).toMatchSnapshot()
40+
})
4141
})
4242

4343
test('Plugins - {Function} - {Array}', () => {
@@ -51,11 +51,11 @@ describe('Options', () => {
5151
}
5252

5353
return webpack('css/index.js', config).then((stats) => {
54-
const src = loader(stats).src
54+
const src = loader(stats).src
5555

56-
expect(src).toEqual("module.exports = \"a { color: rgba(255, 0, 0, 1.0) }\\n\"")
57-
expect(src).toMatchSnapshot()
58-
})
56+
expect(src).toEqual('module.exports = "a { color: rgba(255, 0, 0, 1.0) }\\n"')
57+
expect(src).toMatchSnapshot()
58+
})
5959
})
6060

6161
test('Plugins - {Function} - {Object}', () => {
@@ -69,10 +69,10 @@ describe('Options', () => {
6969
}
7070

7171
return webpack('css/index.js', config).then((stats) => {
72-
const src = loader(stats).src
72+
const src = loader(stats).src
7373

74-
expect(src).toEqual("module.exports = \"a { color: rgba(255, 0, 0, 1.0) }\\n\"")
75-
expect(src).toMatchSnapshot()
76-
})
74+
expect(src).toEqual('module.exports = "a { color: rgba(255, 0, 0, 1.0) }\\n"')
75+
expect(src).toMatchSnapshot()
76+
})
7777
})
7878
})

‎test/options/sourceMap.test.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ describe('Options', () => {
1515
}
1616

1717
return webpack('css/index.js', config).then((stats) => {
18-
const src = loader(stats).src
18+
const src = loader(stats).src
1919

20-
expect(src).toEqual("module.exports = \"a { color: rgba(255, 0, 0, 1.0) }\\n\"")
21-
expect(src).toMatchSnapshot()
20+
expect(src).toEqual('module.exports = "a { color: rgba(255, 0, 0, 1.0) }\\n"')
21+
expect(src).toMatchSnapshot()
2222

23-
const map = loader(stats).map
23+
const map = loader(stats).map
2424

25-
map.file = path.relative(__dirname, map.file)
26-
map.sources = map.sources.map((src) => path.relative(__dirname, src))
25+
map.file = path.relative(__dirname, map.file)
26+
map.sources = map.sources.map((src) => path.relative(__dirname, src))
2727

28-
expect(map).toMatchSnapshot()
29-
})
28+
expect(map).toMatchSnapshot()
29+
})
3030
})
3131

3232
test('Sourcemap - {String}', () => {
@@ -39,10 +39,10 @@ describe('Options', () => {
3939
}
4040

4141
return webpack('css/index.js', config).then((stats) => {
42-
const src = loader(stats).src
42+
const src = loader(stats).src
4343

44-
expect(src).toEqual("module.exports = \"a { color: rgba(255, 0, 0, 1.0) }\\n\\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QvZml4dHVyZXMvY3NzL3N0eWxlLmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxJQUFJLDJCQUFZLEVBQUUiLCJmaWxlIjoidGVzdC9maXh0dXJlcy9jc3Mvc3R5bGUuY3NzIiwic291cmNlc0NvbnRlbnQiOlsiYSB7IGNvbG9yOiBibGFjayB9XG4iXX0= */\"")
45-
expect(src).toMatchSnapshot()
46-
})
44+
expect(src).toEqual('module.exports = "a { color: rgba(255, 0, 0, 1.0) }\\n\\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QvZml4dHVyZXMvY3NzL3N0eWxlLmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxJQUFJLDJCQUFZLEVBQUUiLCJmaWxlIjoidGVzdC9maXh0dXJlcy9jc3Mvc3R5bGUuY3NzIiwic291cmNlc0NvbnRlbnQiOlsiYSB7IGNvbG9yOiBibGFjayB9XG4iXX0= */"')
45+
expect(src).toMatchSnapshot()
46+
})
4747
})
4848
})

‎test/options/stringifier.test.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ describe('Options', () => {
1414
}
1515

1616
return webpack('css/index.js', config).then((stats) => {
17-
const src = loader(stats).src
17+
const src = loader(stats).src
1818

19-
expect(src).toEqual("module.exports = \"a color: black\\n\"")
20-
expect(src).toMatchSnapshot()
21-
})
19+
expect(src).toEqual('module.exports = "a color: black\\n"')
20+
expect(src).toMatchSnapshot()
21+
})
2222
})
2323

2424
test('Stringifier - {Object}', () => {
@@ -32,10 +32,10 @@ describe('Options', () => {
3232
}
3333

3434
return webpack('css/index.js', config).then((stats) => {
35-
const src = loader(stats).src
35+
const src = loader(stats).src
3636

37-
expect(src).toEqual("module.exports = \"a color: black\\n\"")
38-
expect(src).toMatchSnapshot()
39-
})
37+
expect(src).toEqual('module.exports = "a color: black\\n"')
38+
expect(src).toMatchSnapshot()
39+
})
4040
})
4141
})

‎test/options/syntax.test.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ describe('Options', () => {
1414
}
1515

1616
return webpack('sss/index.js', config).then((stats) => {
17-
const src = loader(stats).src
17+
const src = loader(stats).src
1818

19-
expect(src).toEqual("module.exports = \"a\\n color: black\\n\"")
20-
expect(src).toMatchSnapshot()
21-
})
19+
expect(src).toEqual('module.exports = "a\\n color: black\\n"')
20+
expect(src).toMatchSnapshot()
21+
})
2222
})
2323

2424
test('Syntax - {Object}', () => {
@@ -32,10 +32,10 @@ describe('Options', () => {
3232
}
3333

3434
return webpack('sss/index.js', config).then((stats) => {
35-
const src = loader(stats).src
35+
const src = loader(stats).src
3636

37-
expect(src).toEqual("module.exports = \"a\\n color: black\\n\"")
38-
expect(src).toMatchSnapshot()
39-
})
37+
expect(src).toEqual('module.exports = "a\\n color: black\\n"')
38+
expect(src).toMatchSnapshot()
39+
})
4040
})
4141
})

0 commit comments

Comments
 (0)
Please sign in to comment.