Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.x] Backport a lot of things #20448

Closed
wants to merge 112 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
5d92fed
stream: augment BufferList.prototype
lpinca Jan 24, 2018
da3cc16
crypto: docs-only deprecate crypto.fips, replace
jasnell Jan 24, 2018
c43ce42
src: don't abort when package.json is a directory
bnoordhuis Jan 20, 2018
08cadc2
string_decoder: reimplement in C++
addaleax Feb 1, 2018
1350802
test: convert new tests to use error types
jackhorton Feb 5, 2018
bef6b16
test: formalize exposure of internal bindings
devsnek Feb 10, 2018
181d522
string_decoder: fix regressions
apapirovski Feb 12, 2018
2008a8c
src: set thread local env in CreateEnvironment
danbev Feb 5, 2018
465244f
lib,src: audit process.env in lib/ for setuid binary
j0t3x Feb 1, 2018
d37952e
module: replace magic numbers by constants
daynin Feb 14, 2018
b7da409
test: move getTTYfd() to common helpers
Fishrock123 Feb 16, 2018
2e48f36
test: actually test tty `getColorDepth()`
Fishrock123 Feb 16, 2018
d19f29f
lint: move eslint to new plugin system
devsnek Feb 4, 2018
a4d4248
net: use `_final` instead of `on('finish')`
addaleax Feb 7, 2018
8de20e0
tools: add falsely removed eslint rules
BridgeAR Feb 22, 2018
d22a97e
module: replace "magic" numbers by constants
daynin Feb 19, 2018
edb0197
test: really test the ttywrap bits of getasyncid
Fishrock123 Feb 20, 2018
b0e2fd0
doc: add new documentation lint rule
estrada9166 Feb 12, 2018
28f3cc2
fs: replace duplicate conditions by function
daynin Feb 11, 2018
5422160
doc: provide replacements for deprecated util methods
addaleax Jan 27, 2018
ef7de43
util: introduce `util.types.is[…]` type checks
addaleax Jan 27, 2018
148210f
util: assign missed deprecation number
addaleax Mar 5, 2018
3b4f4c4
assert: add rejects() and doesNotReject()
feugy Jan 11, 2018
a37beba
net: emit error on invalid address family
cjihrig Mar 17, 2018
979167c
assert: add warning about `assert.doesNotReject`
BridgeAR Mar 12, 2018
4f7a25b
assert: fix diff color output
BridgeAR Mar 20, 2018
c6fe531
test: improve tty.getColorDepth coverage
BridgeAR Mar 13, 2018
5894cd3
lib: merge stream code for http2 streams & net.Socket
aks- Mar 18, 2018
b6c47ae
lib: rename js source to lower snake_case
danbev Mar 23, 2018
34ca1ed
zlib,stream: use “official” util.types typechecks
addaleax Mar 25, 2018
ec758fc
net: track bytesWritten in C++ land
addaleax Mar 17, 2018
2bcd795
test: add regression test for large write
addaleax Mar 24, 2018
a85a08a
src: clean up `req.bytes` tracking
addaleax Mar 24, 2018
789279b
console: add table method
devsnek Jan 13, 2018
0636651
tools: add 'spaced-comment' into eslint rules
starkwang Mar 25, 2018
621a4be
build: make lint-ci work properly on Linux make
rvagg Apr 2, 2018
204b024
test: ensure failed assertions cause build to fail
not-an-aardvark Mar 28, 2018
297fcf0
assert: ensure .rejects() disallows sync throws
not-an-aardvark Mar 28, 2018
188af95
test: check all properties in common.expectsError
BridgeAR Apr 1, 2018
1401be8
errors: make message non-enumerable
BridgeAR Apr 1, 2018
3bdc9ef
fs: expose copy-on-write flags for fs.copyFile()
cjihrig Apr 2, 2018
4699e96
fs: make ReadStream throw TypeError on NaN
ryzokuken Apr 3, 2018
7b9f8fd
test: move http-client-timeout-agent to sequential
Trott Apr 4, 2018
7f8eba7
test,http: fix http dump test
mcollina Apr 5, 2018
0613902
doc: add and unify return statements in crypto.md
vsemozhetbyt Apr 6, 2018
e176e26
doc: improve buf.indexOf() documentation style
Trott Apr 7, 2018
d59398f
zlib: use `.bytesWritten` instead of `.bytesRead`
addaleax Mar 17, 2018
7b8d60f
module: fix `e.stack` error when throwing undefined or null
zhanzhenzhen Mar 11, 2018
bbba428
zlib: fix windowBits validation to allow 0 for decompression mode
anandsuresh Mar 29, 2018
5029b43
test: fix flaky http-client-timeout-agent
santigimeno Apr 6, 2018
0c354a4
assert: fix error message
BridgeAR Apr 7, 2018
8b8808b
doc: prevent a false-positive linkification
vsemozhetbyt Apr 10, 2018
439a9e6
test: add check for root user
danbev Apr 6, 2018
6889cde
doc, tools: make type parsing more strict
vsemozhetbyt Apr 8, 2018
445ff83
doc: add missing backticks around code fragments.
vsemozhetbyt Apr 11, 2018
f712fbd
doc: add and unify even more return values
vsemozhetbyt Apr 11, 2018
31f12a1
doc: improve buf.lastIndexOf() text
Trott Apr 9, 2018
b220520
doc: add quotes for event names + fix similar nits
vsemozhetbyt Apr 9, 2018
097a5b3
doc: fix parameter type format
vsemozhetbyt Apr 11, 2018
5bd6b91
doc: remove superfluous word from crypto doc
tniessen Apr 11, 2018
eaf4a19
doc: added ready events to fs/streams,net/socket
towc Apr 12, 2018
941919e
doc: fix punctuation and wrapping in buffer.md
Trott Apr 12, 2018
8cdf541
src: add node_internal.h includes for arraysize
danbev Apr 10, 2018
abd324a
net,http2: merge write error handling & property names
addaleax Apr 1, 2018
a2117a1
http2: fix ping duration calculation
jasnell Apr 11, 2018
bde436c
util: introduce `formatWithOptions()`
addaleax Mar 15, 2018
97092a9
doc: document `Console(…, ignoreErrors)` option
addaleax Mar 15, 2018
ead3f07
console: allow `options` object as constructor arg
addaleax Mar 17, 2018
c6dec0f
console: add color support
addaleax Mar 15, 2018
ae40ac5
console: auto-detect color support by default
addaleax Mar 15, 2018
5234b34
doc: move trevnorris to TSC Emeritus
trevnorris Apr 12, 2018
c1543f1
doc: add pronouns for ofrobots
ofrobots Apr 12, 2018
d2c3fef
doc: fix typo in README
tniessen Apr 4, 2018
87917ca
assert: fix actual & expected input
BridgeAR Apr 11, 2018
993b96b
doc: fix wrong response.end() at request.socket
ikasumiwt Apr 12, 2018
a0fdfee
errors: alter ERR_HTTP2_INVALID_CONNECTION_HEADERS
Apr 4, 2018
42fa546
doc: improve http.setHeader and getHeader typeinfo
Flarna Apr 9, 2018
0e40b1d
doc: add net socket write signature
Apr 12, 2018
ae3f3d7
tools: treat SIGABRT as crash
addaleax Apr 12, 2018
6963e96
doc: remove _writableState reference
apapirovski Apr 13, 2018
ecb4202
tools: stricter no-undef eslint rule
BridgeAR Apr 11, 2018
5ba1164
doc, src: sort + fill up cli options and env vars
willhayslett Apr 8, 2018
716bb7b
doc: add missing YAML keyword in v8.md metadata
vsemozhetbyt Apr 14, 2018
f59b70e
test: fix warning in dlopen-ping-pong/binding.cc
danbev Apr 12, 2018
9761782
doc: add missing type=misc top comments
vsemozhetbyt Apr 14, 2018
073f8eb
doc: include error code in buffer documentation
Trott Apr 12, 2018
541eccc
test: update keys/Makefile to clean and build all
danbev Apr 12, 2018
427c4d7
test: set clientOpts.port property
danbev Apr 3, 2018
eeb88e1
test: remove test case 0 from tls-cnnic-whitelist
danbev Apr 13, 2018
80e496f
doc: close event does not take arguments
indranil Apr 14, 2018
1a7ec4d
tools: fix broken link in icu notes
harrysarson Apr 14, 2018
1bf04dd
stream: fix incorrect comment in _stream_readable.js
vsnehil92 Apr 8, 2018
926a8a6
errors: alter ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED
Apr 4, 2018
a733657
win, tools: add nasm to boxstarter script
bzoz Apr 11, 2018
cb88439
doc: unify section structures
vsemozhetbyt Apr 14, 2018
2f5d0f1
doc: improved flow for macOS firewall script
Feb 10, 2018
b2a7e20
doc: unify format of iterables
vsemozhetbyt Apr 14, 2018
1fdb73e
test: remove expectations based on v8 headers from types test
devsnek Apr 13, 2018
f5d7f13
deps: cherry-pick 39d546a from upstream V8
devsnek Apr 13, 2018
5448499
util: introduce types.isModuleNamespaceObject
devsnek Apr 13, 2018
d37f865
assert: add direct promises support in rejects
BridgeAR Apr 8, 2018
090b85f
tools: add eslintrc rule for `assert.rejects`
BridgeAR Apr 8, 2018
11748a8
doc: improve assert documentation
BridgeAR Apr 8, 2018
ec3f4d9
deps: upgrade to c-ares v1.14.0
rvagg Apr 11, 2018
7e4f8d4
deps: c-ares float, manual ares_ssize_t definition
rvagg Sep 13, 2017
768373c
deps: c-ares float, win ipv6 bad fec0 prefix
rvagg May 15, 2013
55cd91c
doc: clarify url doc
jasnell Apr 9, 2018
efff5dc
doc: unify more headings
vsemozhetbyt Apr 15, 2018
ea1bf5c
doc: update tools/doc/README.md
vsemozhetbyt Apr 15, 2018
540ee65
doc: unify and compact some fragments in fs.md
vsemozhetbyt Apr 15, 2018
b17db08
fs: add 'close' event to FSWatcher
aleclarson Apr 9, 2018
723cfa2
stream: add pipeline and finished
mafintosh Apr 4, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ tools/remark-*
node_modules
benchmark/tmp
doc/**/*.js
!.eslintrc.js
278 changes: 278 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,278 @@
'use strict';

const Module = require('module');
const path = require('path');

const NodePlugin = require('./tools/node_modules/eslint-plugin-node-core');
NodePlugin.RULES_DIR = path.resolve(__dirname, 'tools', 'eslint-rules');

const ModuleFindPath = Module._findPath;
const hacks = [
'eslint-plugin-node-core',
'eslint-plugin-markdown',
'babel-eslint',
];
Module._findPath = (request, paths, isMain) => {
const r = ModuleFindPath(request, paths, isMain);
if (!r && hacks.includes(request)) {
try {
return require.resolve(`./tools/node_modules/${request}`);
} catch (err) {
return require.resolve(
`./tools/node_modules/eslint/node_modules/${request}`);
}
}
return r;
};

module.exports = {
root: true,
plugins: ['markdown', 'node-core'],
env: { node: true, es6: true },
parser: 'babel-eslint',
parserOptions: { sourceType: 'script' },
overrides: [
{
files: [
'doc/api/esm.md',
'*.mjs',
'test/es-module/test-esm-example-loader.js',
],
parserOptions: { sourceType: 'module' },
},
],
rules: {
// Possible Errors
// http://eslint.org/docs/rules/#possible-errors
'for-direction': 'error',
'no-control-regex': 'error',
'no-debugger': 'error',
'no-dupe-args': 'error',
'no-dupe-keys': 'error',
'no-duplicate-case': 'error',
'no-empty-character-class': 'error',
'no-ex-assign': 'error',
'no-extra-boolean-cast': 'error',
'no-extra-parens': ['error', 'functions'],
'no-extra-semi': 'error',
'no-func-assign': 'error',
'no-invalid-regexp': 'error',
'no-irregular-whitespace': 'error',
'no-obj-calls': 'error',
'no-template-curly-in-string': 'error',
'no-unexpected-multiline': 'error',
'no-unreachable': 'error',
'no-unsafe-negation': 'error',
'use-isnan': 'error',
'valid-typeof': 'error',

// Best Practices
// http://eslint.org/docs/rules/#best-practices
'accessor-pairs': 'error',
'array-callback-return': 'error',
'dot-location': ['error', 'property'],
'dot-notation': 'error',
eqeqeq: ['error', 'smart'],
'no-fallthrough': 'error',
'no-global-assign': 'error',
'no-multi-spaces': ['error', { ignoreEOLComments: true }],
'no-octal': 'error',
'no-proto': 'error',
'no-redeclare': 'error',
'no-restricted-properties': [
'error',
{
object: 'assert',
property: 'deepEqual',
message: 'Use assert.deepStrictEqual().',
},
{
object: 'assert',
property: 'notDeepEqual',
message: 'Use assert.notDeepStrictEqual().',
},
{
object: 'assert',
property: 'equal',
message: 'Use assert.astrictEqual() rather than assert.equal().',
},
{
object: 'assert',
property: 'notEqual',
message: 'Use assert.notStrictEqual() rather than assert.notEqual().',
},
{
property: '__defineGetter__',
message: '__defineGetter__ is deprecated.',
},
{
property: '__defineSetter__',
message: '__defineSetter__ is deprecated.',
}
],
'no-return-await': 'error',
'no-self-assign': 'error',
'no-self-compare': 'error',
'no-throw-literal': 'error',
'no-unused-labels': 'error',
'no-useless-call': 'error',
'no-useless-concat': 'error',
'no-useless-escape': 'error',
'no-useless-return': 'error',
'no-void': 'error',
'no-with': 'error',

// Strict Mode
// http://eslint.org/docs/rules/#strict-mode
strict: ['error', 'global'],

// Variables
// http://eslint.org/docs/rules/#variables
'no-delete-var': 'error',
'no-undef': ['error', { typeof: true }],
'no-unused-vars': ['error', { args: 'none' }],
'no-use-before-define': ['error', {
classes: true,
functions: false,
variables: false,
}],

// Node.js and CommonJS
// http://eslint.org/docs/rules/#nodejs-and-commonjs
'no-mixed-requires': 'error',
'no-new-require': 'error',
'no-path-concat': 'error',
'no-restricted-modules': ['error', 'sys'],

// Stylistic Issues
// http://eslint.org/docs/rules/#stylistic-issues'
'block-spacing': 'error',
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
'comma-dangle': ['error', 'only-multiline'],
'comma-spacing': 'error',
'comma-style': 'error',
'computed-property-spacing': 'error',
'eol-last': 'error',
'func-call-spacing': 'error',
'func-name-matching': 'error',
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
indent: ['error', 2, {
ArrayExpression: 'first',
CallExpression: { arguments: 'first' },
FunctionDeclaration: { parameters: 'first' },
FunctionExpression: { parameters: 'first' },
MemberExpression: 'off',
ObjectExpression: 'first',
SwitchCase: 1,
}],
'key-spacing': ['error', { mode: 'minimum' }],
'keyword-spacing': 'error',
'linebreak-style': ['error', 'unix'],
'max-len': ['error', {
code: 80,
ignorePattern: '^// Flags:',
ignoreRegExpLiterals: true,
ignoreUrls: true,
tabWidth: 2,
}],
'new-parens': 'error',
'no-lonely-if': 'error',
'no-mixed-spaces-and-tabs': 'error',
'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 0, maxBOF: 0 }],
/* eslint-disable max-len, quotes */
'no-restricted-syntax': [
'error',
{
selector: "CallExpression[callee.object.name='assert'][callee.property.name='doesNotThrow']",
message: "Please replace `assert.doesNotThrow()` and add a comment next to the code instead."
},
{
selector: `CallExpression[callee.object.name='assert'][callee.property.name='rejects'][arguments.length<2]`,
message: 'assert.rejects() must be invoked with at least two arguments.',
},
{
selector: `CallExpression[callee.object.name='assert'][callee.property.name='throws'][arguments.1.type='Literal']:not([arguments.1.regex])`,
message: 'Use an object as second argument of assert.throws()',
},
{
selector: `CallExpression[callee.object.name='assert'][callee.property.name='throws'][arguments.length<2]`,
message: 'assert.throws() must be invoked with at least two arguments.',
},
{
selector: `CallExpression[callee.name='setTimeout'][arguments.length<2]`,
message: 'setTimeout() must be invoked with at least two arguments.',
},
{
selector: `CallExpression[callee.name='setInterval'][arguments.length<2]`,
message: 'setInterval() must be invoked with at least 2 arguments.',
},
{
selector: 'ThrowStatement > CallExpression[callee.name=/Error$/]',
message: 'Use new keyword when throwing an Error.',
}
],
/* eslint-enable max-len, quotes */
'no-tabs': 'error',
'no-trailing-spaces': 'error',
'no-unsafe-finally': 'error',
'object-curly-spacing': ['error', 'always'],
'one-var-declaration-per-line': 'error',
'operator-linebreak': ['error', 'after'],
quotes: ['error', 'single', 'avoid-escape'],
semi: 'error',
'semi-spacing': 'error',
'space-before-blocks': ['error', 'always'],
'space-before-function-paren': ['error', {
anonymous: 'never',
named: 'never',
asyncArrow: 'always',
}],
'space-in-parens': ['error', 'never'],
'space-infix-ops': 'error',
'space-unary-ops': 'error',
'spaced-comment': ['error', 'always', {
'block': { 'balanced': true },
'exceptions': ['-']
}],
'unicode-bom': 'error',

// ECMAScript 6
// http://eslint.org/docs/rules/#ecmascript-6
'arrow-parens': ['error', 'always'],
'arrow-spacing': ['error', { before: true, after: true }],
'constructor-super': 'error',
'no-class-assign': 'error',
'no-confusing-arrow': 'error',
'no-const-assign': 'error',
'no-dupe-class-members': 'error',
'no-new-symbol': 'error',
'no-this-before-super': 'error',
'prefer-const': ['error', { ignoreReadBeforeAssign: true }],
'rest-spread-spacing': 'error',
'symbol-description': 'error',
'template-curly-spacing': 'error',

// Custom rules in from eslint-plugin-node-core
'node-core/no-unescaped-regexp-dot': 'error',
},
globals: {
COUNTER_HTTP_CLIENT_REQUEST: false,
COUNTER_HTTP_CLIENT_RESPONSE: false,
COUNTER_HTTP_SERVER_REQUEST: false,
COUNTER_HTTP_SERVER_RESPONSE: false,
COUNTER_NET_SERVER_CONNECTION: false,
COUNTER_NET_SERVER_CONNECTION_CLOSE: false,
DTRACE_HTTP_CLIENT_REQUEST: false,
DTRACE_HTTP_CLIENT_RESPONSE: false,
DTRACE_HTTP_SERVER_REQUEST: false,
DTRACE_HTTP_SERVER_RESPONSE: false,
DTRACE_NET_SERVER_CONNECTION: false,
DTRACE_NET_STREAM_END: false,
LTTNG_HTTP_CLIENT_REQUEST: false,
LTTNG_HTTP_CLIENT_RESPONSE: false,
LTTNG_HTTP_SERVER_REQUEST: false,
LTTNG_HTTP_SERVER_RESPONSE: false,
LTTNG_NET_SERVER_CONNECTION: false,
LTTNG_NET_STREAM_END: false
},
};
Loading