Skip to content

Commit 7600f91

Browse files
committed
💄 CS fixes
1 parent 98f915a commit 7600f91

File tree

8 files changed

+194
-263
lines changed

8 files changed

+194
-263
lines changed

.eslintrc.json

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,19 @@
66
"globals": {
77
"Promise": true
88
},
9-
"extends": "airbnb",
9+
"extends": "standard",
1010
"plugins": [ "html" ],
1111
"parser": "babel-eslint",
1212
"rules": {
13-
// indentation
1413
"indent": [ 2, 4 ],
1514

16-
// spacing
1715
"no-multiple-empty-lines": [ 2, { "max": 1, "maxEOF": 0, "maxBOF": 0 } ],
1816

19-
// code arrangement matter
2017
"no-use-before-define": [ 2, { "functions": false } ],
2118

22-
// make it meaningful
2319
"prefer-const": 1,
2420

25-
// keep it simple
26-
"complexity": [ 1, 5 ],
27-
28-
//
29-
"react/require-extension": "off",
30-
31-
"no-param-reassign": "off",
32-
33-
"no-console": "off"
21+
"complexity": [ 1, 5 ]
3422
},
3523
"settings": {
3624
"html/indent": "0",

package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,17 @@
4848
"clean-css": "^3.4.20",
4949
"coveralls": "^2.11.14",
5050
"eslint": "^3.7.1",
51-
"eslint-config-airbnb": "^13.0.0",
52-
"eslint-config-airbnb-base": "^11.0.0",
51+
"eslint-config-standard": "^6.2.1",
5352
"eslint-plugin-html": "^1.5.3",
5453
"eslint-plugin-import": "^2.2.0",
55-
"eslint-plugin-jsx-a11y": "^3.0.1",
56-
"eslint-plugin-react": "^6.4.1",
54+
"eslint-plugin-promise": "^3.4.0",
55+
"eslint-plugin-standard": "^2.0.1",
5756
"istanbul": "^0.4.5",
5857
"mocha": "^3.1.2",
5958
"mocha-lcov-reporter": "^1.2.0",
6059
"rollup": "^0.37.0",
6160
"rollup-plugin-buble": "^0.14.0",
6261
"rollup-plugin-replace": "^1.1.1",
63-
"stylus": "^0.54.5",
6462
"uglify-js": "^2.7.3",
6563
"vue-hot-reload-api": "^2.0.6"
6664
}

src/debug.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import debug from 'debug';
1+
import debug from 'debug'
22

3-
export default debug('rollup-plugin-vue');
3+
export default debug('rollup-plugin-vue')

src/index.js

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,32 @@
1-
import { createFilter } from 'rollup-pluginutils';
2-
import { writeFile } from 'fs';
3-
import MagicString from 'magic-string';
1+
import { createFilter } from 'rollup-pluginutils'
42

5-
import vueTransform from './vueTransform';
6-
import DEFAULT_OPTIONS from './options';
7-
import compileStyle from './style';
8-
import debug from './debug';
3+
import vueTransform from './vueTransform'
4+
import DEFAULT_OPTIONS from './options'
5+
import compileStyle from './style'
6+
import debug from './debug'
97

10-
function mergeOptions(options, defaults) {
8+
function mergeOptions (options, defaults) {
119
Object.keys(defaults).forEach((key) => {
12-
const val = defaults[key];
10+
const val = defaults[key]
1311

1412
if (key in options) {
1513
if (typeof options[key] === 'object') {
16-
mergeOptions(options[key], val);
14+
mergeOptions(options[key], val)
1715
}
1816
} else {
19-
options[key] = val;
17+
options[key] = val
2018
}
21-
});
19+
})
2220

23-
return options;
21+
return options
2422
}
2523

26-
export default function vue(options = {}) {
27-
debug('Yo! rolling vue!');
28-
const filter = createFilter(options.include, options.exclude);
24+
export default function vue (options = {}) {
25+
debug('Yo! rolling vue!')
26+
const filter = createFilter(options.include, options.exclude)
2927

30-
delete options.include;
31-
delete options.exclude;
28+
delete options.include
29+
delete options.exclude
3230

3331
/* eslint-disable */
3432
try {
@@ -47,31 +45,31 @@ export default function vue(options = {}) {
4745
} catch (e) {}
4846
/* eslint-enable */
4947

50-
options = mergeOptions(options, DEFAULT_OPTIONS);
48+
options = mergeOptions(options, DEFAULT_OPTIONS)
5149

52-
const styles = {};
50+
const styles = {}
5351

5452
return {
5553
name: 'vue',
56-
transform(source, id) {
54+
transform (source, id) {
5755
if (!filter(id) || !id.endsWith('.vue')) {
58-
debug(`Ignore: ${id}`);
59-
return null;
56+
debug(`Ignore: ${id}`)
57+
return null
6058
}
6159

62-
debug(`Transform: ${id}`);
60+
debug(`Transform: ${id}`)
6361

64-
const { code, css, map } = vueTransform(source, id, options);
62+
const { code, css, map } = vueTransform(source, id, options)
6563

66-
styles[id] = css;
64+
styles[id] = css
6765

68-
debug(`Transformed: ${id}`);
66+
debug(`Transformed: ${id}`)
6967

70-
return { code, map };
68+
return { code, map }
7169
},
7270

73-
ongenerate() {
74-
compileStyle(styles, options);
71+
ongenerate () {
72+
compileStyle(styles, options)
7573
}
76-
};
74+
}
7775
}

src/options.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export default {
22
htmlMinifier: {
33
customAttrSurround: [[/@/, new RegExp('')], [/:/, new RegExp('')]],
44
collapseWhitespace: true,
5-
removeComments: true,
5+
removeComments: true
66
},
77
vue: {
88
// Remove all trasforms added by vue since it's up to the user
@@ -31,7 +31,7 @@ export default {
3131
spreadRest: false,
3232
stickyRegExp: false,
3333
templateString: false,
34-
unicodeRegExp: false,
35-
},
34+
unicodeRegExp: false
35+
}
3636
}
37-
};
37+
}

src/style.js

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,42 @@
1+
import { writeFile } from 'fs'
2+
13
export default function (files, options) {
2-
if (options.css === false) {
3-
return;
4-
}
4+
if (options.css === false) {
5+
return
6+
}
57

68
// Combine all stylesheets.
7-
let css = '';
8-
const allStyles = [];
9+
let css = ''
10+
const allStyles = []
911

10-
Object.keys(files).forEach((file) => {
11-
files[file].forEach((style) => {
12-
css += style.code + '\n';
13-
allStyles.push(style);
14-
});
15-
});
12+
Object.keys(files).forEach((file) => {
13+
files[file].forEach((style) => {
14+
css += style.code + '\n'
15+
allStyles.push(style)
16+
})
17+
})
1618

1719
// Emit styles through callback
18-
if (typeof options.css === 'function') {
19-
options.css(css, allStyles);
20+
if (typeof options.css === 'function') {
21+
options.css(css, allStyles)
2022

21-
return;
22-
}
23+
return
24+
}
2325

2426
// Don't generate empty style file.
25-
if (!css.trim().length) {
26-
return;
27-
}
27+
if (!css.trim().length) {
28+
return
29+
}
2830

29-
let dest = options.css;
31+
const dest = options.css
3032

31-
if (typeof dest !== 'string') {
32-
return;
33-
}
33+
if (typeof dest !== 'string') {
34+
return
35+
}
3436

3537
// Emit styles to file
36-
writeFile(dest, css, (err) => {
37-
if (err) throw err;
38-
emitted(dest, css.length);
39-
});
40-
};
38+
writeFile(dest, css, (err) => {
39+
if (err) throw err
40+
console.log(dest, css.length)
41+
})
42+
};

0 commit comments

Comments
 (0)