Skip to content

Commit fa5d28f

Browse files
Trottrvagg
authored andcommitted
tools: enable additional lint rules
Enable additional likely-uncontroversial lint rules: * `comma-dangle` set to prohibit dangling commas on objects and arrays that are defined on a single line. Multi-line definitions can use or omit a trailing comma. * `no-unused-labels` Prohibits defining a label that is not used. * `no-path-concat` Prohibits string-concatenation using i`__dirname` and `__filename`. Use `path.join()`, `path.resolve()`, or template strings instead. * `no-new-symbol` disallow use of `new` operator with `Symbol` object. Violating this rule would result in a `TypeError` at runtime.` PR-URL: #5357 Reviewed-By: Rod Vagg <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent 365cc63 commit fa5d28f

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

.eslintrc

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ env:
55
rules:
66
# Possible Errors
77
# https://github.com/eslint/eslint/tree/master/docs/rules#possible-errors
8+
comma-dangle: [2, "only-multiline"]
89
no-control-regex: 2
910
no-debugger: 2
1011
no-dupe-args: 2
@@ -30,6 +31,7 @@ rules:
3031
no-fallthrough: 2
3132
no-octal: 2
3233
no-redeclare: 2
34+
no-unused-labels: 2
3335

3436
# Variables
3537
# http://eslint.org/docs/rules/#variables
@@ -41,6 +43,7 @@ rules:
4143
# http://eslint.org/docs/rules/#nodejs-and-commonjs
4244
no-mixed-requires: 2
4345
no-new-require: 2
46+
no-path-concat: 2
4447
no-restricted-modules: [2, "sys", "_linklist"]
4548

4649
# Stylistic Issues
@@ -71,6 +74,7 @@ rules:
7174
no-confusing-arrow: 2
7275
no-const-assign: 2
7376
no-dupe-class-members: 2
77+
no-new-symbol: 2
7478
no-this-before-super: 2
7579
prefer-const: 2
7680

test/parallel/test-fs-access.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var common = require('../common');
33
var assert = require('assert');
44
var fs = require('fs');
55
var path = require('path');
6-
var doesNotExist = __filename + '__this_should_not_exist';
6+
var doesNotExist = path.join(common.tmpDir, '__this_should_not_exist');
77
var readOnlyFile = path.join(common.tmpDir, 'read_only_file');
88
var readWriteFile = path.join(common.tmpDir, 'read_write_file');
99

test/parallel/test-fs-stat.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ fs.open('.', 'r', undefined, function(err, fd) {
6868
fs.close(fd);
6969
});
7070

71-
console.log('stating: ' + __filename);
71+
console.log(`stating: ${__filename}`);
7272
fs.stat(__filename, function(err, s) {
7373
if (err) {
7474
got_error = true;

test/parallel/test-stdio-closed.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if (process.argv[2] === 'child') {
1818
}
1919

2020
// Run the script in a shell but close stdout and stderr.
21-
var cmd = '"' + process.execPath + '" "' + __filename + '" child 1>&- 2>&-';
21+
var cmd = `"${process.execPath}" "${__filename}" child 1>&- 2>&-`;
2222
var proc = spawn('/bin/sh', ['-c', cmd], { stdio: 'inherit' });
2323

2424
proc.on('exit', common.mustCall(function(exitCode) {

0 commit comments

Comments
 (0)