Skip to content

Commit

Permalink
Satisfy newer jshint
Browse files Browse the repository at this point in the history
Newish versions of jshint (I'm using 2.9.1) have bugfixes that cause it to discover failures that were missed by earlier versions.

 - I had to remove the `es3` option because it doesn't not work correctly alongside `esnext`
 - I created a new scope in editor.js because a switch case was shadowing outer variables
 - W083 is the "don't make functions within a loop" error, which is sensible in general, but not needed when you're sure that the functions in question will not outlive a single loop iteration.
  • Loading branch information
ef4 committed Jan 25, 2016
1 parent c4966fd commit 2eba3b5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 0 additions & 1 deletion .jshintrc
Expand Up @@ -31,7 +31,6 @@
"undef" : true, // Require all non-global variables be declared before they are used.
"unused" : true, // Warn when variables are created but not used.
"trailing" : true, // Prohibit trailing whitespaces.
"es3" : true, // Prohibit trailing commas for old IE
"esnext" : true, // Allow ES.next specific features such as `const` and `let`.

// == Relaxing Options ================================================
Expand Down
2 changes: 2 additions & 0 deletions src/js/editor/editor.js
Expand Up @@ -665,6 +665,7 @@ class Editor {
this.handleNewline(event);
break;
case key.isPrintable():
{
let { offsets: range } = this.cursor;
let { isCollapsed } = range;
let nextPosition = range.head;
Expand Down Expand Up @@ -695,6 +696,7 @@ class Editor {
event.preventDefault();
}
break;
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/js/renderers/editor-dom.js
Expand Up @@ -440,8 +440,10 @@ export default class Renderer {

method = postNode.type;
assert(`EditorDom visitor cannot handle type ${method}`, !!this.visitor[method]);
// jshint -W083
this.visitor[method](renderNode, postNode,
(...args) => this.visit(renderTree, ...args));
// jshint +W083
renderNode.markClean();
renderNode = this.nodes.shift();
}
Expand Down
4 changes: 3 additions & 1 deletion tests/helpers/dom.js
Expand Up @@ -19,7 +19,9 @@ function walkDOMUntil(topNode, conditionFn=() => {}) {
return currentElement;
}

forEach(currentElement.childNodes, (el) => stack.push(el));
// jshint -W083
forEach(currentElement.childNodes, el => stack.push(el));
// jshint +W083
}
}

Expand Down

0 comments on commit 2eba3b5

Please sign in to comment.