mirror of
https://github.com/nodejs/node.git
synced 2024-11-30 15:30:56 +01:00
a2c4244e3d
PR-URL: https://github.com/nodejs/node/pull/31193 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com>
85 lines
3.9 KiB
YAML
85 lines
3.9 KiB
YAML
env:
|
|
es6: true
|
|
|
|
rules:
|
|
prefer-object-spread: error
|
|
no-buffer-constructor: error
|
|
no-mixed-operators:
|
|
- error
|
|
- groups: [[ "&&", "||" ]]
|
|
no-restricted-globals:
|
|
- error
|
|
- name: Array
|
|
message: "Use `const { Array } = primordials;` instead of the global."
|
|
- name: BigInt
|
|
message: "Use `const { BigInt } = primordials;` instead of the global."
|
|
- name: BigInt64Array
|
|
message: "Use `const { BigInt64Array } = primordials;` instead of the global."
|
|
- name: BigUint64Array
|
|
message: "Use `const { BigUint64Array } = primordials;` instead of the global."
|
|
- name: Boolean
|
|
message: "Use `const { Boolean } = primordials;` instead of the global."
|
|
- name: Error
|
|
message: "Use `const { Error } = primordials;` instead of the global."
|
|
- name: Float32Array
|
|
message: "Use `const { Float32Array } = primordials;` instead of the global."
|
|
- name: JSON
|
|
message: "Use `const { JSON } = primordials;` instead of the global."
|
|
- name: Map
|
|
message: "Use `const { Map } = primordials;` instead of the global."
|
|
- name: Math
|
|
message: "Use `const { Math } = primordials;` instead of the global."
|
|
- name: Number
|
|
message: "Use `const { Number } = primordials;` instead of the global."
|
|
- name: Object
|
|
message: "Use `const { Object } = primordials;` instead of the global."
|
|
- name: Promise
|
|
message: "Use `const { Promise } = primordials;` instead of the global."
|
|
- name: Reflect
|
|
message: "Use `const { Reflect } = primordials;` instead of the global."
|
|
- name: RegExp
|
|
message: "Use `const { RegExp } = primordials;` instead of the global."
|
|
- name: Set
|
|
message: "Use `const { Set } = primordials;` instead of the global."
|
|
- name: Symbol
|
|
message: "Use `const { Symbol } = primordials;` instead of the global."
|
|
- name: Uint16Array
|
|
message: "Use `const { Uint16Array } = primordials;` instead of the global."
|
|
- name: WeakMap
|
|
message: "Use `const { WeakMap } = primordials;` instead of the global."
|
|
- name: WeakSet
|
|
message: "Use `const { WeakSet } = 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."
|
|
- selector: "AssignmentExpression:matches([left.name='prepareStackTrace'], [left.property.name='prepareStackTrace'])"
|
|
message: "Use 'overrideStackTrace' from 'lib/internal/errors.js' instead of 'Error.prepareStackTrace'."
|
|
- selector: "CallExpression[callee.name='isNaN']"
|
|
message: "Use NumberIsNaN() primordial instead of the global isNaN() function."
|
|
# Custom rules in tools/eslint-rules
|
|
node-core/lowercase-name-for-primitive: error
|
|
node-core/non-ascii-character: error
|
|
globals:
|
|
Intl: false
|
|
# Parameters passed to internal modules
|
|
global: false
|
|
require: false
|
|
process: false
|
|
exports: false
|
|
module: false
|
|
internalBinding: false
|
|
primordials: false
|