Skip to content

Commit e34e3e1

Browse files
committed
fix lint
1 parent 89ecb72 commit e34e3e1

18 files changed

+215
-215
lines changed

packages/fastboot/dev/memory-usage.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ session.connect();
2828

2929
let file;
3030
// uses whatever the "current" file is
31-
session.on('HeapProfiler.addHeapSnapshotChunk', (m) => {
31+
session.on('HeapProfiler.addHeapSnapshotChunk', m => {
3232
fs.writeSync(file, m.params.chunk);
3333
});
3434

packages/fastboot/src/ember-app.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class EmberApp {
165165
debug('files evaluated');
166166

167167
// Retrieve the application factory from within the sandbox
168-
let AppFactory = sandbox.run(function (ctx) {
168+
let AppFactory = sandbox.run(function(ctx) {
169169
return ctx.require('~fastboot/app-factory');
170170
});
171171

@@ -316,7 +316,7 @@ class EmberApp {
316316
if (destroyAppInstanceInMs > 0) {
317317
// start a timer to destroy the appInstance forcefully in the given ms.
318318
// This is a failure mechanism so that node process doesn't get wedged if the `visit` never completes.
319-
destroyAppInstanceTimer = setTimeout(function () {
319+
destroyAppInstanceTimer = setTimeout(function() {
320320
if (result._destroy()) {
321321
result.error = new Error(
322322
'App instance was forcefully destroyed in ' + destroyAppInstanceInMs + 'ms'
@@ -418,7 +418,7 @@ const JSON_ESCAPE = {
418418
const JSON_ESCAPE_REGEXP = /[\u2028\u2029&><]/g;
419419

420420
function escapeJSONString(string) {
421-
return string.replace(JSON_ESCAPE_REGEXP, function (match) {
421+
return string.replace(JSON_ESCAPE_REGEXP, function(match) {
422422
return JSON_ESCAPE[match];
423423
});
424424
}
@@ -432,7 +432,7 @@ function registerFastBootInfo(info, instance) {
432432
}
433433

434434
function buildScripts(filePaths) {
435-
return filePaths.filter(Boolean).map((filePath) => {
435+
return filePaths.filter(Boolean).map(filePath => {
436436
let source = fs.readFileSync(filePath, { encoding: 'utf8' });
437437

438438
return new vm.Script(source, { filename: filePath });

packages/fastboot/src/fastboot-request.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class FastBootRequest {
2323
}
2424

2525
var host = this.headers.get('host');
26-
var matchFound = this.hostWhitelist.some(function (entry) {
26+
var matchFound = this.hostWhitelist.some(function(entry) {
2727
if (entry[0] === '/' && entry.slice(-1) === '/') {
2828
var regexp = new RegExp(entry.slice(1, -1));
2929
return regexp.test(host);

packages/fastboot/src/fastboot-schema.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ function loadManifest(distPath, fastbootConfig, schemaVersion) {
127127
}
128128
}
129129

130-
let scripts = manifest.vendorFiles.concat(manifest.appFiles).map(function (file) {
130+
let scripts = manifest.vendorFiles.concat(manifest.appFiles).map(function(file) {
131131
return path.join(distPath, file);
132132
});
133133
let html = fs.readFileSync(path.join(distPath, manifest.htmlFile), 'utf8');
@@ -149,7 +149,7 @@ function loadManifest(distPath, fastbootConfig, schemaVersion) {
149149
* @param {boolean} isLegacyWhiteList flag to enable legacy behavior
150150
*/
151151
function buildWhitelistedRequire(whitelist, distPath, isLegacyWhitelist) {
152-
whitelist.forEach(function (whitelistedModule) {
152+
whitelist.forEach(function(whitelistedModule) {
153153
debug('module whitelisted; module=%s', whitelistedModule);
154154

155155
if (isLegacyWhitelist) {
@@ -161,7 +161,7 @@ function buildWhitelistedRequire(whitelist, distPath, isLegacyWhitelist) {
161161
}
162162
});
163163

164-
return function (moduleName) {
164+
return function(moduleName) {
165165
let packageName = getPackageName(moduleName);
166166
let isWhitelisted = whitelist.indexOf(packageName) > -1;
167167

packages/fastboot/src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class FastBoot {
5555
console.warn(
5656
'[DEPRECATION] Instantiating `fastboot` with a `sandboxGlobals` option has been deprecated. Please migrate to specifying `buildSandboxGlobals` instead.'
5757
);
58-
buildSandboxGlobals = (globals) => Object.assign({}, globals, options.sandboxGlobals);
58+
buildSandboxGlobals = globals => Object.assign({}, globals, options.sandboxGlobals);
5959
}
6060

6161
this.buildSandboxGlobals = buildSandboxGlobals;

packages/fastboot/src/result.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class Result {
8080
this._body,
8181
this._bodyAttributes,
8282
this._bodyClass
83-
).then((html) => {
83+
).then(html => {
8484
let docParts = html.match(HTML_HEAD_REGEX);
8585
if (!docParts || docParts.length === 1) {
8686
return [html];
@@ -97,7 +97,7 @@ class Result {
9797
let [plainBody, ...shoeboxes] = body.split(SHOEBOX_TAG_PATTERN);
9898

9999
let chunks = [head, plainBody].concat(
100-
shoeboxes.map((shoebox) => `${SHOEBOX_TAG_PATTERN}${shoebox}`)
100+
shoeboxes.map(shoebox => `${SHOEBOX_TAG_PATTERN}${shoebox}`)
101101
);
102102

103103
return chunks;
@@ -203,10 +203,10 @@ function extractExtraAttributes(element) {
203203
let klass;
204204
let attributes;
205205
if (element.attributes.length > 0) {
206-
let elementClass = element.attributes.find((attr) => attr.name === 'class');
206+
let elementClass = element.attributes.find(attr => attr.name === 'class');
207207
if (elementClass) {
208208
klass = elementClass;
209-
let otherAttrs = element.attributes.filter((attr) => attr.name !== 'class');
209+
let otherAttrs = element.attributes.filter(attr => attr.name !== 'class');
210210
if (otherAttrs.length > 0) {
211211
attributes = HTMLSerializer.attributes(otherAttrs);
212212
} else {
@@ -229,9 +229,9 @@ function missingTag(tag) {
229229
}
230230

231231
function addClass(html, regex, newClass) {
232-
return html.replace(regex, function (_, tag, attributes) {
232+
return html.replace(regex, function(_, tag, attributes) {
233233
if (/class="([^"]*)"/i.test(attributes)) {
234-
attributes = attributes.replace(/class="([^"]*)"/i, function (_, klass) {
234+
attributes = attributes.replace(/class="([^"]*)"/i, function(_, klass) {
235235
return `class="${klass} ${newClass}"`;
236236
});
237237
} else {
@@ -256,7 +256,7 @@ async function insertIntoIndexHTML(
256256
let isBodyReplaced = false;
257257
let isHeadReplaced = false;
258258

259-
html = html.replace(/<!-- EMBER_CLI_FASTBOOT_(HEAD|BODY) -->/g, function (match, tag) {
259+
html = html.replace(/<!-- EMBER_CLI_FASTBOOT_(HEAD|BODY) -->/g, function(match, tag) {
260260
if (tag === 'HEAD' && head && !isHeadReplaced) {
261261
isHeadReplaced = true;
262262
return head;
@@ -271,7 +271,7 @@ async function insertIntoIndexHTML(
271271
html = addClass(html, /<(html)(.*)>/i, htmlClass.value);
272272
}
273273
if (htmlAttributes) {
274-
html = html.replace(/<html[^>]*/i, function (match) {
274+
html = html.replace(/<html[^>]*/i, function(match) {
275275
return match + ' ' + htmlAttributes;
276276
});
277277
}
@@ -280,7 +280,7 @@ async function insertIntoIndexHTML(
280280
html = addClass(html, /<(body)(.*)>/i, bodyClass.value);
281281
}
282282
if (bodyAttributes) {
283-
html = html.replace(/<body[^>]*/i, function (match) {
283+
html = html.replace(/<body[^>]*/i, function(match) {
284284
return match + ' ' + bodyAttributes;
285285
});
286286
}

packages/fastboot/src/sandbox.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ module.exports = class Sandbox {
4646
buildWrappedConsole() {
4747
let wrappedConsole = Object.create(console);
4848

49-
wrappedConsole.error = function (...args) {
49+
wrappedConsole.error = function(...args) {
5050
console.error.apply(
5151
console,
52-
args.map(function (a) {
52+
args.map(function(a) {
5353
return typeof a === 'string' ? chalk.red(a) : a;
5454
})
5555
);

packages/fastboot/test/fastboot-dependencies-test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ const expect = require('chai').expect;
44
const fixture = require('./helpers/fixture-path');
55
const FastBoot = require('./../src/index');
66

7-
describe('FastBoot with dependencies', function () {
8-
it('it works with dependencies', function () {
7+
describe('FastBoot with dependencies', function() {
8+
it('it works with dependencies', function() {
99
var fastboot = new FastBoot({
1010
distPath: fixture('app-with-dependencies'),
1111
});
1212

1313
return fastboot
1414
.visit('/')
15-
.then((r) => r.html())
16-
.then((html) => {
15+
.then(r => r.html())
16+
.then(html => {
1717
expect(html).to.match(/https:\/\/emberjs.com/);
1818
expect(html).to.match(/FOO/);
1919
expect(html).to.match(/BAR/);

packages/fastboot/test/fastboot-headers-test.js

+15-15
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
var expect = require('chai').expect;
44
var FastBootHeaders = require('./../src/fastboot-headers.js');
55

6-
describe('FastBootHeaders', function () {
7-
it('lower normalizes the headers to lowercase', function () {
6+
describe('FastBootHeaders', function() {
7+
it('lower normalizes the headers to lowercase', function() {
88
var headers = {
99
'X-Test-Header': 'value1, value2',
1010
};
@@ -13,7 +13,7 @@ describe('FastBootHeaders', function () {
1313
expect(headers.getAll('x-test-header')).to.deep.equal(['value1, value2']);
1414
});
1515

16-
it('returns an array from getAll when header value is string', function () {
16+
it('returns an array from getAll when header value is string', function() {
1717
var headers = {
1818
'x-test-header': 'value1, value2',
1919
};
@@ -22,7 +22,7 @@ describe('FastBootHeaders', function () {
2222
expect(headers.getAll('x-test-header')).to.deep.equal(['value1, value2']);
2323
});
2424

25-
it('returns an array of header values from getAll, regardless of header name casing', function () {
25+
it('returns an array of header values from getAll, regardless of header name casing', function() {
2626
var headers = {
2727
'x-test-header': ['value1', 'value2'],
2828
};
@@ -32,7 +32,7 @@ describe('FastBootHeaders', function () {
3232
expect(headers.getAll('x-test-header')).to.deep.equal(['value1', 'value2']);
3333
});
3434

35-
it('returns an emtpy array when a header is not present', function () {
35+
it('returns an emtpy array when a header is not present', function() {
3636
var headers = {
3737
'x-test-header': ['value1', 'value2'],
3838
};
@@ -42,7 +42,7 @@ describe('FastBootHeaders', function () {
4242
expect(headers.getAll('host')).to.deep.equal([]);
4343
});
4444

45-
it('returns the first value when using get, regardless of case', function () {
45+
it('returns the first value when using get, regardless of case', function() {
4646
var headers = {
4747
'x-test-header': ['value1', 'value2'],
4848
};
@@ -52,7 +52,7 @@ describe('FastBootHeaders', function () {
5252
expect(headers.get('x-test-header')).to.equal('value1');
5353
});
5454

55-
it('returns null when using get when a header is not present', function () {
55+
it('returns null when using get when a header is not present', function() {
5656
var headers = {
5757
'x-test-header': ['value1', 'value2'],
5858
};
@@ -62,7 +62,7 @@ describe('FastBootHeaders', function () {
6262
expect(headers.get('host')).to.be.null;
6363
});
6464

65-
it('returns whether or not a header is present via has, regardless of casing', function () {
65+
it('returns whether or not a header is present via has, regardless of casing', function() {
6666
var headers = {
6767
'x-test-header': ['value1', 'value2'],
6868
};
@@ -74,7 +74,7 @@ describe('FastBootHeaders', function () {
7474
expect(headers.has('host')).to.be.false;
7575
});
7676

77-
it('appends entries onto a header, regardless of casing', function () {
77+
it('appends entries onto a header, regardless of casing', function() {
7878
var headers = new FastBootHeaders();
7979

8080
expect(headers.has('x-foo')).to.be.false;
@@ -87,7 +87,7 @@ describe('FastBootHeaders', function () {
8787
expect(headers.getAll('x-foo')).to.deep.equal(['bar', 'baz']);
8888
});
8989

90-
it('deletes entries onto a header, regardless of casing', function () {
90+
it('deletes entries onto a header, regardless of casing', function() {
9191
var headers = new FastBootHeaders();
9292

9393
headers.append('X-Foo', 'bar');
@@ -97,7 +97,7 @@ describe('FastBootHeaders', function () {
9797
expect(headers.has('x-foo')).to.be.false;
9898
});
9999

100-
it('returns an iterator for the header/value pairs when calling entries', function () {
100+
it('returns an iterator for the header/value pairs when calling entries', function() {
101101
var headers = new FastBootHeaders();
102102

103103
headers.append('X-Foo', 'foo');
@@ -111,7 +111,7 @@ describe('FastBootHeaders', function () {
111111
expect(entriesIterator.next()).to.deep.equal({ value: undefined, done: true });
112112
});
113113

114-
it('returns an iterator for keys containing all the keys', function () {
114+
it('returns an iterator for keys containing all the keys', function() {
115115
var headers = new FastBootHeaders();
116116

117117
headers.append('X-Foo', 'foo');
@@ -125,7 +125,7 @@ describe('FastBootHeaders', function () {
125125
expect(entriesIterator.next()).to.deep.equal({ value: undefined, done: true });
126126
});
127127

128-
it('sets a header, overwriting existing values, regardless of casing', function () {
128+
it('sets a header, overwriting existing values, regardless of casing', function() {
129129
var headers = new FastBootHeaders();
130130

131131
expect(headers.getAll('x-foo')).to.deep.equal([]);
@@ -141,7 +141,7 @@ describe('FastBootHeaders', function () {
141141
expect(headers.getAll('x-bar')).to.deep.equal(['baz']);
142142
});
143143

144-
it('returns an iterator for values containing all the values', function () {
144+
it('returns an iterator for values containing all the values', function() {
145145
var headers = new FastBootHeaders();
146146

147147
headers.append('X-Foo', 'foo');
@@ -155,7 +155,7 @@ describe('FastBootHeaders', function () {
155155
expect(entriesIterator.next()).to.deep.equal({ value: undefined, done: true });
156156
});
157157

158-
it('when mistakenly used `Ember.get` with an unknown property, it attempts to get the header with that name and warns the user to use `headers.get` instead', function () {
158+
it('when mistakenly used `Ember.get` with an unknown property, it attempts to get the header with that name and warns the user to use `headers.get` instead', function() {
159159
var headers = {
160160
'x-test-header': ['value1', 'value2'],
161161
};

packages/fastboot/test/fastboot-info-test.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var FastBootResponse = require('./../src/fastboot-response.js');
44
var FastBootRequest = require('./../src/fastboot-request.js');
55

66
function delayFor(ms) {
7-
let promise = new Promise((resolve) => {
7+
let promise = new Promise(resolve => {
88
setTimeout(() => {
99
resolve();
1010
}, ms);
@@ -13,7 +13,7 @@ function delayFor(ms) {
1313
return promise;
1414
}
1515

16-
describe('FastBootInfo', function () {
16+
describe('FastBootInfo', function() {
1717
var response;
1818
var request;
1919
var fastbootInfo;
@@ -22,33 +22,33 @@ describe('FastBootInfo', function () {
2222
baz: 'apple',
2323
};
2424

25-
beforeEach(function () {
25+
beforeEach(function() {
2626
response = {};
2727
request = {
2828
cookie: '',
2929
protocol: 'http',
3030
headers: {},
31-
get: function () {
31+
get: function() {
3232
return this.cookie;
3333
},
3434
};
3535

3636
fastbootInfo = new FastBootInfo(request, response, { metadata });
3737
});
3838

39-
it('has a FastBootRequest', function () {
39+
it('has a FastBootRequest', function() {
4040
expect(fastbootInfo.request).to.be.an.instanceOf(FastBootRequest);
4141
});
4242

43-
it('has a FastBootResponse', function () {
43+
it('has a FastBootResponse', function() {
4444
expect(fastbootInfo.response).to.be.an.instanceOf(FastBootResponse);
4545
});
4646

47-
it('has metadata', function () {
47+
it('has metadata', function() {
4848
expect(fastbootInfo.metadata).to.deep.equal(metadata);
4949
});
5050

51-
it('can use deferRendering', async function () {
51+
it('can use deferRendering', async function() {
5252
let steps = [];
5353

5454
steps.push('deferRendering called');

0 commit comments

Comments
 (0)