Преглед изворни кода

update eslint config, fix test case

Evan You пре 10 година
родитељ
комит
c0cd3e117e

+ 1 - 2
.eslintrc

@@ -1,7 +1,6 @@
 {
-  "extends": "standard",
+  "extends": "vue",
   "rules": {
-    "arrow-parens": [2, "as-needed"],
     "no-duplicate-imports": 0
   }
 }

+ 1 - 3
package.json

@@ -53,9 +53,7 @@
     "casperjs": "^1.1.0-beta5",
     "codecov.io": "^0.1.2",
     "eslint": "^2.1.0",
-    "eslint-config-standard": "^5.1.0",
-    "eslint-plugin-promise": "^1.0.8",
-    "eslint-plugin-standard": "^1.3.2",
+    "eslint-config-vue": "^1.0.0",
     "istanbul-instrumenter-loader": "^0.1.3",
     "jasmine-core": "^2.4.1",
     "karma": "^0.13.8",

+ 1 - 1
src/compiler/compile-props.js

@@ -334,7 +334,7 @@ function assertProp (prop, value, vm) {
   var expectedTypes = []
   if (type) {
     if (!isArray(type)) {
-      type = [ type ]
+      type = [type]
     }
     for (var i = 0; i < type.length && !valid; i++) {
       var assertedType = assertType(value, type[i])

+ 1 - 1
src/filters/array-filters.js

@@ -92,7 +92,7 @@ export function orderBy (arr) {
   }
 
   // determine sortKeys & comparator
-  let firstArg = args[0]
+  const firstArg = args[0]
   if (!firstArg) {
     return arr
   } else if (typeof firstArg === 'function') {

+ 1 - 1
src/index.js

@@ -5,7 +5,7 @@ import config from './config'
 
 installGlobalAPI(Vue)
 
-Vue.version = '1.0.21'
+Vue.version = '1.0.22'
 
 export default Vue
 

+ 3 - 3
src/watcher.js

@@ -336,13 +336,13 @@ Watcher.prototype.teardown = function () {
 
 const seenObjects = new Set()
 function traverse (val, seen) {
-  let i, keys, isA, isO
+  let i, keys
   if (!seen) {
     seen = seenObjects
     seen.clear()
   }
-  isA = isArray(val)
-  isO = isObject(val)
+  const isA = isArray(val)
+  const isO = isObject(val)
   if (isA || isO) {
     if (val.__ob__) {
       var depId = val.__ob__.dep.id

+ 5 - 2
test/.eslintrc

@@ -1,4 +1,7 @@
 {
+  "parserOptions": {
+    "ecmaVersion": 5
+  },
   "env": {
     "jasmine": true
   },
@@ -9,8 +12,8 @@
     "getWarnCount": true
   },
   "rules": {
-    "no-new": 0,
     "no-multi-str": 0,
-    "standard/object-curly-even-spacing": 0
+    "object-curly-spacing": 0,
+    "array-bracket-spacing": 0
   }
 }

+ 2 - 2
test/unit/specs/instance/state_spec.js

@@ -11,7 +11,7 @@ describe('Instance state initialization', function () {
 
   it('should initialize data once per strat', function () {
     var spyOncePerStrat = jasmine.createSpy('called once per strat')
-    const VM = Vue.extend({
+    var Comp = Vue.extend({
       data: function () {
         spyOncePerStrat()
         return {
@@ -19,7 +19,7 @@ describe('Instance state initialization', function () {
         }
       }
     })
-    new VM({
+    new Comp({
       data: function () {
         spyOncePerStrat()
         return {