Skip to content

Commit 263c7b1

Browse files
committed
restrict use of Object.assign
1 parent 89cb1e7 commit 263c7b1

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.eslintrc.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ rules:
1414
strict:
1515
- error
1616
- safe
17+
# disallow Object.assign
18+
no-restricted-properties:
19+
- error
20+
- object: 'Object'
21+
property: 'assign'
1722
overrides:
1823
- files:
1924
- scripts/**/*.js
@@ -31,6 +36,11 @@ overrides:
3136
ecmaVersion: 2018
3237
env:
3338
browser: false
39+
rules:
40+
no-restricted-properties:
41+
- off
42+
- object: 'Object'
43+
property: 'assign'
3444
- files:
3545
- esm-utils.js
3646
parserOptions:
@@ -79,7 +89,6 @@ overrides:
7989
# disallow property access of `global.<timer>.*`
8090
- selector: '*[object.object.name=global][object.property.name=/(Date|(set|clear)(Timeout|Immediate|Interval))/]:expression'
8191
message: *GH-237
82-
8392
- files:
8493
- test/**/*.mjs
8594
parserOptions:

test/unit/mocha.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ describe('Mocha', function() {
5252
reporterInstance = {};
5353
opts = {reporter: sandbox.stub().returns(reporterInstance)};
5454
Base = sandbox.stub().returns({});
55-
runner = Object.assign(sandbox.createStubInstance(EventEmitter), {
55+
runner = utils.assign(sandbox.createStubInstance(EventEmitter), {
5656
run: sandbox
5757
.stub()
5858
.callsArgAsync(0)
@@ -64,7 +64,7 @@ describe('Mocha', function() {
6464
// the Runner constructor is the main export, and constants is a static prop.
6565
// we don't need the constants themselves, but the object cannot be undefined
6666
Runner.constants = {};
67-
suite = Object.assign(sandbox.createStubInstance(EventEmitter), {
67+
suite = utils.assign(sandbox.createStubInstance(EventEmitter), {
6868
slow: sandbox.stub(),
6969
timeout: sandbox.stub(),
7070
bail: sandbox.stub()

0 commit comments

Comments
 (0)