0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/lib/.eslintrc.yaml
Michaël Zasso dd89a1182f
tools: print a better message for unexpected use of globals
PR-URL: https://github.com/nodejs/node/pull/27083
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-04-06 16:15:28 +02:00

69 lines
2.4 KiB
YAML

env:
es6: true
rules:
prefer-object-spread: error
no-buffer-constructor: error
no-restricted-globals:
- error
- name: JSON
message: "Use `const { JSON } = primordials;` instead of the global."
- name: Math
message: "Use `const { Math } = primordials;` instead of the global."
- name: Reflect
message: "Use `const { Reflect } = primordials;` instead of the global."
no-restricted-syntax:
# Config copied from .eslintrc.js
- error
- selector: "CallExpression[callee.object.name='assert']:not([callee.property.name='ok']):not([callee.property.name='fail']):not([callee.property.name='ifError'])"
message: "Please only use simple assertions in ./lib"
- 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."
# Config specific to lib
- selector: "NewExpression[callee.name=/Error$/]:not([callee.name=/^(AssertionError|NghttpError)$/])"
message: "Use an error exported by the internal/errors module."
- selector: "CallExpression[callee.object.name='Error'][callee.property.name='captureStackTrace']"
message: "Please use `require('internal/errors').hideStackFrames()` instead."
# Custom rules in tools/eslint-rules
node-core/lowercase-name-for-primitive: error
node-core/non-ascii-character: error
globals:
Intl: false
# Assertions
CHECK: false
CHECK_EQ: false
CHECK_GE: false
CHECK_GT: false
CHECK_LE: false
CHECK_LT: false
CHECK_NE: false
DCHECK: false
DCHECK_EQ: false
DCHECK_GE: false
DCHECK_GT: false
DCHECK_LE: false
DCHECK_LT: false
DCHECK_NE: false
# Parameters passed to internal modules
global: false
require: false
process: false
exports: false
module: false
internalBinding: false
primordials: false
# Globals
# TODO(joyeecheung): if possible, get these in native modules
# through `require` instead of grabbing them from the global proxy.
clearTimeout: false
setTimeout: false
clearInterval: false
setInterval: false
setImmediate: false
clearImmediate: false
console: false