Skip to content

Commit 9ce97c5

Browse files
authored
Add code coverage checks using Istanbul
* Allow test cases to be excluded from documentation * Add code coverage checks using Istanbul
1 parent eb25057 commit 9ce97c5

21 files changed

+1335
-89
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
node_modules/
2+
.nyc_output/
3+
coverage/

.nycrc.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"all": true,
3+
"include": [
4+
"src/**/*.js"
5+
],
6+
"check-coverage": true,
7+
"per-file": true,
8+
"branches": 90,
9+
"lines": 90,
10+
"functions": 90,
11+
"statements": 90
12+
}

docs/no-animate.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@ $div.animate( { scrollLeft: 200 } );
1717
$div.animate( { scrollTop: 100, scrollLeft: 200 } );
1818
$div.animate( { scrollTop: 100, width: 300 } );
1919
```
20-
❌ With `[{"allowScroll":false}]` options:
21-
```js
22-
$div.animate( { scrollTop: 100 } );
23-
```
2420
❌ With `[{"allowScroll":true}]` options:
2521
```js
22+
$div.animate();
2623
$div.animate( { scrollTop: 100, width: 300 } );
2724
```
25+
❌ With `[{"allowScroll":false}]` options:
26+
```js
27+
$div.animate( { scrollTop: 100 } );
28+
```
2829

2930
✔️ The following patterns are not considered errors:
3031
```js

docs/no-browser.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ browser;
1818
a.browser;
1919
browser.foo;
2020
a.browser.foo;
21+
$.browsers;
2122
```
2223
## Rule source
2324

docs/no-delegate.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ $( 'div' ).delegate();
1212
$div.delegate();
1313
$( 'div' ).first().delegate();
1414
$( 'div' ).append( $( 'input' ).delegate() );
15+
$( 'div' ).undelegate();
16+
$div.undelegate();
17+
$( 'div' ).first().undelegate();
18+
$( 'div' ).append( $( 'input' ).undelegate() );
1519
```
1620

1721
✔️ The following patterns are not considered errors:
@@ -20,6 +24,10 @@ delegate();
2024
[].delegate();
2125
div.delegate();
2226
div.delegate;
27+
undelegate();
28+
[].undelegate();
29+
div.undelegate();
30+
div.undelegate;
2331
```
2432
## Rule source
2533

docs/no-event-shorthand.md

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -172,187 +172,187 @@ $( 'div' ).append( $( 'input' ).ajaxSend() );
172172
error();
173173
$.error();
174174
[].error();
175-
div.error();
175+
$div.on( 'error', fn );
176176
$method( x ).error();
177177
div.error;
178178
resize();
179179
$.resize();
180180
[].resize();
181-
div.resize();
181+
$div.on( 'resize', fn );
182182
$method( x ).resize();
183183
div.resize;
184184
scroll();
185185
$.scroll();
186186
[].scroll();
187-
div.scroll();
187+
$div.on( 'scroll', fn );
188188
$method( x ).scroll();
189189
div.scroll;
190190
unload();
191191
$.unload();
192192
[].unload();
193-
div.unload();
193+
$div.on( 'unload', fn );
194194
$method( x ).unload();
195195
div.unload;
196196
blur();
197197
$.blur();
198198
[].blur();
199-
div.blur();
199+
$div.on( 'blur', fn );
200200
$method( x ).blur();
201201
div.blur;
202202
change();
203203
$.change();
204204
[].change();
205-
div.change();
205+
$div.on( 'change', fn );
206206
$method( x ).change();
207207
div.change;
208208
focus();
209209
$.focus();
210210
[].focus();
211-
div.focus();
211+
$div.on( 'focus', fn );
212212
$method( x ).focus();
213213
div.focus;
214214
focusin();
215215
$.focusin();
216216
[].focusin();
217-
div.focusin();
217+
$div.on( 'focusin', fn );
218218
$method( x ).focusin();
219219
div.focusin;
220220
focusout();
221221
$.focusout();
222222
[].focusout();
223-
div.focusout();
223+
$div.on( 'focusout', fn );
224224
$method( x ).focusout();
225225
div.focusout;
226226
select();
227227
$.select();
228228
[].select();
229-
div.select();
229+
$div.on( 'select', fn );
230230
$method( x ).select();
231231
div.select;
232232
submit();
233233
$.submit();
234234
[].submit();
235-
div.submit();
235+
$div.on( 'submit', fn );
236236
$method( x ).submit();
237237
div.submit;
238238
keydown();
239239
$.keydown();
240240
[].keydown();
241-
div.keydown();
241+
$div.on( 'keydown', fn );
242242
$method( x ).keydown();
243243
div.keydown;
244244
keypress();
245245
$.keypress();
246246
[].keypress();
247-
div.keypress();
247+
$div.on( 'keypress', fn );
248248
$method( x ).keypress();
249249
div.keypress;
250250
keyup();
251251
$.keyup();
252252
[].keyup();
253-
div.keyup();
253+
$div.on( 'keyup', fn );
254254
$method( x ).keyup();
255255
div.keyup;
256256
click();
257257
$.click();
258258
[].click();
259-
div.click();
259+
$div.on( 'click', fn );
260260
$method( x ).click();
261261
div.click;
262262
contextmenu();
263263
$.contextmenu();
264264
[].contextmenu();
265-
div.contextmenu();
265+
$div.on( 'contextmenu', fn );
266266
$method( x ).contextmenu();
267267
div.contextmenu;
268268
dblclick();
269269
$.dblclick();
270270
[].dblclick();
271-
div.dblclick();
271+
$div.on( 'dblclick', fn );
272272
$method( x ).dblclick();
273273
div.dblclick;
274274
hover();
275275
$.hover();
276276
[].hover();
277-
div.hover();
277+
$div.on( 'hover', fn );
278278
$method( x ).hover();
279279
div.hover;
280280
mousedown();
281281
$.mousedown();
282282
[].mousedown();
283-
div.mousedown();
283+
$div.on( 'mousedown', fn );
284284
$method( x ).mousedown();
285285
div.mousedown;
286286
mouseenter();
287287
$.mouseenter();
288288
[].mouseenter();
289-
div.mouseenter();
289+
$div.on( 'mouseenter', fn );
290290
$method( x ).mouseenter();
291291
div.mouseenter;
292292
mouseleave();
293293
$.mouseleave();
294294
[].mouseleave();
295-
div.mouseleave();
295+
$div.on( 'mouseleave', fn );
296296
$method( x ).mouseleave();
297297
div.mouseleave;
298298
mousemove();
299299
$.mousemove();
300300
[].mousemove();
301-
div.mousemove();
301+
$div.on( 'mousemove', fn );
302302
$method( x ).mousemove();
303303
div.mousemove;
304304
mouseout();
305305
$.mouseout();
306306
[].mouseout();
307-
div.mouseout();
307+
$div.on( 'mouseout', fn );
308308
$method( x ).mouseout();
309309
div.mouseout;
310310
mouseover();
311311
$.mouseover();
312312
[].mouseover();
313-
div.mouseover();
313+
$div.on( 'mouseover', fn );
314314
$method( x ).mouseover();
315315
div.mouseover;
316316
mouseup();
317317
$.mouseup();
318318
[].mouseup();
319-
div.mouseup();
319+
$div.on( 'mouseup', fn );
320320
$method( x ).mouseup();
321321
div.mouseup;
322322
ajaxStart();
323323
$.ajaxStart();
324324
[].ajaxStart();
325-
div.ajaxStart();
325+
$div.on( 'ajaxStart', fn );
326326
$method( x ).ajaxStart();
327327
div.ajaxStart;
328328
ajaxStop();
329329
$.ajaxStop();
330330
[].ajaxStop();
331-
div.ajaxStop();
331+
$div.on( 'ajaxStop', fn );
332332
$method( x ).ajaxStop();
333333
div.ajaxStop;
334334
ajaxComplete();
335335
$.ajaxComplete();
336336
[].ajaxComplete();
337-
div.ajaxComplete();
337+
$div.on( 'ajaxComplete', fn );
338338
$method( x ).ajaxComplete();
339339
div.ajaxComplete;
340340
ajaxError();
341341
$.ajaxError();
342342
[].ajaxError();
343-
div.ajaxError();
343+
$div.on( 'ajaxError', fn );
344344
$method( x ).ajaxError();
345345
div.ajaxError;
346346
ajaxSuccess();
347347
$.ajaxSuccess();
348348
[].ajaxSuccess();
349-
div.ajaxSuccess();
349+
$div.on( 'ajaxSuccess', fn );
350350
$method( x ).ajaxSuccess();
351351
div.ajaxSuccess;
352352
ajaxSend();
353353
$.ajaxSend();
354354
[].ajaxSend();
355-
div.ajaxSend();
355+
$div.on( 'ajaxSend', fn );
356356
$method( x ).ajaxSend();
357357
div.ajaxSend;
358358
$div.load( 'url', handler );
@@ -365,6 +365,12 @@ $div.ajaxComplete();
365365
$div.ajaxError();
366366
$div.ajaxSuccess();
367367
$div.ajaxSend();
368+
$div.on( 'ajaxStart', fn );
369+
$div.on( 'ajaxStop', fn );
370+
$div.on( 'ajaxComplete', fn );
371+
$div.on( 'ajaxError', fn );
372+
$div.on( 'ajaxSuccess', fn );
373+
$div.on( 'ajaxSend', fn );
368374
```
369375

370376
🔧 The `--fix` option can be used to fix problems reported by this rule:

docs/no-live.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ $( 'div' ).live();
1212
$div.live();
1313
$( 'div' ).first().live();
1414
$( 'div' ).append( $( 'input' ).live() );
15+
$( 'div' ).die();
16+
$div.die();
17+
$( 'div' ).first().die();
18+
$( 'div' ).append( $( 'input' ).die() );
1519
```
1620

1721
✔️ The following patterns are not considered errors:
@@ -20,6 +24,10 @@ live();
2024
[].live();
2125
div.live();
2226
div.live;
27+
die();
28+
[].die();
29+
div.die();
30+
div.die;
2331
```
2432
## Rule source
2533

docs/no-noop.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ $.noop();
1515
foo.noop;
1616
foo.noop();
1717
foo.noop( bar );
18+
$.noOp;
1819
```
1920

2021
🔧 The `--fix` option can be used to fix problems reported by this rule:

0 commit comments

Comments
 (0)