Skip to content

Commit 9be24b1

Browse files
committed
add .eslintrc
1 parent 4f9cd17 commit 9be24b1

Some content is hidden

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

45 files changed

+285
-170
lines changed

.eslintignore

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
lib/ace/mode/css/*
2+
lib/ace/mode/coffee/*
3+
lib/ace/mode/html/*
4+
lib/ace/mode/javascript/*
5+
lib/ace/mode/json/*
6+
lib/ace/mode/lua/*
7+
lib/ace/mode/php/*
8+
lib/ace/mode/xml/*
9+
lib/ace/mode/xquery/*
10+
lib/ace/mode/xquery.js
11+
lib/ace/test/asyncjs/
12+
lib/ace/lib/es5-shim.js
13+
lib/ace/keyboard/vim*.js
14+
experiments/
15+
tool/
16+
doc/
17+
build/
18+
demo/
19+
api/
20+
**/* *
21+
**/node_modules
22+
0*

.eslintrc

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
{
2+
"globals": {
3+
define: true,
4+
require: true,
5+
exports: true,
6+
module: true,
7+
__dirname: true,
8+
__filename: true,
9+
process: true,
10+
global: true,
11+
importScripts: true,
12+
document: true,
13+
window: true,
14+
location: true,
15+
navigator: true,
16+
console: true,
17+
Worker: true,
18+
postMessage: true,
19+
setTimeout: true,
20+
clearTimeout: true,
21+
setInterval: true,
22+
clearInterval: true,
23+
Blob: true,
24+
cvox: true,
25+
alert: true,
26+
prompt: true,
27+
XMLHttpRequest: true,
28+
},
29+
"rules": {
30+
curly: 0,
31+
eqeqeq: 0,
32+
no-underscore-dangle: 0,
33+
comma-dangle: 2,
34+
no-dupe-args: 2,
35+
no-dupe-keys: 2,
36+
no-duplicate-case: 2,
37+
no-empty-character-class: 2,
38+
no-empty: 0,
39+
no-ex-assign: 2,
40+
no-extra-parens: 0,
41+
no-func-assign: 2,
42+
no-inner-declarations: 2,
43+
no-invalid-regexp: 2,
44+
no-irregular-whitespace: 2,
45+
no-negated-in-lhs: 2,
46+
no-obj-calls: 2,
47+
no-sparse-arrays: 2,
48+
no-unexpected-multiline: 2,
49+
use-isnan: 2,
50+
valid-typeof: 2,
51+
52+
accessor-pairs: 2,
53+
complexity: 2,
54+
dot-location: [2, "property"],
55+
no-caller: 2,
56+
no-case-declarations: 2,
57+
no-div-regex: 2,
58+
no-empty-label: 2,
59+
no-empty-pattern: 2,
60+
no-extra-bind: 2,
61+
62+
no-implied-eval: 2,
63+
no-lone-blocks: 2,
64+
no-native-reassign: 2,
65+
no-new-func: 2,
66+
no-new-wrappers: 2,
67+
no-octal-escape: 2,
68+
no-octal: 2,
69+
70+
no-redeclare: 0,
71+
no-return-assign: 0,
72+
no-script-url: 2,
73+
no-self-compare: 2,
74+
no-sequences: 2,
75+
no-useless-call: 2,
76+
yoda: 2,
77+
78+
no-undef: 2,
79+
no-redeclare: 0,
80+
// no-unused-vars: 1,
81+
82+
//////////////////////////////////////////////////////////////////
83+
//
84+
// no-unreachable: 2,
85+
// no-debugger: 2,
86+
// no-proto: 2,
87+
// no-regex-spaces: 2,
88+
// no-extend-native: 2,
89+
// no-useless-concat: 2,
90+
// no-eval: 2,
91+
// dot-notation: 2,
92+
// no-alert: 2,
93+
// no-extra-semi: 2, // doesn't handle ;(function() {})() pattern
94+
// radix: 2,
95+
// no-invalid-this: 2,
96+
// no-param-reassign: 2,
97+
// wrap-iife: 2,
98+
// no-throw-literal: 2,
99+
// no-multi-spaces: 2,
100+
// no-new: 2,
101+
// no-else-return: 2,
102+
// no-unused-expressions: 2,
103+
// no-use-before-define : [2, "nofunc"],
104+
}
105+
}

.travis.yml

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
language: node_js
22

33
node_js:
4-
- "0.10"
4+
- "0.10"
5+
6+
script:
7+
- npm i
8+
- npm i -g eslint
9+
- eslint "lib/ace/**/*.js"
10+
- npm test
511

612
matrix:
7-
fast_finish: true
13+
fast_finish: true
814

915
sudo: false

Makefile.dryice.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ function buildAceModuleInternal(opts, callback) {
237237
paths: {
238238
ace: ACE_HOME + "/lib/ace",
239239
"kitchen-sink": ACE_HOME + "/demo/kitchen-sink",
240-
build_support: ACE_HOME + "/build_support",
240+
build_support: ACE_HOME + "/build_support"
241241
},
242242
root: ACE_HOME
243243
};
@@ -287,7 +287,7 @@ function buildAceModuleInternal(opts, callback) {
287287

288288
build.writeToFile({code: code}, {
289289
outputFolder: path.dirname(to),
290-
outputFile: path.basename(to),
290+
outputFile: path.basename(to)
291291
}, function() {});
292292

293293
callback && callback(err, result);
@@ -337,7 +337,7 @@ function buildAce(options) {
337337
var snippetFiles = jsFileList("lib/ace/snippets");
338338
var modeNames = modeList();
339339

340-
buildCore(options, {outputFile: "ace.js"}, addCb()),
340+
buildCore(options, {outputFile: "ace.js"}, addCb());
341341
// modes
342342
modeNames.forEach(function(name) {
343343
buildSubmodule(options, {
@@ -351,7 +351,7 @@ function buildAce(options) {
351351
addSnippetFile(name);
352352

353353
buildSubmodule(options, {
354-
require: ["ace/snippets/" + name],
354+
require: ["ace/snippets/" + name]
355355
}, "snippets/" + name, addCb());
356356
});
357357
// themes
@@ -385,7 +385,7 @@ function buildAce(options) {
385385
id: "ace/worker/worker",
386386
transforms: [],
387387
order: -1000
388-
}],
388+
}]
389389
}, "worker-" + name, addCb());
390390
});
391391
//

lib/ace/commands/occur_commands.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function OccurKeyboardHandler() {}
7575

7676
oop.inherits(OccurKeyboardHandler, HashHandler);
7777

78-
;(function() {
78+
(function() {
7979

8080
this.isOccurHandler = true;
8181

lib/ace/config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ function init(packaged) {
191191
for (var key in scriptOptions)
192192
if (typeof scriptOptions[key] !== "undefined")
193193
exports.set(key, scriptOptions[key]);
194-
};
194+
}
195195

196196
exports.init = init;
197197

lib/ace/config_test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ module.exports = {
7979
set: function(val) {
8080
this.x = val;
8181
},
82-
value: 7,
82+
value: 7
8383
},
8484
initialValue: {
8585
set: function(val) {
8686
this.x = val;
8787
},
88-
initialValue: 8,
88+
initialValue: 8
8989
},
9090
opt2: {
9191
get: function(val) {

lib/ace/edit_session.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1843,13 +1843,13 @@ var EditSession = function(text, mode) {
18431843
// The document size is the current size - the extra width for tabs
18441844
// and multipleWidth characters.
18451845
var len = displayed.length;
1846-
displayed.join("").
1846+
displayed.join("")
18471847
// Get all the TAB_SPACEs.
1848-
replace(/12/g, function() {
1848+
.replace(/12/g, function() {
18491849
len -= 1;
1850-
}).
1850+
})
18511851
// Get all the CHAR_EXT/multipleWidth characters.
1852-
replace(/2/g, function() {
1852+
.replace(/2/g, function() {
18531853
len -= 1;
18541854
});
18551855

@@ -2466,7 +2466,7 @@ var EditSession = function(text, mode) {
24662466
c >= 0xFE68 && c <= 0xFE6B ||
24672467
c >= 0xFF01 && c <= 0xFF60 ||
24682468
c >= 0xFFE0 && c <= 0xFFE6;
2469-
};
2469+
}
24702470

24712471
}).call(EditSession.prototype);
24722472

lib/ace/ext/chromevox.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -579,14 +579,14 @@ var onSelectionChange = function(evt) {
579579
* @param {!Event} evt The event.
580580
*/
581581
var onChange = function(delta) {
582-
switch (data.action) {
582+
switch (delta.action) {
583583
case 'remove':
584-
cvox.Api.speak(data.text, 0, DELETED_PROP);
584+
cvox.Api.speak(delta.text, 0, DELETED_PROP);
585585
/* Let the future cursor change event know it's from text change. */
586586
changed = true;
587587
break;
588588
case 'insert':
589-
cvox.Api.speak(data.text, 0);
589+
cvox.Api.speak(delta.text, 0);
590590
/* Let the future cursor change event know it's from text change. */
591591
changed = true;
592592
break;
@@ -891,7 +891,7 @@ var SHORTCUTS = [
891891
/**
892892
* Event handler for focus events.
893893
*/
894-
var onFocus = function() {
894+
var onFocus = function(_, editor) {
895895
cvoxAce.editor = editor;
896896

897897
/* Set up listeners. */
@@ -911,7 +911,7 @@ var onFocus = function() {
911911
* @param {Object} editor Editor to use.
912912
*/
913913
var init = function(editor) {
914-
onFocus();
914+
onFocus(null, editor);
915915

916916
/* Construct maps. */
917917
SHORTCUTS.forEach(function(shortcut) {

lib/ace/ext/keybinding_menu.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ define(function(require, exports, module) {
6969
el.innerHTML = '<h1>Keyboard Shortcuts</h1>' + commands + '</div>';
7070
overlayPage(editor, el, '0', '0', '0', null);
7171
}
72-
};
72+
}
7373
module.exports.init = function(editor) {
7474
Editor.prototype.showKeyboardShortcuts = function() {
7575
showKeyboardShortcuts(this);

lib/ace/ext/whitespace_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ module.exports = {
111111
assert.equal(indent.length, 1);
112112

113113
next();
114-
},
114+
}
115115

116116
};
117117

lib/ace/incremental_search.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ function objectToRegExp(obj) {
9292

9393
// iSearch class
9494

95-
;(function() {
95+
(function() {
9696

9797
this.activate = function(ed, backwards) {
9898
this.$editor = ed;

lib/ace/incremental_search_test.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,14 @@ module.exports = {
155155
"test: backwards search" : function() {
156156
editor.moveCursorTo(1,0);
157157
iSearch.activate(editor, true);
158-
iSearch.addString('1'); var range = iSearch.addString('2');;
158+
iSearch.addString('1'); var range = iSearch.addString('2');
159159
testRanges("Range: [0/5] -> [0/3]", [range], "range");
160160
assert.position(editor.getCursorPosition(), 0, 3);
161161
},
162162

163163
"test: forwards then backwards, same result, reoriented range" : function() {
164164
iSearch.activate(editor);
165-
iSearch.addString('1'); var range = iSearch.addString('2');;
165+
iSearch.addString('1'); var range = iSearch.addString('2');
166166
testRanges("Range: [0/3] -> [0/5]", [range], "range");
167167
assert.position(editor.getCursorPosition(), 0, 5);
168168

@@ -173,7 +173,7 @@ module.exports = {
173173

174174
"test: reuse prev search via option" : function() {
175175
iSearch.activate(editor);
176-
iSearch.addString('1'); iSearch.addString('2');;
176+
iSearch.addString('1'); iSearch.addString('2');
177177
assert.position(editor.getCursorPosition(), 0, 5);
178178
iSearch.deactivate();
179179

@@ -184,14 +184,14 @@ module.exports = {
184184

185185
"test: don't extend selection range if selection is empty" : function() {
186186
iSearch.activate(editor);
187-
iSearch.addString('1'); iSearch.addString('2');;
187+
iSearch.addString('1'); iSearch.addString('2');
188188
testRanges("Range: [0/5] -> [0/5]", [editor.getSelectionRange()], "sel range");
189189
},
190190

191191
"test: extend selection range if selection exists" : function() {
192192
iSearch.activate(editor);
193193
editor.selection.selectTo(0, 1);
194-
iSearch.addString('1'); iSearch.addString('2');;
194+
iSearch.addString('1'); iSearch.addString('2');
195195
testRanges("Range: [0/0] -> [0/5]", [editor.getSelectionRange()], "sel range");
196196
},
197197

lib/ace/keyboard/emacs_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ module.exports = {
162162
editor.execCommand("killLine");
163163
editor.execCommand("yank");
164164
assert.equal(editor.getValue(),"foo \n Hello world\n \n 123");
165-
},
165+
}
166166

167167
};
168168

lib/ace/keyboard/textarea.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,22 @@ exports.handler = new HashHandler();
6060
command: "passKeysToBrowser"
6161
}, {
6262
command: "golineup",
63-
bindKey: {win: null, mac: "Ctrl-P"},
63+
bindKey: {win: null, mac: "Ctrl-P"}
6464
}, {
6565
command: "golinedown",
66-
bindKey: {win: null, mac: "Ctrl-N"},
66+
bindKey: {win: null, mac: "Ctrl-N"}
6767
}, {
6868
command: "gotoleft",
69-
bindKey: {win: null, mac: "Ctrl-B"},
69+
bindKey: {win: null, mac: "Ctrl-B"}
7070
}, {
7171
command: "gotoright",
72-
bindKey: {win: null, mac: "Ctrl-F"},
72+
bindKey: {win: null, mac: "Ctrl-F"}
7373
}, {
7474
command: "gotolineend",
75-
bindKey: {win: null, mac: "Ctrl-E"},
75+
bindKey: {win: null, mac: "Ctrl-E"}
7676
}, {
7777
command: "gotolinestart",
78-
bindKey: {win: null, mac: "Ctrl-A"},
78+
bindKey: {win: null, mac: "Ctrl-A"}
7979
}
8080
].forEach(function(k) {
8181
var bindKey = k.bindKey;

0 commit comments

Comments
 (0)