Skip to content

Commit 7305926

Browse files
committed
refactor: code style
1 parent c988dbb commit 7305926

File tree

7 files changed

+47
-52
lines changed

7 files changed

+47
-52
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ jobs:
2424
key: node-10-dependencies-{{ checksum "package.json" }}
2525

2626
# run tests!
27-
- run: npm run test
27+
- run: yarn test

e2e/__projects__/babel-in-package/test.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import { createApp, h } from 'vue'
2-
import { resolve } from 'path'
3-
import { readFileSync } from 'fs'
42

53
import TypeScript from './components/TypeScript.vue'
64
import Basic from './components/Basic.vue'
@@ -16,7 +14,7 @@ function mount(Component, props, slots) {
1614
return h(Component, props, slots)
1715
}
1816
}
19-
const app = createApp(Parent).mount(el)
17+
createApp(Parent).mount(el)
2018
}
2119

2220
test('processes .vue files', () => {
@@ -32,7 +30,7 @@ test('processes .vue file with lang set to coffee', () => {
3230
})
3331

3432
test('processes .vue files with lang set to typescript', () => {
35-
const wrapper = mount(TypeScript)
33+
mount(TypeScript)
3634
expect(document.querySelector('#parent').textContent).toBe('Parent')
3735
expect(document.querySelector('#child').textContent).toBe('Child')
3836
})

e2e/__projects__/basic/test.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ import FunctionalSFCParent from './components/FunctionalSFCParent.vue'
1515
import NoScript from './components/NoScript.vue'
1616
import PugRelative from './components/PugRelativeExtends.vue'
1717
import { randomExport } from './components/NamedExport.vue'
18+
1819
// TODO: JSX for Vue 3? TSX?
19-
// import Jsx from './components/Jsx.vue'
20+
import Jsx from './components/Jsx.vue'
2021

2122
function mount(Component, props, slots) {
2223
document.getElementsByTagName('html')[0].innerHTML = ''
@@ -28,7 +29,7 @@ function mount(Component, props, slots) {
2829
return h(Component, props, slots)
2930
}
3031
}
31-
const app = createApp(Parent).mount(el)
32+
createApp(Parent).mount(el)
3233
}
3334

3435
test('processes .vue files', () => {
@@ -82,16 +83,12 @@ test('processes .vue file with lang set to coffeescript', () => {
8283
})
8384

8485
test('processes SFC with no template', () => {
85-
const wrapper = mount(
86-
RenderFunction,
87-
{},
88-
{ default: () => h('div', { id: 'slot' }) }
89-
)
86+
mount(RenderFunction, {}, { default: () => h('div', { id: 'slot' }) })
9087
expect(document.querySelector('#slot')).toBeTruthy()
9188
})
9289

9390
test('processes .vue files with lang set to typescript', () => {
94-
const wrapper = mount(TypeScript)
91+
mount(TypeScript)
9592
expect(document.querySelector('#parent').textContent).toBe('Parent')
9693
expect(document.querySelector('#child').textContent).toBe('Child')
9794
})
@@ -114,7 +111,7 @@ test('supports relative paths when extending templates from .pug files', () => {
114111

115112
// TODO: How do functional components work in Vue 3?
116113
xtest('processes functional components', () => {
117-
const clickSpy = jest.fn()
114+
// const clickSpy = jest.fn()
118115
mount(FunctionalSFC)
119116
})
120117

@@ -126,6 +123,6 @@ xtest('processes SFC with functional template from parent', () => {
126123

127124
// TODO: JSX in Vue 3?
128125
xtest('processes .vue file using jsx', () => {
129-
const wrapper = mount(Jsx)
126+
mount(Jsx)
130127
expect(document.querySelector('#jsx')).toBeTruthy()
131128
})

e2e/__projects__/custom-transformers/test.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
import { createApp, h } from 'vue'
1+
// import { createApp, h } from 'vue'
22

3-
import Scss from './components/Scss.vue'
3+
// import Scss from './components/Scss.vue'
44

5-
function mount(Component, props, slots) {
6-
document.getElementsByTagName('html')[0].innerHTML = ''
7-
const el = document.createElement('div')
8-
el.id = 'app'
9-
document.body.appendChild(el)
10-
const Parent = {
11-
render() {
12-
return h(Component, props, slots)
13-
}
14-
}
15-
createApp(Parent).mount(el)
16-
}
5+
// function mount(Component, props, slots) {
6+
// document.getElementsByTagName('html')[0].innerHTML = ''
7+
// const el = document.createElement('div')
8+
// el.id = 'app'
9+
// document.body.appendChild(el)
10+
// const Parent = {
11+
// render() {
12+
// return h(Component, props, slots)
13+
// }
14+
// }
15+
// createApp(Parent).mount(el)
16+
// }
1717

1818
// TODO: Figure this out with Vue 3. `$style` no longer exists.
1919
test.todo('processes SCSS using user specified post transforms')

e2e/__projects__/style/test.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,42 +24,42 @@ function mount(Component, props, slots) {
2424

2525
xtest('processes Less', () => {
2626
mount(Less)
27-
expect(wrapper.is('div')).toBeTruthy()
28-
expect(wrapper.vm.$style.a).toEqual('a')
27+
// expect(wrapper.is('div')).toBeTruthy()
28+
// expect(wrapper.vm.$style.a).toEqual('a')
2929
})
3030

3131
xtest('processes PostCSS', () => {
3232
mount(PostCss)
33-
expect(wrapper.is('section')).toBeTruthy()
34-
expect(wrapper.vm.$style.a).toEqual('a')
35-
expect(wrapper.vm.$style.b).toEqual('b')
33+
// expect(wrapper.is('section')).toBeTruthy()
34+
// expect(wrapper.vm.$style.a).toEqual('a')
35+
// expect(wrapper.vm.$style.b).toEqual('b')
3636
})
3737

3838
xtest('processes Sass', () => {
3939
mount(Sass)
40-
expect(wrapper.vm.$style.a).toEqual('a')
41-
expect(wrapper.vm.$style.b).toEqual('b')
42-
expect(wrapper.vm.$style.c).toEqual('c')
43-
expect(wrapper.vm.$style.light).toBeUndefined()
40+
// expect(wrapper.vm.$style.a).toEqual('a')
41+
// expect(wrapper.vm.$style.b).toEqual('b')
42+
// expect(wrapper.vm.$style.c).toEqual('c')
43+
// expect(wrapper.vm.$style.light).toBeUndefined()
4444
})
4545

4646
xtest('processes SCSS with resources', () => {
4747
mount(Scss)
48-
expect(wrapper.vm.$style.a).toEqual('a')
49-
expect(wrapper.vm.$style.b).toEqual('b')
50-
expect(wrapper.vm.$style.c).toEqual('c')
48+
// expect(wrapper.vm.$style.a).toEqual('a')
49+
// expect(wrapper.vm.$style.b).toEqual('b')
50+
// expect(wrapper.vm.$style.c).toEqual('c')
5151
})
5252

5353
xtest('process Stylus', () => {
5454
mount(Stylus)
55-
expect(wrapper.vm).toBeTruthy()
56-
expect(wrapper.vm.css.a).toEqual('a')
57-
expect(wrapper.vm.$style.b).toEqual('b')
55+
// expect(wrapper.vm).toBeTruthy()
56+
// expect(wrapper.vm.css.a).toEqual('a')
57+
// expect(wrapper.vm.$style.b).toEqual('b')
5858
})
5959

6060
xtest('process External', () => {
6161
mount(External)
62-
expect(wrapper.vm).toBeTruthy()
63-
expect(wrapper.vm.$style.xtestClass).toEqual('xtestClass')
64-
expect(wrapper.vm.css.a).toEqual('a')
62+
// expect(wrapper.vm).toBeTruthy()
63+
// expect(wrapper.vm.$style.xtestClass).toEqual('xtestClass')
64+
// expect(wrapper.vm.css.a).toEqual('a')
6565
})

lib/generate-code.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const namespace = require('./constants').vueOptionsNamespace
1+
// const namespace = require('./constants').vueOptionsNamespace
22

3-
const splitRE = /\r?\n/g
3+
// const splitRE = /\r?\n/g
44

55
module.exports = function generateCode(
66
scriptResult,

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
"format": "prettier --no-semi --single-quote --write '**/*.{js,json,md}'",
2222
"format:check": "prettier --no-semi --single-quote --check '**/*.{js,json,md}'",
2323
"lint": "eslint --ignore-path .gitignore '{,!(node_modules)/**/}*.js'",
24-
"lint:fix": "npm run lint --fix",
24+
"lint:fix": "yarn lint --fix",
2525
"release": "semantic-release",
26-
"test": "npm run lint && npm run format:check && npm run test:e2e",
26+
"test": "yarn lint && yarn format:check && yarn test:e2e",
2727
"test:e2e": "node e2e/test-runner"
2828
},
2929
"author": "Edd Yerburgh",
@@ -83,7 +83,7 @@
8383
},
8484
"lint-staged": {
8585
"*.{js,json,css,md,vue}": [
86-
"npm run format",
86+
"yarn format",
8787
"git add"
8888
]
8989
}

0 commit comments

Comments
 (0)