Skip to content

Commit deac205

Browse files
committed
eslint for tests
1 parent 7cf0f58 commit deac205

Some content is hidden

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

54 files changed

+436
-327
lines changed

.jshintrc

Lines changed: 0 additions & 21 deletions
This file was deleted.

test/.eslintrc

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"node": true
5+
},
6+
7+
"globals": {
8+
"jQuery": true,
9+
"$": true,
10+
"jasmine": true,
11+
"describe": true,
12+
"expect": true,
13+
"it": true,
14+
"beforeEach": true,
15+
"afterEach": true,
16+
"spyOn": true,
17+
"hasWarned": true
18+
},
19+
20+
"rules": {
21+
"accessor-pairs": 2,
22+
"array-bracket-spacing": 0,
23+
"block-scoped-var": 0,
24+
"brace-style": [2, "1tbs", { "allowSingleLine": true }],
25+
"camelcase": 0,
26+
"comma-dangle": [2, "never"],
27+
"comma-spacing": [2, { "before": false, "after": true }],
28+
"comma-style": [2, "last"],
29+
"complexity": 0,
30+
"computed-property-spacing": 0,
31+
"consistent-return": 0,
32+
"consistent-this": 0,
33+
"constructor-super": 2,
34+
"curly": [2, "multi-line"],
35+
"default-case": 0,
36+
"dot-location": [2, "property"],
37+
"dot-notation": 0,
38+
"eol-last": 2,
39+
"eqeqeq": [2, "allow-null"],
40+
"func-names": 0,
41+
"func-style": 0,
42+
"generator-star": 0,
43+
"generator-star-spacing": [2, { "before": true, "after": true }],
44+
"global-strict": 0,
45+
"guard-for-in": 0,
46+
"handle-callback-err": [2, "^(err|error)$" ],
47+
"indent": [2, 2],
48+
"key-spacing": [2, { "beforeColon": false, "afterColon": true }],
49+
"linebreak-style": 0,
50+
"lines-around-comment": 0,
51+
"max-depth": 0,
52+
"max-len": 0,
53+
"max-nested-callbacks": 0,
54+
"max-params": 0,
55+
"max-statements": 0,
56+
"new-cap": [2, { "newIsCap": true, "capIsNew": false }],
57+
"new-parens": 2,
58+
"newline-after-var": 0,
59+
"no-alert": 0,
60+
"no-array-constructor": 2,
61+
"no-bitwise": 0,
62+
"no-caller": 2,
63+
"no-catch-shadow": 0,
64+
"no-comma-dangle": 0,
65+
"no-cond-assign": 2,
66+
"no-console": 0,
67+
"no-constant-condition": 0,
68+
"no-continue": 0,
69+
"no-control-regex": 2,
70+
"no-debugger": 2,
71+
"no-delete-var": 2,
72+
"no-div-regex": 0,
73+
"no-dupe-args": 2,
74+
"no-dupe-keys": 2,
75+
"no-duplicate-case": 2,
76+
"no-else-return": 0,
77+
"no-empty": 0,
78+
"no-empty-character-class": 2,
79+
"no-empty-class": 0,
80+
"no-empty-label": 2,
81+
"no-eq-null": 0,
82+
"no-eval": 2,
83+
"no-ex-assign": 2,
84+
"no-extend-native": 2,
85+
"no-extra-bind": 2,
86+
"no-extra-boolean-cast": 2,
87+
"no-extra-parens": 0,
88+
"no-extra-semi": 0,
89+
"no-extra-strict": 0,
90+
"no-fallthrough": 2,
91+
"no-floating-decimal": 2,
92+
"no-func-assign": 2,
93+
"no-implied-eval": 2,
94+
"no-inline-comments": 0,
95+
"no-inner-declarations": [2, "functions"],
96+
"no-invalid-regexp": 2,
97+
"no-irregular-whitespace": 2,
98+
"no-iterator": 2,
99+
"no-label-var": 2,
100+
"no-labels": 2,
101+
"no-lone-blocks": 2,
102+
"no-lonely-if": 0,
103+
"no-loop-func": 0,
104+
"no-mixed-requires": 0,
105+
"no-mixed-spaces-and-tabs": 2,
106+
"no-multi-spaces": 2,
107+
"no-multi-str": 0,
108+
"no-multiple-empty-lines": [2, { "max": 1 }],
109+
"no-native-reassign": 2,
110+
"no-negated-in-lhs": 2,
111+
"no-nested-ternary": 0,
112+
"no-new": 0,
113+
"no-new-func": 0,
114+
"no-new-object": 2,
115+
"no-new-require": 2,
116+
"no-new-wrappers": 2,
117+
"no-obj-calls": 2,
118+
"no-octal": 2,
119+
"no-octal-escape": 2,
120+
"no-param-reassign": 0,
121+
"no-path-concat": 0,
122+
"no-plusplus": 0,
123+
"no-process-env": 0,
124+
"no-process-exit": 0,
125+
"no-proto": 0,
126+
"no-redeclare": 2,
127+
"no-regex-spaces": 2,
128+
"no-reserved-keys": 0,
129+
"no-restricted-modules": 0,
130+
"no-return-assign": 2,
131+
"no-script-url": 0,
132+
"no-self-compare": 2,
133+
"no-sequences": 2,
134+
"no-shadow": 0,
135+
"no-shadow-restricted-names": 2,
136+
"no-space-before-semi": 0,
137+
"no-spaced-func": 2,
138+
"no-sparse-arrays": 2,
139+
"no-sync": 0,
140+
"no-ternary": 0,
141+
"no-this-before-super": 2,
142+
"no-throw-literal": 2,
143+
"no-trailing-spaces": 2,
144+
"no-undef": 2,
145+
"no-undef-init": 2,
146+
"no-undefined": 0,
147+
"no-underscore-dangle": 0,
148+
"no-unexpected-multiline": 2,
149+
"no-unneeded-ternary": 2,
150+
"no-unreachable": 2,
151+
"no-unused-expressions": 0,
152+
"no-unused-vars": [2, { "vars": "all", "args": "none" }],
153+
"no-use-before-define": 0,
154+
"no-var": 0,
155+
"no-void": 0,
156+
"no-warning-comments": 0,
157+
"no-with": 2,
158+
"no-wrap-func": 2,
159+
"object-curly-spacing": 0,
160+
"object-shorthand": 0,
161+
"one-var": [2, { "initialized": "never" }],
162+
"operator-assignment": 0,
163+
"operator-linebreak": [2, "after"],
164+
"padded-blocks": 0,
165+
"prefer-const": 0,
166+
"quote-props": 0,
167+
"quotes": [2, "single", "avoid-escape"],
168+
"radix": 2,
169+
"semi": [2, "never"],
170+
"semi-spacing": 0,
171+
"sort-vars": 0,
172+
"space-after-function-name": 0,
173+
"space-after-keywords": [2, "always"],
174+
"space-before-blocks": [2, "always"],
175+
"space-before-function-paren": [2, "always"],
176+
"space-before-function-parentheses": 0,
177+
"space-in-brackets": 0,
178+
"space-in-parens": [2, "never"],
179+
"space-infix-ops": 2,
180+
"space-return-throw-case": 2,
181+
"space-unary-ops": [2, { "words": true, "nonwords": false }],
182+
"spaced-comment": [2, "always", { "markers": ["global", "globals", "eslint", "eslint-disable", "*package", "!"] }],
183+
"spaced-line-comment": 0,
184+
"strict": 0,
185+
"use-isnan": 2,
186+
"valid-jsdoc": 0,
187+
"valid-typeof": 2,
188+
"vars-on-top": 0,
189+
"wrap-iife": [2, "any"],
190+
"wrap-regex": 0,
191+
"yoda": [2, "never"]
192+
}
193+
}

test/.jshintrc

Lines changed: 0 additions & 33 deletions
This file was deleted.

test/unit/specs/api/data_spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('Data API', function () {
4848
// invalid, should throw
4949
if (leftHandThrows()) {
5050
// if creating a function with invalid left hand
51-
// expression throws, the exp parser will catch the
51+
// expression throws, the exp parser will catch the
5252
// error and warn.
5353
vm.$set('c + d', 1)
5454
expect(hasWarned(_, 'Invalid setter function body')).toBe(true)
@@ -184,7 +184,7 @@ describe('Data API', function () {
184184

185185
function leftHandThrows () {
186186
try {
187-
var fn = new Function('a + b = 1')
187+
new Function('a + b = 1')
188188
} catch (e) {
189189
return true
190190
}

test/unit/specs/api/dom_spec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ if (_.inBrowser) {
2828
el: frag
2929
})
3030
})
31-
31+
3232
describe('$appendTo', function () {
33-
33+
3434
it('normal instance', function () {
3535
vm.$appendTo(parent, spy)
3636
expect(parent.childNodes.length).toBe(3)
@@ -52,7 +52,7 @@ if (_.inBrowser) {
5252
})
5353

5454
describe('$prependTo', function () {
55-
55+
5656
it('normal instance', function () {
5757
vm.$prependTo(parent, spy)
5858
expect(parent.childNodes.length).toBe(3)
@@ -87,7 +87,7 @@ if (_.inBrowser) {
8787
})
8888

8989
describe('$before', function () {
90-
90+
9191
it('normal instance', function () {
9292
vm.$before(sibling, spy)
9393
expect(parent.childNodes.length).toBe(3)
@@ -109,7 +109,7 @@ if (_.inBrowser) {
109109
})
110110

111111
describe('$after', function () {
112-
112+
113113
it('normal instance', function () {
114114
vm.$after(target, spy)
115115
expect(parent.childNodes.length).toBe(3)
@@ -149,7 +149,7 @@ if (_.inBrowser) {
149149
})
150150

151151
describe('$remove', function () {
152-
152+
153153
it('normal instance', function () {
154154
vm.$before(sibling)
155155
expect(parent.childNodes.length).toBe(3)

test/unit/specs/api/events_spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@ describe('Events API', function () {
77
vm = new Vue()
88
spy = jasmine.createSpy('emitter')
99
})
10-
10+
1111
it('$on', function () {
1212
vm.$on('test', function () {
1313
// expect correct context
1414
expect(this).toBe(vm)
1515
spy.apply(this, arguments)
1616
})
17-
vm.$emit('test', 1, 2 ,3, 4)
17+
vm.$emit('test', 1, 2, 3, 4)
1818
expect(spy.calls.count()).toBe(1)
1919
expect(spy).toHaveBeenCalledWith(1, 2, 3, 4)
2020
})
2121

2222
it('$once', function () {
2323
vm.$once('test', spy)
24-
vm.$emit('test', 1, 2 ,3)
24+
vm.$emit('test', 1, 2, 3)
2525
vm.$emit('test', 2, 3, 4)
2626
expect(spy.calls.count()).toBe(1)
2727
expect(spy).toHaveBeenCalledWith(1, 2, 3)
@@ -131,4 +131,4 @@ describe('Events API', function () {
131131
expect(spy).not.toHaveBeenCalled()
132132
})
133133

134-
})
134+
})

test/unit/specs/api/global_spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('Global API', function () {
6060
describe('Asset registration', function () {
6161

6262
var Test = Vue.extend()
63-
63+
6464
it('directive / elementDirective / filter / transition', function () {
6565
[
6666
'directive',
@@ -95,4 +95,4 @@ describe('Global API', function () {
9595

9696
})
9797

98-
})
98+
})

test/unit/specs/api/lifecycle_spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var compiler = require('../../../../src/compiler')
44

55
if (_.inBrowser) {
66
describe('Lifecycle API', function () {
7-
7+
88
describe('$mount', function () {
99

1010
var el, frag
@@ -76,7 +76,7 @@ if (_.inBrowser) {
7676
expect(vm.$el.className).toBe('replace-test')
7777
document.body.removeChild(vm.$el)
7878
})
79-
79+
8080
it('precompiled linker', function () {
8181
var linker = compiler.compile(el, Vue.options)
8282
var vm = new Vue({
@@ -168,7 +168,7 @@ if (_.inBrowser) {
168168
expect(vm._directives).toBeNull()
169169
expect(Object.keys(vm._events).length).toBe(0)
170170
})
171-
171+
172172
it('remove element', function () {
173173
var el = document.createElement('div')
174174
var parent = document.createElement('div')

0 commit comments

Comments
 (0)