@@ -19,6 +19,33 @@ rules:
1919 # # common module is mandatory in tests
2020 node-core/required-modules : [error, common]
2121
22+ no-restricted-syntax :
23+ # Config copied from .eslintrc.js
24+ - error
25+ - selector : " CallExpression[callee.object.name='assert'][callee.property.name='doesNotThrow']"
26+ message : " Please replace `assert.doesNotThrow()` and add a comment next to the code instead."
27+ - selector : " CallExpression[callee.object.name='assert'][callee.property.name='rejects'][arguments.length<2]"
28+ message : " assert.rejects() must be invoked with at least two arguments."
29+ - selector : " CallExpression[callee.object.name='assert'][callee.property.name='throws'][arguments.1.type='Literal']:not([arguments.1.regex])"
30+ message : " Use an object as second argument of assert.throws()"
31+ - selector : " CallExpression[callee.object.name='assert'][callee.property.name='throws'][arguments.length<2]"
32+ message : " assert.throws() must be invoked with at least two arguments."
33+ - selector : " CallExpression[callee.name='setTimeout'][arguments.length<2]"
34+ message : " setTimeout() must be invoked with at least two arguments."
35+ - selector : " CallExpression[callee.name='setInterval'][arguments.length<2]"
36+ message : " setInterval() must be invoked with at least 2 arguments."
37+ - selector : " ThrowStatement > CallExpression[callee.name=/Error$/]"
38+ message : " Use new keyword when throwing an Error."
39+ # Specific to /test
40+ - selector : " CallExpression[callee.object.name='assert'][callee.property.name='notDeepStrictEqual'][arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression'])"
41+ message : " The first argument should be the `actual`, not the `expected` value."
42+ - selector : " CallExpression[callee.object.name='assert'][callee.property.name='notStrictEqual'][arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression'])"
43+ message : " The first argument should be the `actual`, not the `expected` value."
44+ - selector : " CallExpression[callee.object.name='assert'][callee.property.name='deepStrictEqual'][arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression'])"
45+ message : " The first argument should be the `actual`, not the `expected` value."
46+ # TODO: Activate the `strictEqual` rule as soon as it produces less churn.
47+ # - selector: "CallExpression[callee.object.name='assert'][callee.property.name='strictEqual'][arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression'])"
48+ # message: "The first argument should be the `actual`, not the `expected` value."
2249# Global scoped methods and vars
2350globals :
2451 WebAssembly : false
0 commit comments