Skip to content

Commit 35c58d3

Browse files
committed
Migrate to ESLint
1 parent 984cba1 commit 35c58d3

File tree

11 files changed

+3698
-1386
lines changed

11 files changed

+3698
-1386
lines changed
File renamed without changes.

.eslintrc.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict';
2+
module.exports = {
3+
parserOptions: {
4+
ecmaVersion: 2017,
5+
},
6+
extends: ['eslint:recommended', 'plugin:node/recommended'],
7+
plugins: ['node'],
8+
env: {
9+
node: true,
10+
es6: true,
11+
},
12+
overrides: [
13+
{
14+
files: ['test/**/*-test.js'],
15+
env: {
16+
mocha: true,
17+
},
18+
extends: ['plugin:mocha/recommended'],
19+
plugins: ['mocha'],
20+
},
21+
]
22+
};

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules/
22
dist/
33
tmp/
4+
.eslintcache

.jshintrc

Lines changed: 0 additions & 6 deletions
This file was deleted.

.npmignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
test
22
.gitignore
3-
.jshintignore
4-
.jshintrc
3+
.eslintcache
4+
.eslintignore
5+
.eslintrc.js
56
.travis.yml

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"description": "An Express middleware for rendering Ember apps with FastBoot",
55
"main": "src/index.js",
66
"scripts": {
7-
"test": "mocha"
7+
"lint:js": "eslint --cache .",
8+
"test": "yarn lint:js && mocha"
89
},
910
"repository": {
1011
"type": "git",
@@ -29,9 +30,11 @@
2930
"chai": "^4.1.0",
3031
"chai-as-promised": "^7.1.1",
3132
"ember-cli": "^2.7.0",
33+
"eslint": "^6.8.0",
34+
"eslint-plugin-mocha": "^6.2.2",
35+
"eslint-plugin-node": "^11.0.0",
3236
"express": "^4.13.4",
3337
"mocha": "^5.0.0",
34-
"mocha-jshint": "^2.3.1",
3538
"request-promise": "^4.2.1"
3639
},
3740
"dependencies": {

test/.jshintrc

Lines changed: 0 additions & 5 deletions
This file was deleted.

test/helpers/test-http-server.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
const express = require('express');
44
const request = require('request-promise');
5-
const fastbootMiddleware = require('./../../src/index');
65

76
let serverID = 0;
87

@@ -28,21 +27,20 @@ class TestHTTPServer {
2827
}
2928

3029
if (options.recoverErrors) {
31-
app.use((err, req, res, next) => {
30+
app.use((err, req, res, next) => { // eslint-disable-line no-unused-vars
3231
res.set('x-test-recovery', 'recovered response');
3332
res.status(200);
3433
res.send('hello world');
3534
});
3635
}
3736

38-
return new Promise((resolve, reject) => {
37+
return new Promise((resolve) => {
3938
let port = options.port || 3000;
4039
let host = options.host || 'localhost';
4140

4241
let listener = app.listen(port, host, () => {
4342
let host = listener.address().address;
4443
let port = listener.address().port;
45-
let family = listener.address().family;
4644

4745
this.listener = listener;
4846
this.info = {

test/jshint-test.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/middleware-test.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22

33
const expect = require('chai').expect;
4-
const path = require('path');
54
const FastBoot = require('fastboot');
65
const fastbootMiddleware = require('./../src/index');
76
const fixture = require('./helpers/fixture-path');
@@ -85,7 +84,7 @@ describe("FastBoot", function() {
8584
.then(hotReloadApp)
8685
.then(requestSecondApp);
8786

88-
function requestFirstApp(info) {
87+
function requestFirstApp() {
8988
return server.request('/')
9089
.then(function(html) {
9190
expect(html).to.match(/Welcome to Ember/);
@@ -98,14 +97,15 @@ describe("FastBoot", function() {
9897
});
9998
}
10099

101-
function requestSecondApp(info) {
100+
function requestSecondApp() {
102101
return server.request('/')
103102
.then(function(html) {
104103
expect(html).to.match(/Goodbye from Ember/);
105104
});
106105
}
107106
});
108107

108+
/* eslint-disable mocha/no-setup-in-describe */
109109
[true, false].forEach((chunkedResponse) => {
110110
describe(`when chunked response is ${chunkedResponse ? 'enabled' : 'disabled'}`, function() {
111111
if (chunkedResponse) {
@@ -118,7 +118,7 @@ describe("FastBoot", function() {
118118

119119
return server.start()
120120
.then(() => server.request('/', { resolveWithFullResponse: true }))
121-
.then(({ body, _, headers }) => {
121+
.then(({ body, headers }) => {
122122
expect(headers['transfer-encoding']).to.eq('chunked');
123123
expect(body).to.match(/Welcome to Ember/);
124124
});
@@ -258,4 +258,5 @@ describe("FastBoot", function() {
258258
});
259259
});
260260
});
261+
/* eslint-enable mocha/no-setup-in-describe */
261262
});

0 commit comments

Comments
 (0)