Skip to content

Commit ac205e6

Browse files
adrianheinemarijnh
authored andcommitted
Remove semicolons
1 parent 7955ead commit ac205e6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+4595
-4595
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"lint": "bin/lint"
1616
},
1717
"devDependencies": {
18-
"blint": ">=0.1.1",
18+
"blint": "^0.5.1",
1919
"node-static": "0.6.0",
2020
"phantomjs-prebuilt": "^2.1.12",
2121
"rollup": "^0.34.10",

src/codemirror.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import { CodeMirror } from "./edit/main";
1+
import { CodeMirror } from "./edit/main"
22

3-
export default CodeMirror;
3+
export default CodeMirror

src/display/Display.js

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,105 @@
1-
import { gecko, ie, ie_version, mobile, webkit } from "../util/browser";
2-
import { elt } from "../util/dom";
3-
import { scrollerGap } from "../util/misc";
1+
import { gecko, ie, ie_version, mobile, webkit } from "../util/browser"
2+
import { elt } from "../util/dom"
3+
import { scrollerGap } from "../util/misc"
44

55
// The display handles the DOM integration, both for input reading
66
// and content drawing. It holds references to DOM nodes and
77
// display-related state.
88

99
export function Display(place, doc, input) {
10-
var d = this;
11-
this.input = input;
10+
var d = this
11+
this.input = input
1212

1313
// Covers bottom-right square when both scrollbars are present.
14-
d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler");
15-
d.scrollbarFiller.setAttribute("cm-not-content", "true");
14+
d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler")
15+
d.scrollbarFiller.setAttribute("cm-not-content", "true")
1616
// Covers bottom of gutter when coverGutterNextToScrollbar is on
1717
// and h scrollbar is present.
18-
d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler");
19-
d.gutterFiller.setAttribute("cm-not-content", "true");
18+
d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler")
19+
d.gutterFiller.setAttribute("cm-not-content", "true")
2020
// Will contain the actual code, positioned to cover the viewport.
21-
d.lineDiv = elt("div", null, "CodeMirror-code");
21+
d.lineDiv = elt("div", null, "CodeMirror-code")
2222
// Elements are added to these to represent selection and cursors.
23-
d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
24-
d.cursorDiv = elt("div", null, "CodeMirror-cursors");
23+
d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1")
24+
d.cursorDiv = elt("div", null, "CodeMirror-cursors")
2525
// A visibility: hidden element used to find the size of things.
26-
d.measure = elt("div", null, "CodeMirror-measure");
26+
d.measure = elt("div", null, "CodeMirror-measure")
2727
// When lines outside of the viewport are measured, they are drawn in this.
28-
d.lineMeasure = elt("div", null, "CodeMirror-measure");
28+
d.lineMeasure = elt("div", null, "CodeMirror-measure")
2929
// Wraps everything that needs to exist inside the vertically-padded coordinate system
3030
d.lineSpace = elt("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],
31-
null, "position: relative; outline: none");
31+
null, "position: relative; outline: none")
3232
// Moved around its parent to cover visible view.
33-
d.mover = elt("div", [elt("div", [d.lineSpace], "CodeMirror-lines")], null, "position: relative");
33+
d.mover = elt("div", [elt("div", [d.lineSpace], "CodeMirror-lines")], null, "position: relative")
3434
// Set to the height of the document, allowing scrolling.
35-
d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
36-
d.sizerWidth = null;
35+
d.sizer = elt("div", [d.mover], "CodeMirror-sizer")
36+
d.sizerWidth = null
3737
// Behavior of elts with overflow: auto and padding is
3838
// inconsistent across browsers. This is used to ensure the
3939
// scrollable area is big enough.
40-
d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;");
40+
d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;")
4141
// Will contain the gutters, if any.
42-
d.gutters = elt("div", null, "CodeMirror-gutters");
43-
d.lineGutter = null;
42+
d.gutters = elt("div", null, "CodeMirror-gutters")
43+
d.lineGutter = null
4444
// Actual scrollable element.
45-
d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll");
46-
d.scroller.setAttribute("tabIndex", "-1");
45+
d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll")
46+
d.scroller.setAttribute("tabIndex", "-1")
4747
// The element in which the editor lives.
48-
d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror");
48+
d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror")
4949

5050
// Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
51-
if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
52-
if (!webkit && !(gecko && mobile)) d.scroller.draggable = true;
51+
if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0 }
52+
if (!webkit && !(gecko && mobile)) d.scroller.draggable = true
5353

5454
if (place) {
55-
if (place.appendChild) place.appendChild(d.wrapper);
56-
else place(d.wrapper);
55+
if (place.appendChild) place.appendChild(d.wrapper)
56+
else place(d.wrapper)
5757
}
5858

5959
// Current rendered range (may be bigger than the view window).
60-
d.viewFrom = d.viewTo = doc.first;
61-
d.reportedViewFrom = d.reportedViewTo = doc.first;
60+
d.viewFrom = d.viewTo = doc.first
61+
d.reportedViewFrom = d.reportedViewTo = doc.first
6262
// Information about the rendered lines.
63-
d.view = [];
64-
d.renderedView = null;
63+
d.view = []
64+
d.renderedView = null
6565
// Holds info about a single rendered line when it was rendered
6666
// for measurement, while not in view.
67-
d.externalMeasured = null;
67+
d.externalMeasured = null
6868
// Empty space (in pixels) above the view
69-
d.viewOffset = 0;
70-
d.lastWrapHeight = d.lastWrapWidth = 0;
71-
d.updateLineNumbers = null;
69+
d.viewOffset = 0
70+
d.lastWrapHeight = d.lastWrapWidth = 0
71+
d.updateLineNumbers = null
7272

73-
d.nativeBarWidth = d.barHeight = d.barWidth = 0;
74-
d.scrollbarsClipped = false;
73+
d.nativeBarWidth = d.barHeight = d.barWidth = 0
74+
d.scrollbarsClipped = false
7575

7676
// Used to only resize the line number gutter when necessary (when
7777
// the amount of lines crosses a boundary that makes its width change)
78-
d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;
78+
d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null
7979
// Set to true when a non-horizontal-scrolling line widget is
8080
// added. As an optimization, line widget aligning is skipped when
8181
// this is false.
82-
d.alignWidgets = false;
82+
d.alignWidgets = false
8383

84-
d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
84+
d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null
8585

8686
// Tracks the maximum line length so that the horizontal scrollbar
8787
// can be kept static when scrolling.
88-
d.maxLine = null;
89-
d.maxLineLength = 0;
90-
d.maxLineChanged = false;
88+
d.maxLine = null
89+
d.maxLineLength = 0
90+
d.maxLineChanged = false
9191

9292
// Used for measuring wheel scrolling granularity
93-
d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;
93+
d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null
9494

9595
// True when shift is held down.
96-
d.shift = false;
96+
d.shift = false
9797

9898
// Used to track whether anything happened since the context menu
9999
// was opened.
100-
d.selForContextMenu = null;
100+
d.selForContextMenu = null
101101

102-
d.activeTouch = null;
102+
d.activeTouch = null
103103

104-
input.init(d);
104+
input.init(d)
105105
}

src/display/focus.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
1-
import { restartBlink } from "./selection";
2-
import { webkit } from "../util/browser";
3-
import { addClass, rmClass } from "../util/dom";
4-
import { signal } from "../util/event";
1+
import { restartBlink } from "./selection"
2+
import { webkit } from "../util/browser"
3+
import { addClass, rmClass } from "../util/dom"
4+
import { signal } from "../util/event"
55

66
export function ensureFocus(cm) {
7-
if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); }
7+
if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm) }
88
}
99

1010
export function delayBlurEvent(cm) {
11-
cm.state.delayingBlurEvent = true;
11+
cm.state.delayingBlurEvent = true
1212
setTimeout(function() {
1313
if (cm.state.delayingBlurEvent) {
14-
cm.state.delayingBlurEvent = false;
15-
onBlur(cm);
14+
cm.state.delayingBlurEvent = false
15+
onBlur(cm)
1616
}
17-
}, 100);
17+
}, 100)
1818
}
1919

2020
export function onFocus(cm, e) {
21-
if (cm.state.delayingBlurEvent) cm.state.delayingBlurEvent = false;
21+
if (cm.state.delayingBlurEvent) cm.state.delayingBlurEvent = false
2222

23-
if (cm.options.readOnly == "nocursor") return;
23+
if (cm.options.readOnly == "nocursor") return
2424
if (!cm.state.focused) {
25-
signal(cm, "focus", cm, e);
26-
cm.state.focused = true;
27-
addClass(cm.display.wrapper, "CodeMirror-focused");
25+
signal(cm, "focus", cm, e)
26+
cm.state.focused = true
27+
addClass(cm.display.wrapper, "CodeMirror-focused")
2828
// This test prevents this from firing when a context
2929
// menu is closed (since the input reset would kill the
3030
// select-all detection hack)
3131
if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
32-
cm.display.input.reset();
33-
if (webkit) setTimeout(function() { cm.display.input.reset(true); }, 20); // Issue #1730
32+
cm.display.input.reset()
33+
if (webkit) setTimeout(function() { cm.display.input.reset(true) }, 20) // Issue #1730
3434
}
35-
cm.display.input.receivedFocus();
35+
cm.display.input.receivedFocus()
3636
}
37-
restartBlink(cm);
37+
restartBlink(cm)
3838
}
3939
export function onBlur(cm, e) {
40-
if (cm.state.delayingBlurEvent) return;
40+
if (cm.state.delayingBlurEvent) return
4141

4242
if (cm.state.focused) {
43-
signal(cm, "blur", cm, e);
44-
cm.state.focused = false;
45-
rmClass(cm.display.wrapper, "CodeMirror-focused");
43+
signal(cm, "blur", cm, e)
44+
cm.state.focused = false
45+
rmClass(cm.display.wrapper, "CodeMirror-focused")
4646
}
47-
clearInterval(cm.display.blinker);
48-
setTimeout(function() {if (!cm.state.focused) cm.display.shift = false;}, 150);
47+
clearInterval(cm.display.blinker)
48+
setTimeout(function() {if (!cm.state.focused) cm.display.shift = false}, 150)
4949
}

src/display/gutters.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
import { elt, removeChildren } from "../util/dom";
2-
import { indexOf } from "../util/misc";
1+
import { elt, removeChildren } from "../util/dom"
2+
import { indexOf } from "../util/misc"
33

4-
import { updateGutterSpace } from "./update_display";
4+
import { updateGutterSpace } from "./update_display"
55

66
// Rebuild the gutter elements, ensure the margin to the left of the
77
// code matches their width.
88
export function updateGutters(cm) {
9-
var gutters = cm.display.gutters, specs = cm.options.gutters;
10-
removeChildren(gutters);
9+
var gutters = cm.display.gutters, specs = cm.options.gutters
10+
removeChildren(gutters)
1111
for (var i = 0; i < specs.length; ++i) {
12-
var gutterClass = specs[i];
13-
var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass));
12+
var gutterClass = specs[i]
13+
var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass))
1414
if (gutterClass == "CodeMirror-linenumbers") {
15-
cm.display.lineGutter = gElt;
16-
gElt.style.width = (cm.display.lineNumWidth || 1) + "px";
15+
cm.display.lineGutter = gElt
16+
gElt.style.width = (cm.display.lineNumWidth || 1) + "px"
1717
}
1818
}
19-
gutters.style.display = i ? "" : "none";
20-
updateGutterSpace(cm);
19+
gutters.style.display = i ? "" : "none"
20+
updateGutterSpace(cm)
2121
}
2222

2323
// Make sure the gutters options contains the element
2424
// "CodeMirror-linenumbers" when the lineNumbers option is true.
2525
export function setGuttersForLineNumbers(options) {
26-
var found = indexOf(options.gutters, "CodeMirror-linenumbers");
26+
var found = indexOf(options.gutters, "CodeMirror-linenumbers")
2727
if (found == -1 && options.lineNumbers) {
28-
options.gutters = options.gutters.concat(["CodeMirror-linenumbers"]);
28+
options.gutters = options.gutters.concat(["CodeMirror-linenumbers"])
2929
} else if (found > -1 && !options.lineNumbers) {
30-
options.gutters = options.gutters.slice(0);
31-
options.gutters.splice(found, 1);
30+
options.gutters = options.gutters.slice(0)
31+
options.gutters.splice(found, 1)
3232
}
3333
}

src/display/highlight_worker.js

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
1-
import { getStateBefore, highlightLine, processLine } from "../line/highlight";
2-
import { copyState } from "../modes";
3-
import { bind } from "../util/misc";
1+
import { getStateBefore, highlightLine, processLine } from "../line/highlight"
2+
import { copyState } from "../modes"
3+
import { bind } from "../util/misc"
44

5-
import { runInOp } from "./operations";
6-
import { regLineChange } from "./view_tracking";
5+
import { runInOp } from "./operations"
6+
import { regLineChange } from "./view_tracking"
77

88
// HIGHLIGHT WORKER
99

1010
export function startWorker(cm, time) {
1111
if (cm.doc.mode.startState && cm.doc.frontier < cm.display.viewTo)
12-
cm.state.highlight.set(time, bind(highlightWorker, cm));
12+
cm.state.highlight.set(time, bind(highlightWorker, cm))
1313
}
1414

1515
function highlightWorker(cm) {
16-
var doc = cm.doc;
17-
if (doc.frontier < doc.first) doc.frontier = doc.first;
18-
if (doc.frontier >= cm.display.viewTo) return;
19-
var end = +new Date + cm.options.workTime;
20-
var state = copyState(doc.mode, getStateBefore(cm, doc.frontier));
21-
var changedLines = [];
16+
var doc = cm.doc
17+
if (doc.frontier < doc.first) doc.frontier = doc.first
18+
if (doc.frontier >= cm.display.viewTo) return
19+
var end = +new Date + cm.options.workTime
20+
var state = copyState(doc.mode, getStateBefore(cm, doc.frontier))
21+
var changedLines = []
2222

2323
doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function(line) {
2424
if (doc.frontier >= cm.display.viewFrom) { // Visible
25-
var oldStyles = line.styles, tooLong = line.text.length > cm.options.maxHighlightLength;
26-
var highlighted = highlightLine(cm, line, tooLong ? copyState(doc.mode, state) : state, true);
27-
line.styles = highlighted.styles;
28-
var oldCls = line.styleClasses, newCls = highlighted.classes;
29-
if (newCls) line.styleClasses = newCls;
30-
else if (oldCls) line.styleClasses = null;
25+
var oldStyles = line.styles, tooLong = line.text.length > cm.options.maxHighlightLength
26+
var highlighted = highlightLine(cm, line, tooLong ? copyState(doc.mode, state) : state, true)
27+
line.styles = highlighted.styles
28+
var oldCls = line.styleClasses, newCls = highlighted.classes
29+
if (newCls) line.styleClasses = newCls
30+
else if (oldCls) line.styleClasses = null
3131
var ischange = !oldStyles || oldStyles.length != line.styles.length ||
32-
oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);
33-
for (var i = 0; !ischange && i < oldStyles.length; ++i) ischange = oldStyles[i] != line.styles[i];
34-
if (ischange) changedLines.push(doc.frontier);
35-
line.stateAfter = tooLong ? state : copyState(doc.mode, state);
32+
oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass)
33+
for (var i = 0; !ischange && i < oldStyles.length; ++i) ischange = oldStyles[i] != line.styles[i]
34+
if (ischange) changedLines.push(doc.frontier)
35+
line.stateAfter = tooLong ? state : copyState(doc.mode, state)
3636
} else {
3737
if (line.text.length <= cm.options.maxHighlightLength)
38-
processLine(cm, line.text, state);
39-
line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null;
38+
processLine(cm, line.text, state)
39+
line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null
4040
}
41-
++doc.frontier;
41+
++doc.frontier
4242
if (+new Date > end) {
43-
startWorker(cm, cm.options.workDelay);
44-
return true;
43+
startWorker(cm, cm.options.workDelay)
44+
return true
4545
}
46-
});
46+
})
4747
if (changedLines.length) runInOp(cm, function() {
4848
for (var i = 0; i < changedLines.length; i++)
49-
regLineChange(cm, changedLines[i], "text");
50-
});
49+
regLineChange(cm, changedLines[i], "text")
50+
})
5151
}

0 commit comments

Comments
 (0)