Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add lint cache #2052

Merged
merged 3 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dist
**/dist/**
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.DS_Store
node_modules/
.eslintcache

# Editor files
/.idea
Expand Down
4 changes: 3 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"semi": false,
"singleQuote": true
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "avoid"
}
2 changes: 1 addition & 1 deletion docs/api/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ You can also pass a function that takes the props as an argument:
```js
shallowMount(Component, {
scopedSlots: {
foo: function(props) {
foo: function (props) {
return this.$createElement('div', props.index)
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/fr/api/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ Vous pouvez également passer une fonction qui prend les props comme argument :
```js
shallowMount(Component, {
scopedSlots: {
foo: function(props) {
foo: function (props) {
return this.$createElement('div', props.index)
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/fr/guides/common-tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ En pratique, bien que nous appelions et attendions `setData` pour assurer la mis

```js
const transitionStub = () => ({
render: function(h) {
render: function (h) {
return this.$options._renderChildren
}
})
Expand Down
2 changes: 1 addition & 1 deletion docs/fr/guides/dom-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Ce composant permet d'incrémenter/décrémenter la quantité à l'aide de diff
},

watch: {
quantity: function(newValue) {
quantity: function (newValue) {
this.$emit('input', newValue)
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/fr/installation/using-other-test-runners.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Vous trouverez ci-dessous une configuration de base de Karma pour Vue Test Utils
// karma.conf.js
var webpackConfig = require('./webpack.config.js')

module.exports = function(config) {
module.exports = function (config) {
config.set({
frameworks: ['mocha'],
files: ['test/**/*.spec.js'],
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/common-tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ In practice, although we are calling and awaiting `setData` to ensure the DOM is

```js
const transitionStub = () => ({
render: function(h) {
render: function (h) {
return this.$options._renderChildren
}
})
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/dom-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ This component allows to increment/decrement the quantity using various keys.
},

watch: {
quantity: function(newValue) {
quantity: function (newValue) {
this.$emit('input', newValue)
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/installation/using-other-test-runners.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Following is a basic Karma config for Vue Test Utils:
// karma.conf.js
var webpackConfig = require('./webpack.config.js')

module.exports = function(config) {
module.exports = function (config) {
config.set({
frameworks: ['mocha'],
files: ['test/**/*.spec.js'],
Expand Down
2 changes: 1 addition & 1 deletion docs/ja/api/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ props を引数に取る関数を渡すことができます。
```js
shallowMount(Component, {
scopedSlots: {
foo: function(props) {
foo: function (props) {
return this.$createElement('div', props.index)
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/ja/guides/dom-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ it('Click on yes button calls our method with argument "yes"', async () => {
}
},
watch: {
quantity: function(newValue) {
quantity: function (newValue) {
this.$emit('input', newValue)
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/ja/guides/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ it('will catch the error using done', done => {
})

it('will catch the error using a promise', () => {
return Vue.nextTick().then(function() {
return Vue.nextTick().then(function () {
expect(true).toBe(false)
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ npm install --save-dev @vue/test-utils karma karma-chrome-launcher karma-mocha k

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

module.exports = function(config) {
module.exports = function (config) {
config.set({
frameworks: ['mocha'],

Expand Down Expand Up @@ -160,7 +160,7 @@ npm install --save-dev babel-plugin-istanbul
```js
// karma.conf.js

module.exports = function(config) {
module.exports = function (config) {
config.set({
// ...

Expand Down
2 changes: 1 addition & 1 deletion docs/ru/api/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ shallowMount(Component, {
```js
shallowMount(Component, {
scopedSlots: {
foo: function(props) {
foo: function (props) {
return this.$createElement('div', props.index)
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/ru/guides/dom-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe('Click event', () => {
},

watch: {
quantity: function(newValue) {
quantity: function (newValue) {
this.$emit('input', newValue)
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/ru/guides/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ it('должен отлавливать ошибку с использовани
})

it('должен отлавливать ошибку с использованием promise', () => {
return Vue.nextTick().then(function() {
return Vue.nextTick().then(function () {
expect(true).toBe(false)
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ npm install --save-dev @vue/test-utils karma karma-chrome-launcher karma-mocha k

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

module.exports = function(config) {
module.exports = function (config) {
config.set({
frameworks: ['mocha'],

Expand Down Expand Up @@ -160,7 +160,7 @@ npm install --save-dev babel-plugin-istanbul
```js
// karma.conf.js

module.exports = function(config) {
module.exports = function (config) {
config.set({
// ...

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/api/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ shallowMount(Component, {
```js
shallowMount(Component, {
scopedSlots: {
foo: function(props) {
foo: function (props) {
return this.$createElement('div', props.index)
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/guides/common-tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ test('should render Foo, then hide it', async () => {

```js
const transitionStub = () => ({
render: function(h) {
render: function (h) {
return this.$options._renderChildren
}
})
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/guides/dom-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ it('Click on yes button calls our method with argument "yes"', async () => {
},

watch: {
quantity: function(newValue) {
quantity: function (newValue) {
this.$emit('input', newValue)
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/guides/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ it('will catch the error using done', done => {
})

it('will catch the error using a promise', () => {
return Vue.nextTick().then(function() {
return Vue.nextTick().then(function () {
expect(true).toBe(false)
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ npm install --save-dev @vue/test-utils karma karma-chrome-launcher karma-mocha k

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

module.exports = function(config) {
module.exports = function (config) {
config.set({
frameworks: ['mocha'],

Expand Down Expand Up @@ -160,7 +160,7 @@ npm install --save-dev babel-plugin-istanbul
```js
// karma.conf.js

module.exports = function(config) {
module.exports = function (config) {
config.set({
// ...

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
"docs": "vuepress dev docs",
"docs:build": "vuepress build docs",
"flow": "flow check",
"lint": "eslint --ext js,vue .",
"lint": "eslint --ext js,vue . --cache",
"lint:docs": "eslint --ext js,vue,md docs --ignore-path .gitignore",
"lint:fix": "yarn lint -- --fix",
"format": "prettier --write \"**/*.{js,json,vue,md}\"",
"format": "prettier --write \"**/*.{js,json,vue,md}\" --cache",
"format:check": "prettier --check \"**/*.{js,json,vue,md}\"",
"release": "yarn build && yarn test:unit && lerna publish --conventional-commits -m \"chore(release): publish %s\"",
"test": "yarn format:check && yarn lint && yarn lint:docs && yarn flow && yarn test:types && yarn test:unit -w 1 && yarn test:unit:browser",
Expand Down Expand Up @@ -91,7 +91,7 @@
"karma-spec-reporter": "^0.0.32",
"karma-webpack": "^4.0.2",
"lint-staged": "^9.5.0",
"prettier": "^1.16.0",
"prettier": "^2.8.1",
"puppeteer": "^5.2.1",
"rollup-plugin-delete": "^2.0.0",
"@rollup/plugin-replace": "^2.3.3",
Expand Down
6 changes: 3 additions & 3 deletions packages/create-instance/create-instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default function createInstance(
const parentComponentOptions = options.parentComponent || {}

const originalParentComponentProvide = parentComponentOptions.provide
parentComponentOptions.provide = function() {
parentComponentOptions.provide = function () {
return {
...getValuesFromCallableOption.call(this, originalParentComponentProvide),
// $FlowIgnore
Expand All @@ -116,7 +116,7 @@ export default function createInstance(
}

const originalParentComponentData = parentComponentOptions.data
parentComponentOptions.data = function() {
parentComponentOptions.data = function () {
return {
...getValuesFromCallableOption.call(this, originalParentComponentData),
vueTestUtils_childProps: { ...options.propsData }
Expand All @@ -126,7 +126,7 @@ export default function createInstance(
parentComponentOptions.$_doNotStubChildren = true
parentComponentOptions.$_isWrapperParent = true
parentComponentOptions._isFunctionalContainer = componentOptions.functional
parentComponentOptions.render = function(h) {
parentComponentOptions.render = function (h) {
return h(
Constructor,
createContext(options, scopedSlots, this.vueTestUtils_childProps),
Expand Down
8 changes: 4 additions & 4 deletions packages/create-instance/create-scoped-slots.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ function isDestructuringSlotScope(slotScope: string): boolean {
return /^{.*}$/.test(slotScope)
}

function getVueTemplateCompilerHelpers(
_Vue: Component
): { [name: string]: Function } {
function getVueTemplateCompilerHelpers(_Vue: Component): {
[name: string]: Function
} {
// $FlowIgnore
const vue = new _Vue()
const helpers = {}
Expand Down Expand Up @@ -111,7 +111,7 @@ export default function createScopedSlots(

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

scopedSlots[scopedSlotName] = function(props) {
scopedSlots[scopedSlotName] = function (props) {
let res
if (isFn) {
res = renderFn.call({ ...helpers }, props)
Expand Down
2 changes: 1 addition & 1 deletion packages/create-instance/log-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function logEvents(

export function addEventLogger(_Vue: Component): void {
_Vue.mixin({
beforeCreate: function() {
beforeCreate: function () {
this.__emitted = Object.create(null)
this.__emittedByOrder = []
logEvents(this, this.__emitted, this.__emittedByOrder)
Expand Down
4 changes: 2 additions & 2 deletions packages/shared/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ function makeMap(str: string, expectsLowerCase?: boolean) {
map[list[i]] = true
}
return expectsLowerCase
? function(val: string) {
? function (val: string) {
return map[val.toLowerCase()]
}
: function(val: string) {
: function (val: string) {
return map[val]
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/test-utils/src/wrapper-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type VueWrapper from './vue-wrapper'
import { throwError } from 'shared/util'

export default class WrapperArray implements BaseWrapper {
+wrappers: Array<Wrapper | VueWrapper>
+wrappers: Array<Wrapper | VueWrapper>;
+length: number
selector: Selector | void

Expand Down
10 changes: 4 additions & 6 deletions packages/test-utils/src/wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ import createDOMEvent from './create-dom-event'
import { throwIfInstancesThrew } from './error'

export default class Wrapper implements BaseWrapper {
+vnode: VNode | null
+vnode: VNode | null;
+vm: Component | void
_emitted: { [name: string]: Array<Array<any>> }
_emittedByOrder: Array<{ name: string, args: Array<any> }>
+element: Element
_emittedByOrder: Array<{ name: string, args: Array<any> }>;
+element: Element;
+options: WrapperOptions
isFunctionalComponent: boolean
rootNode: VNode | Element
Expand Down Expand Up @@ -502,9 +502,7 @@ export default class Wrapper implements BaseWrapper {
? value.map((calledWith, index) => {
const callParams = calledWith.map(param =>
typeof param === 'object'
? JSON.stringify(param)
.replace(/"/g, '')
.replace(/,/g, ', ')
? JSON.stringify(param).replace(/"/g, '').replace(/,/g, ', ')
: param
)

Expand Down
7 changes: 2 additions & 5 deletions test/resources/components/component-with-computed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ export default {
message: 'egassem'
}),
computed: {
reversedMessage: function() {
return this.message
.split('')
.reverse()
.join('')
reversedMessage: function () {
return this.message.split('').reverse().join('')
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions test/resources/components/component-with-transitions.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<template>
<div>
<transition>
<span v-if="!expanded" data-testid="expanded">
Content
</span>
<span v-if="!expanded" data-testid="expanded"> Content </span>
</transition>
</div>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<script>
export default {
data: function() {
data: function () {
return {
data1: null
}
Expand Down
Loading