test: adjust indentation for stricter linting
ESLint 4.x has stricter linting than previous versions. We are currently using the legacy indentation rules in the test directory. This commit changes the indentation of files to comply with the stricter 4.x linting and enable stricter linting in the test directory. PR-URL: https://github.com/nodejs/node/pull/14431 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
This commit is contained in:
parent
4f0b107334
commit
aa6fac68da
@ -6,7 +6,7 @@ rules:
|
|||||||
MemberExpression: off,
|
MemberExpression: off,
|
||||||
ObjectExpression: first,
|
ObjectExpression: first,
|
||||||
SwitchCase: 1}]
|
SwitchCase: 1}]
|
||||||
indent-legacy: 0
|
indent-legacy: off
|
||||||
|
|
||||||
# Custom rules in tools/eslint-rules
|
# Custom rules in tools/eslint-rules
|
||||||
require-buffer: error
|
require-buffer: error
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
## Test-specific linter rules
|
## Test-specific linter rules
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
|
# Stylistic Issues
|
||||||
|
# http://eslint.org/docs/rules/#stylistic-issues
|
||||||
|
indent: [error, 2, {ArrayExpression: first,
|
||||||
|
CallExpression: {arguments: first},
|
||||||
|
FunctionDeclaration: {parameters: first},
|
||||||
|
FunctionExpression: {parameters: first},
|
||||||
|
MemberExpression: off,
|
||||||
|
ObjectExpression: first,
|
||||||
|
SwitchCase: 1}]
|
||||||
|
indent-legacy: off
|
||||||
# ECMAScript 6
|
# ECMAScript 6
|
||||||
# http://eslint.org/docs/rules/#ecmascript-6
|
# http://eslint.org/docs/rules/#ecmascript-6
|
||||||
no-var: error
|
no-var: error
|
||||||
|
@ -61,8 +61,10 @@ if (typeof Symbol !== 'undefined' && 'hasInstance' in Symbol &&
|
|||||||
typeof Symbol.hasInstance === 'symbol') {
|
typeof Symbol.hasInstance === 'symbol') {
|
||||||
|
|
||||||
function compareToNative(theObject, theConstructor) {
|
function compareToNative(theObject, theConstructor) {
|
||||||
assert.strictEqual(addon.doInstanceOf(theObject, theConstructor),
|
assert.strictEqual(
|
||||||
(theObject instanceof theConstructor));
|
addon.doInstanceOf(theObject, theConstructor),
|
||||||
|
(theObject instanceof theConstructor)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function MyClass() {}
|
function MyClass() {}
|
||||||
|
@ -218,7 +218,8 @@ exports = module.exports = function initHooks({
|
|||||||
ondestroy,
|
ondestroy,
|
||||||
allowNoInit,
|
allowNoInit,
|
||||||
logid,
|
logid,
|
||||||
logtype } = {}) {
|
logtype
|
||||||
|
} = {}) {
|
||||||
return new ActivityCollector(process.hrtime(), {
|
return new ActivityCollector(process.hrtime(), {
|
||||||
oninit,
|
oninit,
|
||||||
onbefore,
|
onbefore,
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
/* eslint-disable indent-legacy, no-tabs */
|
/* eslint-disable indent, no-tabs */
|
||||||
'use strict';
|
'use strict';
|
||||||
require('../common');
|
require('../common');
|
||||||
|
|
||||||
|
@ -30,9 +30,10 @@ class MyBadPrimitive {
|
|||||||
deepStrictEqual(Buffer.from(new String(checkString)), check);
|
deepStrictEqual(Buffer.from(new String(checkString)), check);
|
||||||
deepStrictEqual(Buffer.from(new MyString()), check);
|
deepStrictEqual(Buffer.from(new MyString()), check);
|
||||||
deepStrictEqual(Buffer.from(new MyPrimitive()), check);
|
deepStrictEqual(Buffer.from(new MyPrimitive()), check);
|
||||||
deepStrictEqual(Buffer.from(
|
deepStrictEqual(
|
||||||
runInNewContext('new String(checkString)', { checkString })),
|
Buffer.from(runInNewContext('new String(checkString)', { checkString })),
|
||||||
check);
|
check
|
||||||
|
);
|
||||||
|
|
||||||
[
|
[
|
||||||
{},
|
{},
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
require('../common');
|
require('../common');
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
[ 'hex',
|
[
|
||||||
|
'hex',
|
||||||
'utf8',
|
'utf8',
|
||||||
'utf-8',
|
'utf-8',
|
||||||
'ascii',
|
'ascii',
|
||||||
@ -13,11 +14,13 @@ const assert = require('assert');
|
|||||||
'ucs2',
|
'ucs2',
|
||||||
'ucs-2',
|
'ucs-2',
|
||||||
'utf16le',
|
'utf16le',
|
||||||
'utf-16le' ].forEach((enc) => {
|
'utf-16le'
|
||||||
|
].forEach((enc) => {
|
||||||
assert.strictEqual(Buffer.isEncoding(enc), true);
|
assert.strictEqual(Buffer.isEncoding(enc), true);
|
||||||
});
|
});
|
||||||
|
|
||||||
[ 'utf9',
|
[
|
||||||
|
'utf9',
|
||||||
'utf-7',
|
'utf-7',
|
||||||
'Unicode-FTW',
|
'Unicode-FTW',
|
||||||
'new gnu gun',
|
'new gnu gun',
|
||||||
@ -28,6 +31,7 @@ const assert = require('assert');
|
|||||||
[],
|
[],
|
||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
-1 ].forEach((enc) => {
|
-1
|
||||||
|
].forEach((enc) => {
|
||||||
assert.strictEqual(Buffer.isEncoding(enc), false);
|
assert.strictEqual(Buffer.isEncoding(enc), false);
|
||||||
});
|
});
|
||||||
|
@ -6,6 +6,5 @@ const assert = require('assert');
|
|||||||
assert.throws(() => new Buffer(42, 'utf8'), common.expectsError({
|
assert.throws(() => new Buffer(42, 'utf8'), common.expectsError({
|
||||||
code: 'ERR_INVALID_ARG_TYPE',
|
code: 'ERR_INVALID_ARG_TYPE',
|
||||||
type: TypeError,
|
type: TypeError,
|
||||||
message: 'The "string" argument must be of type string. ' +
|
message: 'The "string" argument must be of type string. Received type number'
|
||||||
'Received type number'
|
|
||||||
}));
|
}));
|
||||||
|
@ -8,11 +8,11 @@ if (!common.hasCrypto)
|
|||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
const childProcess = require('child_process');
|
const childProcess = require('child_process');
|
||||||
const result = childProcess.spawnSync(process.execPath, [
|
const result = childProcess.spawnSync(
|
||||||
'--use-bundled-ca',
|
process.execPath,
|
||||||
'--use-openssl-ca',
|
[ '--use-bundled-ca', '--use-openssl-ca', '-p', 'process.version' ],
|
||||||
'-p', 'process.version'],
|
{ encoding: 'utf8' }
|
||||||
{ encoding: 'utf8' });
|
);
|
||||||
|
|
||||||
assert.strictEqual(result.stderr, `${process.execPath
|
assert.strictEqual(result.stderr, `${process.execPath
|
||||||
}: either --use-openssl-ca or --use-bundled-ca can be used, not both${os.EOL}`
|
}: either --use-openssl-ca or --use-bundled-ca can be used, not both${os.EOL}`
|
||||||
|
@ -5,8 +5,10 @@ const common = require('../common');
|
|||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const child_process = require('child_process');
|
const child_process = require('child_process');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const cp = child_process.spawn(process.execPath,
|
const cp = child_process.spawn(
|
||||||
[path.resolve(__dirname, 'test-stdin-pause-resume.js')]);
|
process.execPath,
|
||||||
|
[path.resolve(__dirname, 'test-stdin-pause-resume.js')]
|
||||||
|
);
|
||||||
|
|
||||||
cp.on('exit', common.mustCall((code) => {
|
cp.on('exit', common.mustCall((code) => {
|
||||||
assert.strictEqual(code, 0);
|
assert.strictEqual(code, 0);
|
||||||
|
@ -10,8 +10,10 @@ const FILE_NAME = 'node_trace.1.log';
|
|||||||
common.refreshTmpDir();
|
common.refreshTmpDir();
|
||||||
process.chdir(common.tmpDir);
|
process.chdir(common.tmpDir);
|
||||||
|
|
||||||
const proc_no_categories = cp.spawn(process.execPath,
|
const proc_no_categories = cp.spawn(
|
||||||
[ '--trace-events-enabled', '--trace-event-categories', '""', '-e', CODE ]);
|
process.execPath,
|
||||||
|
[ '--trace-events-enabled', '--trace-event-categories', '""', '-e', CODE ]
|
||||||
|
);
|
||||||
|
|
||||||
proc_no_categories.once('exit', common.mustCall(() => {
|
proc_no_categories.once('exit', common.mustCall(() => {
|
||||||
assert(!common.fileExists(FILE_NAME));
|
assert(!common.fileExists(FILE_NAME));
|
||||||
|
@ -76,13 +76,22 @@ assert.strictEqual(util.inspect({ 'a': { 'b': { 'c': 2 } } }, false, 1),
|
|||||||
'{ a: { b: [Object] } }');
|
'{ a: { b: [Object] } }');
|
||||||
assert.strictEqual(util.inspect({ 'a': { 'b': ['c'] } }, false, 1),
|
assert.strictEqual(util.inspect({ 'a': { 'b': ['c'] } }, false, 1),
|
||||||
'{ a: { b: [Array] } }');
|
'{ a: { b: [Array] } }');
|
||||||
assert.strictEqual(util.inspect(Object.create({},
|
assert.strictEqual(
|
||||||
{ visible: { value: 1, enumerable: true }, hidden: { value: 2 } })),
|
util.inspect(
|
||||||
|
Object.create(
|
||||||
|
{},
|
||||||
|
{ visible: { value: 1, enumerable: true }, hidden: { value: 2 } }
|
||||||
|
)
|
||||||
|
),
|
||||||
'{ visible: 1 }'
|
'{ visible: 1 }'
|
||||||
);
|
);
|
||||||
assert.strictEqual(util.inspect(Object.assign(new String('hello'),
|
assert.strictEqual(
|
||||||
{ [Symbol('foo')]: 123 }), { showHidden: true }),
|
util.inspect(
|
||||||
'{ [String: \'hello\'] [length]: 5, [Symbol(foo)]: 123 }');
|
Object.assign(new String('hello'), { [Symbol('foo')]: 123 }),
|
||||||
|
{ showHidden: true }
|
||||||
|
),
|
||||||
|
'{ [String: \'hello\'] [length]: 5, [Symbol(foo)]: 123 }'
|
||||||
|
);
|
||||||
|
|
||||||
assert.strictEqual(util.inspect((new JSStream())._externalStream),
|
assert.strictEqual(util.inspect((new JSStream())._externalStream),
|
||||||
'[External]');
|
'[External]');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user