@@ -11,6 +11,42 @@ rules:
1111 prefer-const : error
1212 symbol-description : off
1313
14+ no-restricted-syntax :
15+ # Config copied from .eslintrc.js
16+ - error
17+ - selector : " CallExpression:matches([callee.name='deepStrictEqual'], [callee.property.name='deepStrictEqual'])[arguments.2.type='Literal']"
18+ message : " Do not use a literal for the third argument of assert.deepStrictEqual()"
19+ - selector : " CallExpression:matches([callee.name='doesNotThrow'], [callee.property.name='doesNotThrow'])"
20+ message : " Do not use `assert.doesNotThrow()`. Write the code without the wrapper and add a comment instead."
21+ - selector : " CallExpression:matches([callee.name='doesNotReject'], [callee.property.name='doesNotReject'])"
22+ message : " Do not use `assert.doesNotReject()`. Write the code without the wrapper and add a comment instead."
23+ - selector : " CallExpression:matches([callee.name='rejects'], [callee.property.name='rejects'])[arguments.length<2]"
24+ message : " `assert.rejects()` must be invoked with at least two arguments."
25+ - selector : " CallExpression[callee.property.name='strictEqual'][arguments.2.type='Literal']"
26+ message : " Do not use a literal for the third argument of assert.strictEqual()"
27+ - selector : " CallExpression:matches([callee.name='throws'], [callee.property.name='throws'])[arguments.1.type='Literal']:not([arguments.1.regex])"
28+ message : " Use an object as second argument of `assert.throws()`."
29+ - selector : " CallExpression:matches([callee.name='throws'], [callee.property.name='throws'])[arguments.length<2]"
30+ message : " `assert.throws()` must be invoked with at least two arguments."
31+ - selector : " CallExpression[callee.name='setTimeout'][arguments.length<2]"
32+ message : " `setTimeout()` must be invoked with at least two arguments."
33+ - selector : " CallExpression[callee.name='setInterval'][arguments.length<2]"
34+ message : " `setInterval()` must be invoked with at least two arguments."
35+ - selector : " ThrowStatement > CallExpression[callee.name=/Error$/]"
36+ message : " Use `new` keyword when throwing an `Error`."
37+ - selector : " CallExpression:matches([callee.name='notDeepStrictEqual'], [callee.property.name='notDeepStrictEqual'])[arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression']):not([arguments.1.type='UnaryExpression'])"
38+ message : " The first argument should be the `actual`, not the `expected` value."
39+ - selector : " CallExpression:matches([callee.name='notStrictEqual'], [callee.property.name='notStrictEqual'])[arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression']):not([arguments.1.type='UnaryExpression'])"
40+ message : " The first argument should be the `actual`, not the `expected` value."
41+ - selector : " CallExpression:matches([callee.name='deepStrictEqual'], [callee.property.name='deepStrictEqual'])[arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression']):not([arguments.1.type='UnaryExpression'])"
42+ message : " The first argument should be the `actual`, not the `expected` value."
43+ - selector : " CallExpression:matches([callee.name='strictEqual'], [callee.property.name='strictEqual'])[arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression']):not([arguments.1.type='UnaryExpression'])"
44+ message : " The first argument should be the `actual`, not the `expected` value."
45+ - selector : " CallExpression[callee.name='isNaN']"
46+ message : " Use Number.isNaN() instead of the global isNaN() function."
47+ - selector : " VariableDeclarator > CallExpression:matches([callee.name='debuglog'], [callee.property.name='debuglog']):not([arguments.0.value='test'])"
48+ message : " Use 'test' as debuglog value in tests."
49+
1450 # Custom rules in tools/eslint-rules
1551 node-core/prefer-assert-iferror : error
1652 node-core/prefer-assert-methods : error
0 commit comments