Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 15754e6

Browse filesBrowse files
BridgeARMylesBorins
authored andcommitted
test,benchmark,doc: enable dot-notation rule
This enables the eslint dot-notation rule for all code instead of only in /lib. PR-URL: #18749 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matheus Marchini <matheus@sthima.com>
1 parent 7874cb0 commit 15754e6
Copy full SHA for 15754e6
Expand file treeCollapse file tree

40 files changed

+143
-135
lines changed
Open diff view settings
Collapse file

‎.eslintrc.yaml‎

Copy file name to clipboardExpand all lines: .eslintrc.yaml
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ rules:
4747
accessor-pairs: error
4848
array-callback-return: error
4949
dot-location: [error, property]
50+
dot-notation: error
5051
eqeqeq: [error, smart]
5152
no-fallthrough: error
5253
no-global-assign: error
Collapse file

‎benchmark/misc/object-property-bench.js‎

Copy file name to clipboardExpand all lines: benchmark/misc/object-property-bench.js
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict';
22

3+
/* eslint-disable dot-notation */
4+
35
const common = require('../common.js');
46

57
const bench = common.createBenchmark(main, {
Collapse file

‎doc/api/http2.md‎

Copy file name to clipboardExpand all lines: doc/api/http2.md
+3-3Lines changed: 3 additions & 3 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,7 @@ const server = http2.createServer();
12241224
server.on('stream', (stream) => {
12251225
stream.respond({ ':status': 200 }, {
12261226
getTrailers(trailers) {
1227-
trailers['ABC'] = 'some value to send';
1227+
trailers.ABC = 'some value to send';
12281228
}
12291229
});
12301230
stream.end('some data');
@@ -1308,7 +1308,7 @@ server.on('stream', (stream) => {
13081308
};
13091309
stream.respondWithFD(fd, headers, {
13101310
getTrailers(trailers) {
1311-
trailers['ABC'] = 'some value to send';
1311+
trailers.ABC = 'some value to send';
13121312
}
13131313
});
13141314
});
@@ -1416,7 +1416,7 @@ const http2 = require('http2');
14161416
const server = http2.createServer();
14171417
server.on('stream', (stream) => {
14181418
function getTrailers(trailers) {
1419-
trailers['ABC'] = 'some value to send';
1419+
trailers.ABC = 'some value to send';
14201420
}
14211421
stream.respondWithFile('/some/file',
14221422
{ 'content-type': 'text/plain' },
Collapse file

‎lib/.eslintrc.yaml‎

Copy file name to clipboardExpand all lines: lib/.eslintrc.yaml
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
rules:
2-
dot-notation: error
3-
42
# Custom rules in tools/eslint-rules
53
require-buffer: error
64
buffer-constructor: error
Collapse file

‎shas‎

Copy file name to clipboard
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
de0ed84f04
2+
469036add4
3+
2caa1f5458
4+
e83adf87f5
5+
808c05858a
6+
1e57a8d117
7+
0089860757
8+
92bf2492cd
9+
7514eb3cff
10+
6934792eb3
Collapse file

‎test/addons-napi/test_symbol/test1.js‎

Copy file name to clipboardExpand all lines: test/addons-napi/test_symbol/test1.js
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ const test_symbol = require(`./build/${common.buildType}/test_symbol`);
88
const sym = test_symbol.New('test');
99
assert.strictEqual(sym.toString(), 'Symbol(test)');
1010

11-
1211
const myObj = {};
1312
const fooSym = test_symbol.New('foo');
1413
const otherSym = test_symbol.New('bar');
15-
myObj['foo'] = 'bar';
14+
myObj.foo = 'bar';
1615
myObj[fooSym] = 'baz';
1716
myObj[otherSym] = 'bing';
1817
assert.strictEqual(myObj.foo, 'bar');
Collapse file

‎test/addons-napi/test_symbol/test2.js‎

Copy file name to clipboardExpand all lines: test/addons-napi/test_symbol/test2.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const test_symbol = require(`./build/${common.buildType}/test_symbol`);
77

88
const fooSym = test_symbol.New('foo');
99
const myObj = {};
10-
myObj['foo'] = 'bar';
10+
myObj.foo = 'bar';
1111
myObj[fooSym] = 'baz';
1212
Object.keys(myObj); // -> [ 'foo' ]
1313
Object.getOwnPropertyNames(myObj); // -> [ 'foo' ]
Collapse file

‎test/common/index.js‎

Copy file name to clipboardExpand all lines: test/common/index.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ exports.canCreateSymLink = function() {
502502
// whoami.exe needs to be the one from System32
503503
// If unix tools are in the path, they can shadow the one we want,
504504
// so use the full path while executing whoami
505-
const whoamiPath = path.join(process.env['SystemRoot'],
505+
const whoamiPath = path.join(process.env.SystemRoot,
506506
'System32', 'whoami.exe');
507507

508508
let err = false;
Collapse file

‎test/common/inspector-helper.js‎

Copy file name to clipboardExpand all lines: test/common/inspector-helper.js
+14-16Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,7 @@ class InspectorSession {
168168
reject(message.error);
169169
} else {
170170
if (message.method === 'Debugger.scriptParsed') {
171-
const script = message['params'];
172-
const scriptId = script['scriptId'];
173-
const url = script['url'];
171+
const { scriptId, url } = message.params;
174172
this._scriptsIdsByUrl.set(scriptId, url);
175173
const fileUrl = url.startsWith('file:') ?
176174
url : getURLFromFilePath(url).toString();
@@ -192,12 +190,12 @@ class InspectorSession {
192190

193191
_sendMessage(message) {
194192
const msg = JSON.parse(JSON.stringify(message)); // Clone!
195-
msg['id'] = this._nextId++;
193+
msg.id = this._nextId++;
196194
if (DEBUG)
197195
console.log('[sent]', JSON.stringify(msg));
198196

199197
const responsePromise = new Promise((resolve, reject) => {
200-
this._commandResponsePromises.set(msg['id'], { resolve, reject });
198+
this._commandResponsePromises.set(msg.id, { resolve, reject });
201199
});
202200

203201
return new Promise(
@@ -243,14 +241,14 @@ class InspectorSession {
243241
}
244242

245243
_isBreakOnLineNotification(message, line, expectedScriptPath) {
246-
if ('Debugger.paused' === message['method']) {
247-
const callFrame = message['params']['callFrames'][0];
248-
const location = callFrame['location'];
249-
const scriptPath = this._scriptsIdsByUrl.get(location['scriptId']);
244+
if ('Debugger.paused' === message.method) {
245+
const callFrame = message.params.callFrames[0];
246+
const location = callFrame.location;
247+
const scriptPath = this._scriptsIdsByUrl.get(location.scriptId);
250248
assert.strictEqual(scriptPath.toString(),
251249
expectedScriptPath.toString(),
252250
`${scriptPath} !== ${expectedScriptPath}`);
253-
assert.strictEqual(line, location['lineNumber']);
251+
assert.strictEqual(line, location.lineNumber);
254252
return true;
255253
}
256254
}
@@ -266,12 +264,12 @@ class InspectorSession {
266264
_matchesConsoleOutputNotification(notification, type, values) {
267265
if (!Array.isArray(values))
268266
values = [ values ];
269-
if ('Runtime.consoleAPICalled' === notification['method']) {
270-
const params = notification['params'];
271-
if (params['type'] === type) {
267+
if ('Runtime.consoleAPICalled' === notification.method) {
268+
const params = notification.params;
269+
if (params.type === type) {
272270
let i = 0;
273-
for (const value of params['args']) {
274-
if (value['value'] !== values[i++])
271+
for (const value of params.args) {
272+
if (value.value !== values[i++])
275273
return false;
276274
}
277275
return i === values.length;
@@ -392,7 +390,7 @@ class NodeInstance {
392390

393391
async sendUpgradeRequest() {
394392
const response = await this.httpGet(null, '/json/list');
395-
const devtoolsUrl = response[0]['webSocketDebuggerUrl'];
393+
const devtoolsUrl = response[0].webSocketDebuggerUrl;
396394
const port = await this.portPromise;
397395
return http.get({
398396
port,
Collapse file

‎test/parallel/test-cluster-fork-env.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-cluster-fork-env.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ const cluster = require('cluster');
3131

3232
if (cluster.isWorker) {
3333
const result = cluster.worker.send({
34-
prop: process.env['cluster_test_prop'],
35-
overwrite: process.env['cluster_test_overwrite']
34+
prop: process.env.cluster_test_prop,
35+
overwrite: process.env.cluster_test_overwrite
3636
});
3737

3838
assert.strictEqual(result, true);
@@ -45,7 +45,7 @@ if (cluster.isWorker) {
4545

4646
// To check that the cluster extend on the process.env we will overwrite a
4747
// property
48-
process.env['cluster_test_overwrite'] = 'old';
48+
process.env.cluster_test_overwrite = 'old';
4949

5050
// Fork worker
5151
const worker = cluster.fork({

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.