Skip to content

Commit 07ea232

Browse files
blade254353074timoxley
authored andcommitted
Add webpack 2 support
1 parent 06a313f commit 07ea232

File tree

5 files changed

+2820
-18
lines changed

5 files changed

+2820
-18
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = function standardLoader (text) {
1212

1313
var config = assign(
1414
this.options.standard || {},
15-
loaderUtils.parseQuery(this.query)
15+
loaderUtils.getOptions(this)
1616
)
1717

1818
this.cacheable()

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@
1717
"license": "ISC",
1818
"devDependencies": {
1919
"babel-core": "^6.13.0",
20-
"babel-eslint": "^6.1.2",
20+
"babel-eslint": "^7.1.1",
2121
"babel-loader": "^6.2.4",
22-
"node-libs-browser": "^1.0.0",
22+
"node-libs-browser": "^2.0.0",
2323
"tape": "^4.6.0",
24-
"webpack": "^1.13.1"
24+
"webpack": "^2.2.1"
2525
},
2626
"standard": {
2727
"parser": "babel-eslint"
2828
},
2929
"dependencies": {
30-
"loader-utils": "^0.2.15",
30+
"loader-utils": "^1.0.2",
3131
"object-assign": "^4.1.0",
32-
"snazzy": "^4.0.0"
32+
"snazzy": "^6.0.0"
3333
},
3434
"peerDependencies": {
3535
"standard": "*"

test/fixtures/webpack.config.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,18 @@ const config = {
1212
},
1313

1414
module: {
15-
preLoaders: [
15+
rules: [
1616
{
1717
// set up standard-loader as a preloader
1818
test: /\.jsx?$/,
19+
enforce: 'pre',
1920
loader: path.join(__dirname, '..', '..', 'index.js'),
21+
options: {
22+
// config options passed to standard e.g.
23+
parser: 'babel-eslint'
24+
},
2025
exclude: /(node_modules|bower_components)/
21-
}
22-
],
23-
loaders: [
26+
},
2427
{
2528
// ES6 transform
2629
test: /\.jsx?$/,
@@ -29,11 +32,7 @@ const config = {
2932
cacheDirectory: true
3033
}
3134
}
32-
]
33-
},
34-
standard: {
35-
// config options passed to standard e.g.
36-
parser: 'babel-eslint'
35+
],
3736
}
3837
}
3938

test/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,19 @@ test('logs error with snazzy', function (t) {
1616
})
1717

1818
test('can disable snazzy output', function (t) {
19-
var preloader = assign({}, config.module.preLoaders[0], {
19+
assign(config.module.rules[0].options, {
2020
query: {
2121
snazzy: false
2222
}
2323
})
2424

25-
config.module.preLoaders[0] = preloader
2625
webpack(config, function (err, stats) {
2726
t.ifError(err)
2827
t.ok(stats.compilation.warnings.length, 'has warnings')
2928
t.ok(!stats.compilation.errors.length, 'has no errors')
3029
var warning = stats.compilation.warnings[0]
3130
t.ok(warning && /semicolon/gm.test(warning.warning), 'has warning about semicolon')
32-
t.equal(warning.warning.indexOf('\n\u001b'), -1, 'snazzy output disabled')
31+
t.equal(warning.warning.indexOf('\n\u001b\n'), -1, 'snazzy output disabled')
3332
t.end()
3433
})
3534
})

0 commit comments

Comments
 (0)