Skip to content
This repository was archived by the owner on Jun 24, 2024. It is now read-only.

Commit 4dee4bd

Browse files
committed
chore: update finn eslint
1 parent e36da1c commit 4dee4bd

File tree

8 files changed

+37
-38
lines changed

8 files changed

+37
-38
lines changed

.eslintignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
coverage
1+
coverage
2+
examples/assets/es6

examples/assets/es6/lib.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export function hello () {
1+
export function hello() {
22
return 'hello world';
33
}

examples/babel.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@ const assets = new Assets('./assets/es6/main.js');
99

1010
assets.transform(babelify, { presets: ['es2015'] });
1111

12-
assets.on('update', (ids) => {
13-
ids.forEach((id) => {
12+
assets.on('update', ids => {
13+
ids.forEach(id => {
1414
console.log('updated:', id);
1515
});
1616
});
1717

1818
app.use(assets.router());
1919

2020
const server = app.listen(8080, () => {
21-
console.log(`http server - Bundle at: http://localhost:${server.address().port}/js/`);
21+
console.log(
22+
`http server - Bundle at: http://localhost:${server.address().port}/js/`
23+
);
2224
});

examples/simple.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ const app = express();
88
const assets = new Assets('./assets/es5/main.js');
99

1010
// listen for events
11-
assets.on('update', (ids) => {
12-
ids.forEach((id) => {
11+
assets.on('update', ids => {
12+
ids.forEach(id => {
1313
console.log('updated:', id);
1414
});
1515
});
@@ -27,5 +27,7 @@ app.get('/', (req, res) => {
2727

2828
// start server
2929
const server = app.listen(8080, () => {
30-
console.log(`http server - Bundle at: http://localhost:${server.address().port}/js/`);
30+
console.log(
31+
`http server - Bundle at: http://localhost:${server.address().port}/js/`
32+
);
3133
});

lib/middleware.js

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@ const express = require('express');
77
const Writer = require('asset-pipe-js-writer');
88
const emits = require('emits');
99

10-
1110
module.exports = class Middleware extends EventEmitter {
12-
constructor (files = [], options = {}) {
11+
constructor(files = [], options = {}) {
1312
super();
1413

15-
this.options = Object.assign({
16-
cache: {},
17-
packageCache: {},
18-
debug: true,
19-
jsPath: '/js',
20-
}, options);
14+
this.options = Object.assign(
15+
{
16+
cache: {},
17+
packageCache: {},
18+
debug: true,
19+
jsPath: '/js',
20+
},
21+
options
22+
);
2123

2224
this.emits = emits;
2325
this.writer = new Writer(files, this.options, true);
@@ -27,7 +29,7 @@ module.exports = class Middleware extends EventEmitter {
2729
this.writer.on('update', () => {
2830
const bundler = this.writer.bundle();
2931

30-
bundler.on('error', (e) => {
32+
bundler.on('error', e => {
3133
this.emit('error', e);
3234
});
3335

@@ -48,42 +50,35 @@ module.exports = class Middleware extends EventEmitter {
4850
this.app.get(this.options.jsPath, this.js());
4951
}
5052

51-
52-
transform (transform, options) {
53+
transform(transform, options) {
5354
this.writer.transform(transform, options);
5455
}
5556

56-
57-
plugin (plugin, options) {
57+
plugin(plugin, options) {
5858
this.writer.plugin(plugin, options);
5959
}
6060

61-
62-
middelware (jsProp = 'js') {
61+
middelware(jsProp = 'js') {
6362
return (req, res, next) => {
6463
res.locals[jsProp] = this.options.jsPath;
6564
next();
6665
};
6766
}
6867

69-
70-
router () {
68+
router() {
7169
return this.app;
7270
}
7371

74-
75-
js () {
72+
js() {
7673
return (req, res, next) => {
7774
res.writeHead(200, { 'Content-Type': 'application/javascript' });
7875
const bundler = this.writer.bundle();
7976

8077
bundler.on('error', cleanup);
8178

82-
const writeStream = bundler
83-
.pipe(res)
84-
.on('error', cleanup);
79+
const writeStream = bundler.pipe(res).on('error', cleanup);
8580

86-
function cleanup (e) {
81+
function cleanup(e) {
8782
res.write(`console.error(${JSON.stringify(e.stack)})`);
8883
bundler.pause();
8984
bundler.unpipe(writeStream);

package-lock.json

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"commitizen": "^2.9.6",
3636
"cz-conventional-changelog": "^2.1.0",
3737
"eslint": "^4.11.0",
38-
"eslint-config-finn": "^2.0.0",
38+
"eslint-config-finn": "^3.0.0",
3939
"eslint-config-finn-prettier": "^3.0.1",
4040
"husky": "^0.14.3",
4141
"jest": "^21.2.1",

test/middleware.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
const Mid = require('../');
66
const tap = require('tap');
77

8-
98
// const sourceStream = (arr) => new stream.Readable({
109
// objectMode: false,
1110
// read (n) {
@@ -19,8 +18,7 @@ const tap = require('tap');
1918
// const a = ['a', 'b', 'c'];
2019
// const b = ['d', 'a', 'b', 'c'];
2120

22-
23-
tap.test('not a real test', (t) => {
21+
tap.test('not a real test', t => {
2422
const mid = new Mid();
2523
console.log(mid);
2624
t.end();

0 commit comments

Comments
 (0)