2019-04-04 05:36:41 +02:00
|
|
|
env:
|
|
|
|
es6: true
|
|
|
|
|
2016-02-22 23:24:38 +01:00
|
|
|
rules:
|
2018-12-18 02:28:09 +01:00
|
|
|
prefer-object-spread: error
|
2018-12-29 00:04:00 +01:00
|
|
|
no-buffer-constructor: error
|
2019-10-03 18:35:41 +02:00
|
|
|
no-mixed-operators:
|
|
|
|
- error
|
|
|
|
- groups: [[ "&&", "||" ]]
|
2019-04-04 08:13:25 +02:00
|
|
|
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."
|
2019-04-09 09:55:53 +02:00
|
|
|
- name: Object
|
|
|
|
message: "Use `const { Object } = primordials;` instead of the global."
|
2019-04-04 08:13:25 +02:00
|
|
|
- name: Reflect
|
|
|
|
message: "Use `const { Reflect } = primordials;` instead of the global."
|
2018-03-15 14:22:43 +01:00
|
|
|
no-restricted-syntax:
|
|
|
|
# Config copied from .eslintrc.js
|
|
|
|
- error
|
2019-03-10 15:37:51 +01:00
|
|
|
- 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"
|
2018-03-15 14:22:43 +01:00
|
|
|
- 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."
|
2019-03-18 03:47:55 +01:00
|
|
|
- selector: "CallExpression[callee.object.name='Error'][callee.property.name='captureStackTrace']"
|
|
|
|
message: "Please use `require('internal/errors').hideStackFrames()` instead."
|
2019-10-03 02:24:19 +02:00
|
|
|
- selector: "AssignmentExpression:matches([left.name='prepareStackTrace'], [left.property.name='prepareStackTrace'])"
|
|
|
|
message: "Use 'overrideStackTrace' from 'lib/internal/errors.js' instead of 'Error.prepareStackTrace'."
|
2016-02-22 23:24:38 +01:00
|
|
|
# Custom rules in tools/eslint-rules
|
2018-02-04 20:38:18 +01:00
|
|
|
node-core/lowercase-name-for-primitive: error
|
|
|
|
node-core/non-ascii-character: error
|
2018-03-02 04:04:59 +01:00
|
|
|
globals:
|
2019-04-04 05:36:41 +02:00
|
|
|
Intl: false
|
|
|
|
# Assertions
|
2018-03-02 04:04:59 +01:00
|
|
|
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
|
2019-04-04 05:36:41 +02:00
|
|
|
# Parameters passed to internal modules
|
|
|
|
global: false
|
|
|
|
require: false
|
|
|
|
process: false
|
|
|
|
exports: false
|
|
|
|
module: false
|
2018-09-22 16:49:52 +02:00
|
|
|
internalBinding: false
|
2019-01-30 15:21:07 +01:00
|
|
|
primordials: false
|