Skip to content

Commit

Permalink
tools: move webcrypto into no-restricted-properties
Browse files Browse the repository at this point in the history
Since eslint fixed eslint/eslint#16412 and we
are on eslint v8.57.0 so that we can take advantage of
no-restricted-properties rule for webcrypto.
  • Loading branch information
zeeqko committed May 26, 2024
1 parent 501546e commit 40fe042
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 11 deletions.
1 change: 0 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import toolsConfig from './tools/eslint.config_partial.mjs';
import {
noRestrictedSyntaxCommonAll,
noRestrictedSyntaxCommonLib,
noRestrictedSyntaxCommonTest,
requireEslintTool,
resolveEslintTool,
} from './tools/eslint.config_utils.mjs';
Expand Down
3 changes: 2 additions & 1 deletion test/parallel/test-global-webcrypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ if (!common.hasCrypto)
const assert = require('assert');
const crypto = require('crypto');

/* eslint-disable no-restricted-syntax */
/* eslint-disable no-restricted-properties, no-restricted-syntax */
// TODO(zi): Remove no-restricted-syntax once we add no-restricted-properties to test/.eslintrc.yaml
assert.strictEqual(globalThis.crypto, crypto.webcrypto);
assert.strictEqual(Crypto, crypto.webcrypto.constructor);
assert.strictEqual(SubtleCrypto, crypto.webcrypto.subtle.constructor);
9 changes: 0 additions & 9 deletions tools/eslint.config_utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.',
},
];

0 comments on commit 40fe042

Please sign in to comment.