Skip to content

Commit 1eed44c

Browse files
committed
Use eslint-config-airbnb-base instead of standard
1 parent 0ccf3f5 commit 1eed44c

File tree

4 files changed

+30
-22
lines changed

4 files changed

+30
-22
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
index.js
2+
coverage/

.eslintrc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"extends": "standard"
2+
"extends": "airbnb-base",
3+
"rules": {
4+
"max-len": ["error", 140]
5+
}
36
}

addAssetHtmlPlugin.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
import path from 'path'
2-
import Promise from 'bluebird'
1+
import path from 'path';
2+
import Promise from 'bluebird';
33

44
// Copied from html-webpack-plugin
5-
function resolvePublicPath (compilation, filename) {
5+
function resolvePublicPath(compilation, filename) {
66
let publicPath = typeof compilation.options.output.publicPath !== 'undefined'
77
? compilation.options.output.publicPath
8-
: path.relative(path.dirname(filename), '.')
8+
: path.relative(path.dirname(filename), '.');
99

1010
if (publicPath.length && publicPath.substr(-1, 1) !== '/') {
11-
publicPath += '/'
11+
publicPath += '/';
1212
}
13-
return publicPath
13+
return publicPath;
1414
}
1515

16-
function addFileToAssets (htmlPluginData, compilation, { filename, typeOfAsset = 'js', includeSourcemap = true } = {}) {
17-
if (!filename) return compilation.errors.push(new Error('No filename defined'))
16+
function addFileToAssets(htmlPluginData, compilation, { filename, typeOfAsset = 'js', includeSourcemap = true } = {}) {
17+
if (!filename) return compilation.errors.push(new Error('No filename defined'));
1818

1919
return htmlPluginData.plugin.addFileToAssets(filename, compilation)
20-
.then((filename) => htmlPluginData.assets[typeOfAsset].unshift(`${resolvePublicPath(compilation, filename)}${filename}`))
20+
.then(addedFilename => htmlPluginData.assets[typeOfAsset].unshift(`${resolvePublicPath(compilation, addedFilename)}${addedFilename}`))
2121
.then(() => {
2222
if (includeSourcemap) {
23-
return htmlPluginData.plugin.addFileToAssets(`${filename}.map`, compilation)
23+
return htmlPluginData.plugin.addFileToAssets(`${filename}.map`, compilation);
2424
}
25-
return null
26-
})
25+
return null;
26+
});
2727
}
2828

2929
export default class AddAssetHtmlPlugin {
30-
constructor (assets = []) {
31-
this.assets = Array.isArray(assets) ? assets.slice().reverse() : [assets]
30+
constructor(assets = []) {
31+
this.assets = Array.isArray(assets) ? assets.slice().reverse() : [assets];
3232
}
3333

34-
apply (compiler) {
35-
compiler.plugin('compilation', (compilation) => {
34+
apply(compiler) {
35+
compiler.plugin('compilation', compilation => {
3636
compilation.plugin('html-webpack-plugin-before-html-generation', (htmlPluginData, callback) => {
3737
Promise.mapSeries(this.assets, asset => addFileToAssets(htmlPluginData, compilation, asset))
38-
.then(() => callback(null, htmlPluginData))
39-
})
40-
})
38+
.then(() => callback(null, htmlPluginData));
39+
});
40+
});
4141
}
4242
}

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
],
88
"scripts": {
99
"compile": "babel addAssetHtmlPlugin.js -o index.js",
10-
"lint": "standard",
10+
"lint": "node-version-gte-4 && eslint . || node-version-lt-4",
1111
"prepublish": "not-in-install && npm run compile || in-install",
1212
"postpublish": "git push --follow-tags",
1313
"test": "npm run lint"
@@ -31,9 +31,12 @@
3131
"babel-cli": "^6.9.0",
3232
"babel-plugin-add-module-exports": "^0.2.1",
3333
"babel-preset-es2015": "^6.9.0",
34+
"eslint": "^3.0.1",
35+
"eslint-config-airbnb-base": "^4.0.0",
36+
"eslint-plugin-import": "^1.10.2",
3437
"html-webpack-plugin": "^2.10.0",
3538
"in-publish": "^2.0.0",
36-
"standard": "^7.1.1"
39+
"node-version-check": "^1.0.1"
3740
},
3841
"peerDependencies": {
3942
"html-webpack-plugin": "^2.10.0"

0 commit comments

Comments
 (0)