Commit 65b18b31 authored by Robert Knight's avatar Robert Knight

Add an ESLint rule to prevent additions of new `bind` usages in annotator/ code

Add a lint rule to ensure that new developers do not use `bind` in
annotator/ code. This only applies to first-party code. Third-party code
used in the annotation layer is still at-risk of being broken by old
`bind` polyfills.
parent 0f148805
'use strict';
module.exports = {
rules: {
'no-restricted-properties': [2, {
// Disable `bind` usage in annotator/ code to prevent unexpected behavior
// due to broken bind polyfills. See
// https://github.com/hypothesis/client/issues/245
property: 'bind',
message: 'Use function expressions instead of bind() in annotator/ code'
}]
}
};
......@@ -29,8 +29,8 @@ describe('AnnotationSync', function() {
};
options = {
on: emitter.on.bind(emitter),
emit: emitter.emit.bind(emitter),
on: emitter.on.bind(emitter), // eslint-disable-line no-restricted-properties
emit: emitter.emit.bind(emitter), // eslint-disable-line no-restricted-properties
};
publish = function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment