diff --git a/eslint.config.mjs b/eslint.config.mjs index 8cafaa35a9b..e9ac911a666 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -9,7 +9,6 @@ import toolsConfig from './tools/eslint.config_partial.mjs'; import { noRestrictedSyntaxCommonAll, noRestrictedSyntaxCommonLib, - noRestrictedSyntaxCommonTest, requireEslintTool, resolveEslintTool, } from './tools/eslint.config_utils.mjs'; @@ -191,12 +190,15 @@ export default [ property: '__defineSetter__', message: '__defineSetter__ is deprecated.', }, + { + property: 'webcrypto', + message: 'Use `globalThis.crypto`.', + }, ], 'no-restricted-syntax': [ 'error', ...noRestrictedSyntaxCommonAll, ...noRestrictedSyntaxCommonLib, - ...noRestrictedSyntaxCommonTest, ], 'no-self-compare': 'error', 'no-template-curly-in-string': 'error', diff --git a/test/eslint.config_partial.mjs b/test/eslint.config_partial.mjs index 54646463f76..b1db96b20b8 100644 --- a/test/eslint.config_partial.mjs +++ b/test/eslint.config_partial.mjs @@ -2,7 +2,6 @@ import { noRestrictedSyntaxCommonAll, - noRestrictedSyntaxCommonTest, requireEslintTool, } from '../tools/eslint.config_utils.mjs'; @@ -26,7 +25,6 @@ export default [ 'no-restricted-syntax': [ 'error', ...noRestrictedSyntaxCommonAll, - ...noRestrictedSyntaxCommonTest, { selector: "CallExpression:matches([callee.name='deepStrictEqual'], [callee.property.name='deepStrictEqual']):matches([arguments.1.type='Literal']:not([arguments.1.regex]), [arguments.1.type='Identifier'][arguments.1.name='undefined'])", message: 'Use strictEqual instead of deepStrictEqual for literals or undefined.', diff --git a/test/parallel/test-global-webcrypto-classes.js b/test/parallel/test-global-webcrypto-classes.js index 2b929680019..ae1a846fa6a 100644 --- a/test/parallel/test-global-webcrypto-classes.js +++ b/test/parallel/test-global-webcrypto-classes.js @@ -7,7 +7,6 @@ if (!common.hasCrypto) const assert = require('assert'); -/* eslint-disable no-restricted-syntax */ const webcrypto = require('internal/crypto/webcrypto'); assert.strictEqual(Crypto, webcrypto.Crypto); assert.strictEqual(CryptoKey, webcrypto.CryptoKey); diff --git a/test/parallel/test-global-webcrypto.js b/test/parallel/test-global-webcrypto.js index 2afb0ac5588..9eb18ca9d1c 100644 --- a/test/parallel/test-global-webcrypto.js +++ b/test/parallel/test-global-webcrypto.js @@ -7,7 +7,7 @@ if (!common.hasCrypto) const assert = require('assert'); const crypto = require('crypto'); -/* eslint-disable no-restricted-syntax */ +/* eslint-disable no-restricted-properties */ assert.strictEqual(globalThis.crypto, crypto.webcrypto); assert.strictEqual(Crypto, crypto.webcrypto.constructor); assert.strictEqual(SubtleCrypto, crypto.webcrypto.subtle.constructor); diff --git a/tools/eslint.config_utils.mjs b/tools/eslint.config_utils.mjs index 9109acfa3cd..aab2cac4c32 100644 --- a/tools/eslint.config_utils.mjs +++ b/tools/eslint.config_utils.mjs @@ -24,12 +24,3 @@ export const noRestrictedSyntaxCommonLib = [ message: '`setTimeout()` must be invoked with at least two arguments.', }, ]; - -export const noRestrictedSyntaxCommonTest = [ - { - // TODO(@panva): move this to no-restricted-properties - // when https://github.com/eslint/eslint/issues/16412 is fixed. - selector: "Identifier[name='webcrypto']", - message: 'Use `globalThis.crypto`.', - }, -];