diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml index 37a43a223af2fd..c95fffd53bc547 100644 --- a/lib/.eslintrc.yaml +++ b/lib/.eslintrc.yaml @@ -57,6 +57,7 @@ rules: into: Number - name: JSON - name: Map + into: Safe - name: Math - name: Number - name: Object @@ -70,6 +71,7 @@ rules: - name: Reflect - name: RegExp - name: Set + into: Safe - name: String - name: Symbol - name: SyntaxError @@ -80,7 +82,9 @@ rules: - name: Uint8ClampedArray - name: URIError - name: WeakMap + into: Safe - name: WeakSet + into: Safe globals: Intl: false # Parameters passed to internal modules diff --git a/test/parallel/test-eslint-prefer-primordials.js b/test/parallel/test-eslint-prefer-primordials.js index d9417e857c2089..6a28f541e4de84 100644 --- a/test/parallel/test-eslint-prefer-primordials.js +++ b/test/parallel/test-eslint-prefer-primordials.js @@ -77,6 +77,10 @@ new RuleTester({ `, options: [{ name: 'Reflect' }], }, + { + code: 'const { Map } = primordials; new Map()', + options: [{ name: 'Map', into: 'Safe' }], + }, ], invalid: [ { @@ -154,5 +158,10 @@ new RuleTester({ options: [{ name: 'Reflect' }], errors: [{ message: /const { ReflectOwnKeys } = primordials/ }] }, + { + code: 'new Map()', + options: [{ name: 'Map', into: 'Safe' }], + errors: [{ message: /const { SafeMap } = primordials/ }] + }, ] });