summaryrefslogtreecommitdiff
path: root/lib/.eslintrc.yaml
blob: 181fb9cead2090e683b5b18b24684570cd277770 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
rules:
  prefer-object-spread: error
  no-buffer-constructor: error
  no-restricted-syntax:
    # Config copied from .eslintrc.js
    - error
    - selector: "CallExpression[callee.object.name='assert'][callee.property.name='deepStrictEqual'][arguments.2.type='Literal']"
      message: "Do not use a literal for the third argument of assert.deepStrictEqual()"
    - 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='strictEqual'][arguments.2.type='Literal']"
      message: "Do not use a literal for the third argument of assert.strictEqual()"
    - 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."
    # Config specific to lib
    - selector: "NewExpression[callee.name=/Error$/]:not([callee.name=/^(AssertionError|NghttpError)$/])"
      message: "Use an error exported by the internal/errors module."
  # Custom rules in tools/eslint-rules
  node-core/require-globals: error
  node-core/no-let-in-for-declaration: error
  node-core/lowercase-name-for-primitive: error
  node-core/non-ascii-character: error
globals:
  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
  internalBinding: false
  primordials: false