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
|
2019-11-23 10:09:05 +01:00
|
|
|
- name: Array
|
|
|
|
message: "Use `const { Array } = primordials;` instead of the global."
|
2019-12-10 14:49:23 +01:00
|
|
|
- name: BigInt
|
|
|
|
message: "Use `const { BigInt } = primordials;` instead of the global."
|
2020-01-05 13:28:09 +01:00
|
|
|
- name: BigInt64Array
|
|
|
|
message: "Use `const { BigInt64Array } = primordials;` instead of the global."
|
2020-01-05 13:59:28 +01:00
|
|
|
- name: BigUint64Array
|
|
|
|
message: "Use `const { BigUint64Array } = primordials;` instead of the global."
|
2019-11-28 08:19:55 +01:00
|
|
|
- name: Boolean
|
|
|
|
message: "Use `const { Boolean } = primordials;` instead of the global."
|
2020-01-02 19:19:02 +01:00
|
|
|
- name: Error
|
|
|
|
message: "Use `const { Error } = primordials;` instead of the global."
|
2020-01-05 14:17:14 +01:00
|
|
|
- name: Float32Array
|
|
|
|
message: "Use `const { Float32Array } = primordials;` instead of the global."
|
2019-04-04 08:13:25 +02:00
|
|
|
- name: JSON
|
|
|
|
message: "Use `const { JSON } = primordials;` instead of the global."
|
2020-01-02 14:43:02 +01:00
|
|
|
- name: Map
|
|
|
|
message: "Use `const { Map } = primordials;` instead of the global."
|
2019-04-04 08:13:25 +02:00
|
|
|
- name: Math
|
|
|
|
message: "Use `const { Math } = primordials;` instead of the global."
|
2019-11-28 10:30:51 +01:00
|
|
|
- name: Number
|
|
|
|
message: "Use `const { Number } = 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-12-13 16:46:35 +01:00
|
|
|
- name: Promise
|
|
|
|
message: "Use `const { Promise } = primordials;` instead of the global."
|
2019-04-04 08:13:25 +02:00
|
|
|
- name: Reflect
|
|
|
|
message: "Use `const { Reflect } = primordials;` instead of the global."
|
2020-01-06 03:48:14 +01:00
|
|
|
- name: RegExp
|
|
|
|
message: "Use `const { RegExp } = primordials;` instead of the global."
|
2020-01-02 14:27:54 +01:00
|
|
|
- name: Set
|
|
|
|
message: "Use `const { Set } = primordials;` instead of the global."
|
2019-11-30 16:55:29 +01:00
|
|
|
- name: Symbol
|
|
|
|
message: "Use `const { Symbol } = primordials;` instead of the global."
|
2020-01-06 03:59:50 +01:00
|
|
|
- name: Uint16Array
|
|
|
|
message: "Use `const { Uint16Array } = primordials;` instead of the global."
|
2020-01-02 15:05:55 +01:00
|
|
|
- name: WeakMap
|
|
|
|
message: "Use `const { WeakMap } = primordials;` instead of the global."
|
2020-01-02 14:48:55 +01:00
|
|
|
- name: WeakSet
|
|
|
|
message: "Use `const { WeakSet } = 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'."
|
2020-01-06 04:49:27 +01:00
|
|
|
- selector: "CallExpression[callee.name='isNaN']"
|
|
|
|
message: "Use NumberIsNaN() primordial instead of the global isNaN() function."
|
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
|
|
|
|
# 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
|