Skip to content

Commit be11db6

Browse files
authored
chore: add lint cache (#2052)
* chore: add lint cache * chore: update * chore: revert dist
1 parent 4fb9dec commit be11db6

Some content is hidden

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

66 files changed

+132
-196
lines changed

.eslintignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
dist
1+
**/dist/**

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.DS_Store
22
node_modules/
3+
.eslintcache
34

45
# Editor files
56
/.idea

.prettierrc.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
22
"semi": false,
3-
"singleQuote": true
3+
"singleQuote": true,
4+
"trailingComma": "none",
5+
"arrowParens": "avoid"
46
}

docs/api/options.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ You can also pass a function that takes the props as an argument:
169169
```js
170170
shallowMount(Component, {
171171
scopedSlots: {
172-
foo: function(props) {
172+
foo: function (props) {
173173
return this.$createElement('div', props.index)
174174
}
175175
}

docs/fr/api/options.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ Vous pouvez également passer une fonction qui prend les props comme argument :
168168
```js
169169
shallowMount(Component, {
170170
scopedSlots: {
171-
foo: function(props) {
171+
foo: function (props) {
172172
return this.$createElement('div', props.index)
173173
}
174174
}

docs/fr/guides/common-tips.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ En pratique, bien que nous appelions et attendions `setData` pour assurer la mis
221221

222222
```js
223223
const transitionStub = () => ({
224-
render: function(h) {
224+
render: function (h) {
225225
return this.$options._renderChildren
226226
}
227227
})

docs/fr/guides/dom-events.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ Ce composant permet d'incrémenter/décrémenter la quantité à l'aide de diff
144144
},
145145
146146
watch: {
147-
quantity: function(newValue) {
147+
quantity: function (newValue) {
148148
this.$emit('input', newValue)
149149
}
150150
}

docs/fr/installation/using-other-test-runners.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Vous trouverez ci-dessous une configuration de base de Karma pour Vue Test Utils
1212
// karma.conf.js
1313
var webpackConfig = require('./webpack.config.js')
1414

15-
module.exports = function(config) {
15+
module.exports = function (config) {
1616
config.set({
1717
frameworks: ['mocha'],
1818
files: ['test/**/*.spec.js'],

docs/guides/common-tips.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ In practice, although we are calling and awaiting `setData` to ensure the DOM is
223223

224224
```js
225225
const transitionStub = () => ({
226-
render: function(h) {
226+
render: function (h) {
227227
return this.$options._renderChildren
228228
}
229229
})

docs/guides/dom-events.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ This component allows to increment/decrement the quantity using various keys.
142142
},
143143
144144
watch: {
145-
quantity: function(newValue) {
145+
quantity: function (newValue) {
146146
this.$emit('input', newValue)
147147
}
148148
}

docs/installation/using-other-test-runners.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Following is a basic Karma config for Vue Test Utils:
1212
// karma.conf.js
1313
var webpackConfig = require('./webpack.config.js')
1414

15-
module.exports = function(config) {
15+
module.exports = function (config) {
1616
config.set({
1717
frameworks: ['mocha'],
1818
files: ['test/**/*.spec.js'],

docs/ja/api/options.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ props を引数に取る関数を渡すことができます。
9494
```js
9595
shallowMount(Component, {
9696
scopedSlots: {
97-
foo: function(props) {
97+
foo: function (props) {
9898
return this.$createElement('div', props.index)
9999
}
100100
}

docs/ja/guides/dom-events.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ it('Click on yes button calls our method with argument "yes"', async () => {
134134
}
135135
},
136136
watch: {
137-
quantity: function(newValue) {
137+
quantity: function (newValue) {
138138
this.$emit('input', newValue)
139139
}
140140
}

docs/ja/guides/getting-started.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ it('will catch the error using done', done => {
131131
})
132132

133133
it('will catch the error using a promise', () => {
134-
return Vue.nextTick().then(function() {
134+
return Vue.nextTick().then(function () {
135135
expect(true).toBe(false)
136136
})
137137
})

docs/ja/installation/testing-single-file-components-with-karma.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ npm install --save-dev @vue/test-utils karma karma-chrome-launcher karma-mocha k
3636

3737
var webpackConfig = require('./webpack.config.js')
3838

39-
module.exports = function(config) {
39+
module.exports = function (config) {
4040
config.set({
4141
frameworks: ['mocha'],
4242

@@ -160,7 +160,7 @@ npm install --save-dev babel-plugin-istanbul
160160
```js
161161
// karma.conf.js
162162

163-
module.exports = function(config) {
163+
module.exports = function (config) {
164164
config.set({
165165
// ...
166166

docs/ru/api/options.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ shallowMount(Component, {
107107
```js
108108
shallowMount(Component, {
109109
scopedSlots: {
110-
foo: function(props) {
110+
foo: function (props) {
111111
return this.$createElement('div', props.index)
112112
}
113113
}

docs/ru/guides/dom-events.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ describe('Click event', () => {
136136
},
137137
138138
watch: {
139-
quantity: function(newValue) {
139+
quantity: function (newValue) {
140140
this.$emit('input', newValue)
141141
}
142142
}

docs/ru/guides/getting-started.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ it('должен отлавливать ошибку с использовани
131131
})
132132

133133
it('должен отлавливать ошибку с использованием promise', () => {
134-
return Vue.nextTick().then(function() {
134+
return Vue.nextTick().then(function () {
135135
expect(true).toBe(false)
136136
})
137137
})

docs/ru/installation/testing-single-file-components-with-karma.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ npm install --save-dev @vue/test-utils karma karma-chrome-launcher karma-mocha k
3636

3737
var webpackConfig = require('./webpack.config.js')
3838

39-
module.exports = function(config) {
39+
module.exports = function (config) {
4040
config.set({
4141
frameworks: ['mocha'],
4242

@@ -160,7 +160,7 @@ npm install --save-dev babel-plugin-istanbul
160160
```js
161161
// karma.conf.js
162162

163-
module.exports = function(config) {
163+
module.exports = function (config) {
164164
config.set({
165165
// ...
166166

docs/zh/api/options.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ shallowMount(Component, {
167167
```js
168168
shallowMount(Component, {
169169
scopedSlots: {
170-
foo: function(props) {
170+
foo: function (props) {
171171
return this.$createElement('div', props.index)
172172
}
173173
}

docs/zh/guides/common-tips.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ test('should render Foo, then hide it', async () => {
222222

223223
```js
224224
const transitionStub = () => ({
225-
render: function(h) {
225+
render: function (h) {
226226
return this.$options._renderChildren
227227
}
228228
})

docs/zh/guides/dom-events.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ it('Click on yes button calls our method with argument "yes"', async () => {
142142
},
143143
144144
watch: {
145-
quantity: function(newValue) {
145+
quantity: function (newValue) {
146146
this.$emit('input', newValue)
147147
}
148148
}

docs/zh/guides/getting-started.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ it('will catch the error using done', done => {
164164
})
165165

166166
it('will catch the error using a promise', () => {
167-
return Vue.nextTick().then(function() {
167+
return Vue.nextTick().then(function () {
168168
expect(true).toBe(false)
169169
})
170170
})

docs/zh/installation/testing-single-file-components-with-karma.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ npm install --save-dev @vue/test-utils karma karma-chrome-launcher karma-mocha k
3636

3737
var webpackConfig = require('./webpack.config.js')
3838

39-
module.exports = function(config) {
39+
module.exports = function (config) {
4040
config.set({
4141
frameworks: ['mocha'],
4242

@@ -160,7 +160,7 @@ npm install --save-dev babel-plugin-istanbul
160160
```js
161161
// karma.conf.js
162162

163-
module.exports = function(config) {
163+
module.exports = function (config) {
164164
config.set({
165165
// ...
166166

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
"docs": "vuepress dev docs",
1818
"docs:build": "vuepress build docs",
1919
"flow": "flow check",
20-
"lint": "eslint --ext js,vue .",
20+
"lint": "eslint --ext js,vue . --cache",
2121
"lint:docs": "eslint --ext js,vue,md docs --ignore-path .gitignore",
2222
"lint:fix": "yarn lint -- --fix",
23-
"format": "prettier --write \"**/*.{js,json,vue,md}\"",
23+
"format": "prettier --write \"**/*.{js,json,vue,md}\" --cache",
2424
"format:check": "prettier --check \"**/*.{js,json,vue,md}\"",
2525
"release": "yarn build && yarn test:unit && lerna publish --conventional-commits -m \"chore(release): publish %s\"",
2626
"test": "yarn format:check && yarn lint && yarn lint:docs && yarn flow && yarn test:types && yarn test:unit -w 1 && yarn test:unit:browser",
@@ -91,7 +91,7 @@
9191
"karma-spec-reporter": "^0.0.32",
9292
"karma-webpack": "^4.0.2",
9393
"lint-staged": "^9.5.0",
94-
"prettier": "^1.16.0",
94+
"prettier": "^2.8.1",
9595
"puppeteer": "^5.2.1",
9696
"rollup-plugin-delete": "^2.0.0",
9797
"@rollup/plugin-replace": "^2.3.3",

packages/create-instance/create-instance.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export default function createInstance(
107107
const parentComponentOptions = options.parentComponent || {}
108108

109109
const originalParentComponentProvide = parentComponentOptions.provide
110-
parentComponentOptions.provide = function() {
110+
parentComponentOptions.provide = function () {
111111
return {
112112
...getValuesFromCallableOption.call(this, originalParentComponentProvide),
113113
// $FlowIgnore
@@ -116,7 +116,7 @@ export default function createInstance(
116116
}
117117

118118
const originalParentComponentData = parentComponentOptions.data
119-
parentComponentOptions.data = function() {
119+
parentComponentOptions.data = function () {
120120
return {
121121
...getValuesFromCallableOption.call(this, originalParentComponentData),
122122
vueTestUtils_childProps: { ...options.propsData }
@@ -126,7 +126,7 @@ export default function createInstance(
126126
parentComponentOptions.$_doNotStubChildren = true
127127
parentComponentOptions.$_isWrapperParent = true
128128
parentComponentOptions._isFunctionalContainer = componentOptions.functional
129-
parentComponentOptions.render = function(h) {
129+
parentComponentOptions.render = function (h) {
130130
return h(
131131
Constructor,
132132
createContext(options, scopedSlots, this.vueTestUtils_childProps),

packages/create-instance/create-scoped-slots.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ function isDestructuringSlotScope(slotScope: string): boolean {
88
return /^{.*}$/.test(slotScope)
99
}
1010

11-
function getVueTemplateCompilerHelpers(
12-
_Vue: Component
13-
): { [name: string]: Function } {
11+
function getVueTemplateCompilerHelpers(_Vue: Component): {
12+
[name: string]: Function
13+
} {
1414
// $FlowIgnore
1515
const vue = new _Vue()
1616
const helpers = {}
@@ -111,7 +111,7 @@ export default function createScopedSlots(
111111

112112
const slotScope = scopedSlotMatches.match && scopedSlotMatches.match[1]
113113

114-
scopedSlots[scopedSlotName] = function(props) {
114+
scopedSlots[scopedSlotName] = function (props) {
115115
let res
116116
if (isFn) {
117117
res = renderFn.call({ ...helpers }, props)

packages/create-instance/log-events.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function logEvents(
1515

1616
export function addEventLogger(_Vue: Component): void {
1717
_Vue.mixin({
18-
beforeCreate: function() {
18+
beforeCreate: function () {
1919
this.__emitted = Object.create(null)
2020
this.__emittedByOrder = []
2121
logEvents(this, this.__emitted, this.__emittedByOrder)

packages/shared/validators.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ function makeMap(str: string, expectsLowerCase?: boolean) {
137137
map[list[i]] = true
138138
}
139139
return expectsLowerCase
140-
? function(val: string) {
140+
? function (val: string) {
141141
return map[val.toLowerCase()]
142142
}
143-
: function(val: string) {
143+
: function (val: string) {
144144
return map[val]
145145
}
146146
}

packages/test-utils/src/wrapper-array.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type VueWrapper from './vue-wrapper'
55
import { throwError } from 'shared/util'
66

77
export default class WrapperArray implements BaseWrapper {
8-
+wrappers: Array<Wrapper | VueWrapper>
8+
+wrappers: Array<Wrapper | VueWrapper>;
99
+length: number
1010
selector: Selector | void
1111

packages/test-utils/src/wrapper.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ import createDOMEvent from './create-dom-event'
2929
import { throwIfInstancesThrew } from './error'
3030

3131
export default class Wrapper implements BaseWrapper {
32-
+vnode: VNode | null
32+
+vnode: VNode | null;
3333
+vm: Component | void
3434
_emitted: { [name: string]: Array<Array<any>> }
35-
_emittedByOrder: Array<{ name: string, args: Array<any> }>
36-
+element: Element
35+
_emittedByOrder: Array<{ name: string, args: Array<any> }>;
36+
+element: Element;
3737
+options: WrapperOptions
3838
isFunctionalComponent: boolean
3939
rootNode: VNode | Element
@@ -502,9 +502,7 @@ export default class Wrapper implements BaseWrapper {
502502
? value.map((calledWith, index) => {
503503
const callParams = calledWith.map(param =>
504504
typeof param === 'object'
505-
? JSON.stringify(param)
506-
.replace(/"/g, '')
507-
.replace(/,/g, ', ')
505+
? JSON.stringify(param).replace(/"/g, '').replace(/,/g, ', ')
508506
: param
509507
)
510508

test/resources/components/component-with-computed.vue

+2-5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@ export default {
1111
message: 'egassem'
1212
}),
1313
computed: {
14-
reversedMessage: function() {
15-
return this.message
16-
.split('')
17-
.reverse()
18-
.join('')
14+
reversedMessage: function () {
15+
return this.message.split('').reverse().join('')
1916
}
2017
}
2118
}

test/resources/components/component-with-transitions.vue

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
<template>
22
<div>
33
<transition>
4-
<span v-if="!expanded" data-testid="expanded">
5-
Content
6-
</span>
4+
<span v-if="!expanded" data-testid="expanded"> Content </span>
75
</transition>
86
</div>
97
</template>

test/resources/components/component-with-watch-immediate.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<script>
88
export default {
9-
data: function() {
9+
data: function () {
1010
return {
1111
data1: null
1212
}

0 commit comments

Comments
 (0)