Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use @sinonjs/eslint-plugin-no-prototype-methods
Remove the local implementation in favour of the ESLint plugin
  • Loading branch information
mroderick committed Oct 22, 2020
1 parent 3b1fa42 commit d01f74b
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 92 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.yml
Expand Up @@ -11,7 +11,7 @@ globals:

plugins:
- ie11
- local-rules
- "@sinonjs/no-prototype-methods"
- prettier

rules:
Expand All @@ -20,4 +20,4 @@ rules:
ie11/no-for-in-const: error
ie11/no-loop-func: warn
ie11/no-weak-collections: error
local-rules/no-prototype-methods: error
"@sinonjs/no-prototype-methods/no-prototype-methods": error
3 changes: 1 addition & 2 deletions build.js
@@ -1,7 +1,6 @@
#!/usr/bin/env node
"use strict";
/* eslint-disable local-rules/no-prototype-methods */

/* eslint-disable @sinonjs/no-prototype-methods/no-prototype-methods */
var fs = require("fs");
var browserify = require("browserify");
var pkg = require("./package.json");
Expand Down
74 changes: 0 additions & 74 deletions eslint-local-rules.js

This file was deleted.

4 changes: 2 additions & 2 deletions lib/sinon/spy-formatters.js
Expand Up @@ -52,7 +52,7 @@ module.exports = {
},

n: function(spyInstance) {
// eslint-disable-next-line local-rules/no-prototype-methods
// eslint-disable-next-line @sinonjs/no-prototype-methods/no-prototype-methods
return spyInstance.toString();
},

Expand Down Expand Up @@ -96,7 +96,7 @@ module.exports = {
var calls = [];

for (var i = 0, l = spyInstance.callCount; i < l; ++i) {
// eslint-disable-next-line local-rules/no-prototype-methods
// eslint-disable-next-line @sinonjs/no-prototype-methods/no-prototype-methods
var stringifiedCall = " " + spyInstance.getCall(i).toString();
if (/\n/.test(calls[i - 1])) {
stringifiedCall = "\n" + stringifiedCall;
Expand Down
3 changes: 1 addition & 2 deletions lib/sinon/spy.js
Expand Up @@ -74,7 +74,7 @@ var spyApi = {
}
};

/* eslint-disable local-rules/no-prototype-methods */
/* eslint-disable @sinonjs/no-prototype-methods/no-prototype-methods */
var delegateToCalls = proxyCallUtil.delegateToCalls;
delegateToCalls(spyApi, "callArg", false, "callArgWith", true, function() {
throw new Error(this.toString() + " cannot call arg since it was not yet invoked.");
Expand Down Expand Up @@ -105,7 +105,6 @@ delegateToCalls(spyApi, "yieldToOn", false, "yieldToOn", true, function(property
this.toString() + " cannot yield to '" + valueToString(property) + "' since it was not yet invoked."
);
});
/* eslint-enable local-rules/no-prototype-methods */

function createSpy(func) {
var name;
Expand Down
2 changes: 1 addition & 1 deletion lib/sinon/util/core/wrap-method.js
Expand Up @@ -61,7 +61,7 @@ module.exports = function wrapMethod(object, property, method) {
}

// Firefox has a problem when using hasOwn.call on objects from other frames.
/* eslint-disable-next-line local-rules/no-prototype-methods */
/* eslint-disable-next-line @sinonjs/no-prototype-methods/no-prototype-methods */
var owned = object.hasOwnProperty ? object.hasOwnProperty(property) : hasOwnProperty(object, property);

if (hasES5Support) {
Expand Down
15 changes: 9 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -67,6 +67,7 @@
},
"devDependencies": {
"@babel/core": "^7.8.3",
"@sinonjs/eslint-plugin-no-prototype-methods": "^0.1.0",
"@sinonjs/referee": "^6.1.0",
"babel-plugin-istanbul": "^6.0.0",
"babelify": "^10.0.0",
Expand All @@ -76,7 +77,6 @@
"eslint-config-prettier": "^6.9.0",
"eslint-config-sinon": "^3.0.0",
"eslint-plugin-ie11": "^1.0.0",
"eslint-plugin-local-rules": "^0.1.0",
"eslint-plugin-mocha": "^6.1.0",
"eslint-plugin-prettier": "^3.1.0",
"esm": "^3.2.25",
Expand Down
4 changes: 2 additions & 2 deletions test/.eslintrc.yml
Expand Up @@ -5,11 +5,11 @@ extends:
- plugin:mocha/recommended

plugins:
- local-rules
- "@sinonjs/no-prototype-methods"
- mocha

rules:
local-rules/no-prototype-methods: off
"@sinonjs/no-prototype-methods/no-prototype-methods": off

max-nested-callbacks: off
no-restricted-syntax: [error, 'TryStatement']
Expand Down

0 comments on commit d01f74b

Please sign in to comment.