Skip to content

Commit

Permalink
restrict use of Object.assign
Browse files Browse the repository at this point in the history
  • Loading branch information
boneskull committed May 12, 2020
1 parent 39e9b87 commit f210e64
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
11 changes: 10 additions & 1 deletion .eslintrc.yml
Expand Up @@ -14,6 +14,11 @@ rules:
strict:
- error
- safe
# disallow Object.assign
no-restricted-properties:
- error
- object: 'Object'
property: 'assign'
overrides:
- files:
- scripts/**/*.js
Expand All @@ -31,6 +36,11 @@ overrides:
ecmaVersion: 2018
env:
browser: false
rules:
no-restricted-properties:
- off
- object: 'Object'
property: 'assign'
- files:
- esm-utils.js
parserOptions:
Expand Down Expand Up @@ -79,7 +89,6 @@ overrides:
# disallow property access of `global.<timer>.*`
- selector: '*[object.object.name=global][object.property.name=/(Date|(set|clear)(Timeout|Immediate|Interval))/]:expression'
message: *GH-237

- files:
- test/**/*.mjs
parserOptions:
Expand Down
8 changes: 2 additions & 6 deletions test/unit/mocha.spec.js
Expand Up @@ -52,7 +52,7 @@ describe('Mocha', function() {
reporterInstance = {};
opts = {reporter: sandbox.stub().returns(reporterInstance)};
Base = sandbox.stub().returns({});
runner = Object.assign(sandbox.createStubInstance(EventEmitter), {
runner = utils.assign(sandbox.createStubInstance(EventEmitter), {
run: sandbox
.stub()
.callsArgAsync(0)
Expand All @@ -65,7 +65,7 @@ describe('Mocha', function() {
// the Runner constructor is the main export, and constants is a static prop.
// we don't need the constants themselves, but the object cannot be undefined
Runner.constants = {};
suite = Object.assign(sandbox.createStubInstance(EventEmitter), {
suite = utils.assign(sandbox.createStubInstance(EventEmitter), {
slow: sandbox.stub(),
timeout: sandbox.stub(),
bail: sandbox.stub(),
Expand Down Expand Up @@ -713,8 +713,6 @@ describe('Mocha', function() {
});

describe('when a run has finished and is called again', function() {
var mocha;

beforeEach(function(done) {
mocha.run(function() {
runner.run.reset();
Expand Down Expand Up @@ -748,8 +746,6 @@ describe('Mocha', function() {
});

describe('when Mocha configured for multiple runs and multiple runs are attempted', function() {
var mocha;

beforeEach(function() {
mocha.cleanReferencesAfterRun(false);
});
Expand Down

0 comments on commit f210e64

Please sign in to comment.