mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
tools: update crypo check rule
This commit updates the custom crypto-check ESLint rule to detect require() calls that come before any hasCrypto checks. PR-URL: https://github.com/nodejs/node/pull/25399 Refs: https://github.com/nodejs/node/pull/25388 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
This commit is contained in:
1 parent
3f51a60092
commit
21500a81fc
2 files changed
+24
No files matched your search
@@ -22,6 +22,14 @@ new RuleTester().run('crypto-check', rule, {
|
||||
`
|
||||
],
|
||||
invalid: [
|
||||
{
|
||||
code: 'require("common")\n' +
|
||||
'require("crypto")\n' +
|
||||
'if (!common.hasCrypto) {\n' +
|
||||
' common.skip("missing crypto");\n' +
|
||||
'}',
|
||||
errors: [{ message }]
|
||||
},
|
||||
{
|
||||
code: 'require("common")\n' +
|
||||
'require("crypto")',
|
||||
|
||||
Reference in new issue
Block a user