Skip to content
This repository was archived by the owner on Apr 16, 2026. It is now read-only.

Commit 8ba727a

Browse files
committed
Fix a number of lint warnings from new-improved-blint
1 parent cffaa81 commit 8ba727a

18 files changed

Lines changed: 124 additions & 187 deletions

File tree

addon/display/rulers.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
for (var i = 0; i < val.length; i++) {
3939
var elt = document.createElement("div");
4040
elt.className = "CodeMirror-ruler";
41-
var col, cls = null, conf = val[i];
41+
var col, conf = val[i];
4242
if (typeof conf == "number") {
4343
col = conf;
4444
} else {
@@ -47,7 +47,6 @@
4747
if (conf.color) elt.style.borderColor = conf.color;
4848
if (conf.lineStyle) elt.style.borderLeftStyle = conf.lineStyle;
4949
if (conf.width) elt.style.borderLeftWidth = conf.width;
50-
cls = val[i].className;
5150
}
5251
elt.style.left = (left + col * cw) + "px";
5352
elt.style.top = "-50px";

addon/search/searchcursor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,9 @@
177177
});
178178

179179
CodeMirror.defineExtension("selectMatches", function(query, caseFold) {
180-
var ranges = [], next;
180+
var ranges = [];
181181
var cur = this.getSearchCursor(query, this.getCursor("from"), caseFold);
182-
while (next = cur.findNext()) {
182+
while (cur.findNext()) {
183183
if (CodeMirror.cmpPos(cur.to(), this.getCursor("to")) > 0) break;
184184
ranges.push({anchor: cur.from(), head: cur.to()});
185185
}

addon/tern/worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ function startServer(defs, plugins, scripts) {
3939
});
4040
}
4141

42-
var console = {
42+
this.console = {
4343
log: function(v) { postMessage({type: "debug", message: v}); }
4444
};

keymap/vim.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4581,10 +4581,9 @@
45814581
searchCursor.replace(newText);
45824582
}
45834583
function next() {
4584-
var found;
45854584
// The below only loops to skip over multiple occurrences on the same
45864585
// line when 'global' is not true.
4587-
while(found = searchCursor.findNext() &&
4586+
while(searchCursor.findNext() &&
45884587
isInRange(searchCursor.from(), lineStart, lineEnd)) {
45894588
if (!global && lastPos && searchCursor.from().line == lastPos.line) {
45904589
continue;

lib/codemirror.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -728,12 +728,9 @@
728728
}
729729

730730
function postUpdateDisplay(cm, update) {
731-
var force = update.force, viewport = update.viewport;
731+
var viewport = update.viewport;
732732
for (var first = true;; first = false) {
733-
if (first && cm.options.lineWrapping && update.oldDisplayWidth != displayWidth(cm)) {
734-
force = true;
735-
} else {
736-
force = false;
733+
if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {
737734
// Clip forced viewport to actual scrollable area.
738735
if (viewport && viewport.top != null)
739736
viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)};
@@ -1844,7 +1841,7 @@
18441841
var partPos = getBidiPartAt(order, pos.ch);
18451842
side = partPos % 2 ? "right" : "left";
18461843
}
1847-
var result = nodeAndOffsetInLineMap(info.map, pos.ch, "left");
1844+
var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);
18481845
result.offset = result.collapse == "right" ? result.end : result.start;
18491846
return result;
18501847
}

mode/apl/apl.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ CodeMirror.defineMode("apl", function() {
102102
};
103103
},
104104
token: function(stream, state) {
105-
var ch, funcName, word;
105+
var ch, funcName;
106106
if (stream.eatSpace()) {
107107
return null;
108108
}
@@ -163,7 +163,6 @@ CodeMirror.defineMode("apl", function() {
163163
return "function jot-dot";
164164
}
165165
stream.eatWhile(/[\w\$_]/);
166-
word = stream.current();
167166
state.prev = true;
168167
return "keyword";
169168
}

mode/asterisk/asterisk.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ CodeMirror.defineMode("asterisk", function() {
6565

6666
function basicToken(stream,state){
6767
var cur = '';
68-
var ch = '';
69-
ch = stream.next();
68+
var ch = stream.next();
7069
// comment
7170
if(ch == ";") {
7271
stream.skipToEnd();
@@ -136,7 +135,6 @@ CodeMirror.defineMode("asterisk", function() {
136135
token: function(stream, state) {
137136

138137
var cur = '';
139-
var ch = '';
140138
if(stream.eatSpace()) return null;
141139
// extension started
142140
if(state.extenStart){
@@ -170,7 +168,7 @@ CodeMirror.defineMode("asterisk", function() {
170168
} else if(state.extenPriority) {
171169
state.extenPriority = false;
172170
state.extenApplication = true;
173-
ch = stream.next(); // get comma
171+
stream.next(); // get comma
174172
if(state.extenSame) return null;
175173
stream.eatWhile(/[^,]/);
176174
return "number";

mode/cypher/cypher.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
CodeMirror.defineMode("cypher", function(config) {
2121
var tokenBase = function(stream/*, state*/) {
22-
var ch = stream.next(), curPunc = null;
22+
var ch = stream.next();
2323
if (ch === "\"" || ch === "'") {
2424
stream.match(/.+?["']/);
2525
return "string";

mode/dylan/dylan.js

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -154,20 +154,12 @@ CodeMirror.defineMode("dylan", function(_config) {
154154
return f(stream, state);
155155
}
156156

157-
var type, content;
158-
159-
function ret(_type, style, _content) {
160-
type = _type;
161-
content = _content;
162-
return style;
163-
}
164-
165157
function tokenBase(stream, state) {
166158
// String
167159
var ch = stream.peek();
168160
if (ch == "'" || ch == '"') {
169161
stream.next();
170-
return chain(stream, state, tokenString(ch, "string", "string"));
162+
return chain(stream, state, tokenString(ch, "string"));
171163
}
172164
// Comment
173165
else if (ch == "/") {
@@ -176,16 +168,16 @@ CodeMirror.defineMode("dylan", function(_config) {
176168
return chain(stream, state, tokenComment);
177169
} else if (stream.eat("/")) {
178170
stream.skipToEnd();
179-
return ret("comment", "comment");
171+
return "comment";
180172
} else {
181173
stream.skipTo(" ");
182-
return ret("operator", "operator");
174+
return "operator";
183175
}
184176
}
185177
// Decimal
186178
else if (/\d/.test(ch)) {
187179
stream.match(/^\d*(?:\.\d*)?(?:e[+\-]?\d+)?/);
188-
return ret("number", "number");
180+
return "number";
189181
}
190182
// Hash
191183
else if (ch == "#") {
@@ -194,55 +186,55 @@ CodeMirror.defineMode("dylan", function(_config) {
194186
ch = stream.peek();
195187
if (ch == '"') {
196188
stream.next();
197-
return chain(stream, state, tokenString('"', "symbol", "string-2"));
189+
return chain(stream, state, tokenString('"', "string-2"));
198190
}
199191
// Binary number
200192
else if (ch == "b") {
201193
stream.next();
202194
stream.eatWhile(/[01]/);
203-
return ret("number", "number");
195+
return "number";
204196
}
205197
// Hex number
206198
else if (ch == "x") {
207199
stream.next();
208200
stream.eatWhile(/[\da-f]/i);
209-
return ret("number", "number");
201+
return "number";
210202
}
211203
// Octal number
212204
else if (ch == "o") {
213205
stream.next();
214206
stream.eatWhile(/[0-7]/);
215-
return ret("number", "number");
207+
return "number";
216208
}
217209
// Hash symbol
218210
else {
219211
stream.eatWhile(/[-a-zA-Z]/);
220-
return ret("hash", "keyword");
212+
return "keyword";
221213
}
222214
} else if (stream.match("end")) {
223-
return ret("end", "keyword");
215+
return "keyword";
224216
}
225217
for (var name in patterns) {
226218
if (patterns.hasOwnProperty(name)) {
227219
var pattern = patterns[name];
228220
if ((pattern instanceof Array && pattern.some(function(p) {
229221
return stream.match(p);
230222
})) || stream.match(pattern))
231-
return ret(name, patternStyles[name], stream.current());
223+
return patternStyles[name];
232224
}
233225
}
234226
if (stream.match("define")) {
235-
return ret("definition", "def");
227+
return "def";
236228
} else {
237229
stream.eatWhile(/[\w\-]/);
238230
// Keyword
239231
if (wordLookup[stream.current()]) {
240-
return ret(wordLookup[stream.current()], styleLookup[stream.current()], stream.current());
232+
return styleLookup[stream.current()];
241233
} else if (stream.current().match(symbol)) {
242-
return ret("variable", "variable");
234+
return "variable";
243235
} else {
244236
stream.next();
245-
return ret("other", "variable-2");
237+
return "variable-2";
246238
}
247239
}
248240
}
@@ -257,10 +249,10 @@ CodeMirror.defineMode("dylan", function(_config) {
257249
}
258250
maybeEnd = (ch == "*");
259251
}
260-
return ret("comment", "comment");
252+
return "comment";
261253
}
262254

263-
function tokenString(quote, type, style) {
255+
function tokenString(quote, style) {
264256
return function(stream, state) {
265257
var next, end = false;
266258
while ((next = stream.next()) != null) {
@@ -271,7 +263,7 @@ CodeMirror.defineMode("dylan", function(_config) {
271263
}
272264
if (end)
273265
state.tokenize = tokenBase;
274-
return ret(type, style);
266+
return style;
275267
};
276268
}
277269

mode/ecl/ecl.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ CodeMirror.defineMode("ecl", function(config) {
3434
var blockKeywords = words("catch class do else finally for if switch try while");
3535
var atoms = words("true false null");
3636
var hooks = {"#": metaHook};
37-
var multiLineStrings;
3837
var isOperatorChar = /[+\-*&%=<>!?|\/]/;
3938

4039
var curPunc;
@@ -112,7 +111,7 @@ CodeMirror.defineMode("ecl", function(config) {
112111
if (next == quote && !escaped) {end = true; break;}
113112
escaped = !escaped && next == "\\";
114113
}
115-
if (end || !(escaped || multiLineStrings))
114+
if (end || !escaped)
116115
state.tokenize = tokenBase;
117116
return "string";
118117
};

0 commit comments

Comments
 (0)