]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: lint + include tsx files for lint
authorEvan You <yyx990803@gmail.com>
Mon, 14 Oct 2019 19:07:43 +0000 (15:07 -0400)
committerEvan You <yyx990803@gmail.com>
Mon, 14 Oct 2019 19:07:43 +0000 (15:07 -0400)
package.json
packages/compiler-dom/src/transforms/vOn.ts
packages/runtime-core/__tests__/apiCreateComponent.spec.tsx
packages/runtime-core/src/apiLifecycle.ts
packages/runtime-core/src/helpers/renderList.ts
packages/runtime-dom/src/directives/vOn.ts

index 103d9336558a8a2edcbe790f3dad9ab532712f0f..edf9f47d9289da363411f0c052de09a9c9806a21 100644 (file)
@@ -9,7 +9,7 @@
     "size-runtime": "node scripts/build.js runtime-dom -p -f global",
     "size-compiler": "node scripts/build.js compiler-dom -p -f global",
     "size": "yarn size-runtime && yarn size-compiler",
-    "lint": "prettier --write --parser typescript \"packages/**/*.ts\"",
+    "lint": "prettier --write --parser typescript \"packages/**/*.ts?(x)\"",
     "test": "jest"
   },
   "gitHooks": {
@@ -21,7 +21,7 @@
       "prettier --write",
       "git add"
     ],
-    "*.ts": [
+    "*.ts?(x)": [
       "prettier --parser=typescript --write",
       "git add"
     ]
index 73e7fdb945ee832a2fe67e3d8fca51653137aedb..b0838acf1e8ca9a21f6ff8d8c9fdc641362607b6 100644 (file)
@@ -41,7 +41,7 @@ export const transformOn: DirectiveTransform = (dir, node, context) => {
   if (
     // if event name is dynamic, always wrap with keys guard
     key.type === NodeTypes.COMPOUND_EXPRESSION ||
-    !(key.isStatic) ||
+    !key.isStatic ||
     key.content.toLowerCase() in KEYBOARD_EVENTS
   ) {
     handler = createCallExpression(context.helper(V_ON_KEYS_GUARD), [
index c64eaa074885eb6764b2fe4cdcb287a8559fb1da..f02b089f079c4b7eda8703ac730f584d8db09e68 100644 (file)
@@ -67,7 +67,7 @@ test('createComponent type inference', () => {
     }
   })
   // test TSX props inference
-  ;(<MyComponent a={1} b="foo" dd={['foo']} ddd={['foo']}/>)
+  ;<MyComponent a={1} b="foo" dd={['foo']} ddd={['foo']} />
 })
 
 test('type inference w/ optional props declaration', () => {
@@ -85,14 +85,14 @@ test('type inference w/ optional props declaration', () => {
       return h('div', this.msg)
     }
   })
-  ;(<Comp msg="hello"/>)
+  ;<Comp msg="hello" />
 })
 
 test('type inference w/ direct setup function', () => {
   const Comp = createComponent((props: { msg: string }) => {
     return () => <div>{props.msg}</div>
   })
-  ;(<Comp msg="hello"/>)
+  ;<Comp msg="hello" />
 })
 
 test('type inference w/ array props declaration', () => {
@@ -113,7 +113,7 @@ test('type inference w/ array props declaration', () => {
       this.c
     }
   })
-  ;(<Comp a={1} b={2}/>)
+  ;<Comp a={1} b={2} />
 })
 
 test('with legacy options', () => {
index f8303616bc84ad323d47594a8e8e24b0cc7ce0a4..8a22af23904241f5a00448033f682f41221018d8 100644 (file)
@@ -50,10 +50,8 @@ function injectHook(
 
 const createHook = <T extends Function = () => any>(
   lifecycle: LifecycleHooks
-) => (
-  hook: T,
-  target: ComponentInternalInstance | null = currentInstance
-) => injectHook(lifecycle, hook, target)
+) => (hook: T, target: ComponentInternalInstance | null = currentInstance) =>
+  injectHook(lifecycle, hook, target)
 
 export const onBeforeMount = createHook(LifecycleHooks.BEFORE_MOUNT)
 export const onMounted = createHook(LifecycleHooks.MOUNTED)
index 43841f31ca2feb167eab0f87ea22b0dabeffc4b0..5cd92e5b2f7a697d7c6f76b7b01673a87e2cd6f2 100644 (file)
@@ -16,10 +16,7 @@ export function renderList(
     }
   } else if (isObject(source)) {
     if (source[Symbol.iterator as any]) {
-      ret = Array.from(
-        source as Iterable<any>, 
-        renderItem
-      )
+      ret = Array.from(source as Iterable<any>, renderItem)
     } else {
       const keys = Object.keys(source)
       ret = new Array(keys.length)
index b0647995612c216a69486dc25f84f8c999218494..ccfda3758cc9c9801342e3dc2125c3c5867a6bf5 100644 (file)
@@ -28,7 +28,6 @@ export const vOnModifiersGuard = (fn: Function, modifiers: string[]) => {
   }
 }
 
-
 // Kept for 2.x compat.
 // Note: IE11 compat for `spacebar` and `del` is removed for now.
 const keyNames: Record<string, string | string[]> = {