Skip to content

Commit 9534f6d

Browse files
committed
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 <rod@vagg.org> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
1 parent 7b0a83d commit 9534f6d

4 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎.eslintrc‎

Lines changed: 4 additions & 0 deletions
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‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var common = require('../common');
33
varassert=require('assert');
44
varfs=require('fs');
55
varpath=require('path');
6-
vardoesNotExist=__filename+'__this_should_not_exist';
6+
vardoesNotExist=path.join(common.tmpDir,'__this_should_not_exist');
77
varreadOnlyFile=path.join(common.tmpDir,'read_only_file');
88
varreadWriteFile=path.join(common.tmpDir,'read_write_file');
99

‎test/parallel/test-fs-stat.js‎

Lines changed: 1 addition & 1 deletion
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‎

Lines changed: 1 addition & 1 deletion
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-
varcmd='"'+process.execPath+'" "'+__filename+'" child 1>&- 2>&-';
21+
varcmd=`"${process.execPath}" "${__filename}" child 1>&- 2>&-`;
2222
varproc=spawn('/bin/sh',['-c',cmd],{stdio: 'inherit'});
2323

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

0 commit comments

Comments
 (0)