Skip to content

Commit 9f2d0d7

Browse files
committed
chore: refactor eslint config
1 parent f81f2d4 commit 9f2d0d7

File tree

110 files changed

+611
-1379
lines changed

Some content is hidden

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

110 files changed

+611
-1379
lines changed

.circleci/config.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,10 @@ jobs:
4444
key: v10-dependencies-{{ checksum "yarn.lock" }}
4545

4646
# run tests!
47+
- run: yarn lint
4748
- run: yarn build
48-
- run: cd packages/vue-apollo-option && yarn lint
4949
- run: cd packages/vue-apollo-option && yarn test:types
5050
- run: cd packages/vue-apollo-option && yarn test:unit
51-
- run: cd packages/vue-apollo-components && yarn lint
52-
- run: cd packages/vue-apollo-composable && yarn lint
5351
- run: cd packages/vue-apollo-composable && yarn test:types
5452
- run: cd packages/test-e2e && yarn test:e2e
5553
- run: cd packages/test-e2e-composition && yarn test:e2e

.eslintrc.js

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
browser: true,
5+
},
6+
extends: [
7+
'plugin:vue/recommended',
8+
'@vue/standard',
9+
'@vue/typescript/recommended',
10+
],
11+
parserOptions: {
12+
ecmaVersion: 2020,
13+
},
14+
globals: {
15+
name: 'off',
16+
},
17+
rules: {
18+
'vue/html-closing-bracket-newline': [
19+
'error',
20+
{
21+
singleline: 'never',
22+
multiline: 'always',
23+
},
24+
],
25+
'no-var': ['error'],
26+
'@typescript-eslint/member-delimiter-style': [
27+
'error',
28+
{
29+
multiline: {
30+
delimiter: 'none',
31+
},
32+
singleline: {
33+
delimiter: 'comma',
34+
},
35+
},
36+
],
37+
'@typescript-eslint/no-use-before-define': 'off',
38+
'comma-dangle': ['error', 'always-multiline'],
39+
'vue/no-multiple-template-root': 'off',
40+
indent: 'off',
41+
'@typescript-eslint/indent': ['error', 2],
42+
quotes: ['error', 'single', { allowTemplateLiterals: true }],
43+
'no-use-before-define': 'warn',
44+
'accessor-pairs': 'off',
45+
'no-async-promise-executor': 'off',
46+
'@typescript-eslint/no-empty-function': 'warn',
47+
'no-return-assign': 'off',
48+
'multiline-ternary': 'off',
49+
},
50+
overrides: [
51+
{
52+
files: ['*.vue'],
53+
rules: {
54+
'@typescript-eslint/no-unused-vars': 'off',
55+
},
56+
},
57+
{
58+
files: [
59+
'packages/*/server.js',
60+
'packages/*/apollo.config.js',
61+
'packages/*/apollo-server/**/*',
62+
'packages/*/tests/**/*.js',
63+
'packages/*/build/**/*.js',
64+
'packages/*/lib/**/*.js',
65+
],
66+
rules: {
67+
'@typescript-eslint/no-var-requires': 'off',
68+
},
69+
},
70+
{
71+
files: [
72+
'**/*.test.ts',
73+
'packages/*/types/test/**/*.ts',
74+
],
75+
rules: {
76+
camelcase: 'off',
77+
'no-unused-expressions': 'off',
78+
'array-callback-return': 'warn',
79+
},
80+
},
81+
],
82+
ignorePatterns: [
83+
'node_modules/',
84+
'dist/',
85+
'generated/',
86+
'!.*',
87+
'schema.graphql',
88+
],
89+
}

package.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,25 @@
88
"scripts": {
99
"build": "lerna run build --concurrency 1 --scope \"{vue-apollo,@vue/apollo}*\"",
1010
"test": "lerna run test --concurrency 1",
11-
"lint": "lerna run lint",
11+
"lint": "eslint . --ext js,vue,ts",
1212
"release": "lerna publish"
1313
},
1414
"devDependencies": {
15+
"@typescript-eslint/eslint-plugin": "^4.2.0",
16+
"@typescript-eslint/parser": "^4.2.0",
17+
"@vue/eslint-config-standard": "^6.0.0",
18+
"@vue/eslint-config-typescript": "^7.0.0",
1519
"core-js": "^3.4.1",
1620
"esbuild": "^0.8.44",
1721
"esbuild-node-externals": "^1.0.2",
18-
"lerna": "^3.18.4"
22+
"eslint": "^7.19.0",
23+
"eslint-plugin-import": "^2.22.1",
24+
"eslint-plugin-node": "^11.1.0",
25+
"eslint-plugin-promise": "^4.2.1",
26+
"eslint-plugin-standard": "^5.0.0",
27+
"eslint-plugin-vue": "^7.5.0",
28+
"lerna": "^3.18.4",
29+
"typescript": "^4.1.5"
1930
},
2031
"resolutions": {
2132
"eslint-scope": "^5.0.0",
Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<template>
22
<p class="sponsor-button">
3-
<github-button href="https://github.com/sponsors/Akryum" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @Akryum on GitHub">
3+
<github-button
4+
href="https://github.com/sponsors/Akryum"
5+
data-icon="octicon-heart"
6+
data-size="large"
7+
aria-label="Sponsor @Akryum on GitHub"
8+
>
49
Sponsor on GitHub
510
</github-button>
611
</p>
@@ -11,13 +16,13 @@ import GithubButton from 'vue-github-button'
1116
1217
export default {
1318
components: {
14-
GithubButton
15-
}
19+
GithubButton,
20+
},
1621
}
1722
</script>
1823

1924
<style lang="stylus" scoped>
2025
.sponsor-button
2126
text-align center
2227
margin 24px 0
23-
</style>
28+
</style>

packages/docs/src/.vuepress/config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ module.exports = {
1414
lang: 'zh-CN',
1515
title: 'Vue Apollo',
1616
description: '🚀 在你的 Vue.js 应用中集成 GraphQL!',
17-
}
17+
},
1818
},
1919
plugins: {
2020
'@vuepress/pwa': {
2121
serviceWorker: true,
2222
updatePopup: {
2323
'/': {
24-
message: "New content is available.",
25-
buttonText: "Refresh"
24+
message: 'New content is available.',
25+
buttonText: 'Refresh',
2626
},
2727
},
2828
},

packages/test-e2e-composable-vue3/.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/test-e2e-composable-vue3/.eslintrc.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

packages/test-e2e-composable-vue3/README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,5 @@ yarn build
2020
yarn test:e2e
2121
```
2222

23-
### Lints and fixes files
24-
```
25-
yarn lint
26-
```
27-
2823
### Customize configuration
2924
See [Configuration Reference](https://cli.vuejs.org/config/).

packages/test-e2e-composable-vue3/package.json

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
"scripts": {
66
"serve": "vue-cli-service serve",
77
"build": "vue-cli-service build",
8-
"test": "yarn run lint --no-fix && yarn run test:e2e",
8+
"test": "yarn run test:e2e",
99
"test:e2e": "start-server-and-test api http://localhost:4042/.well-known/apollo/server-health test:e2e:client",
1010
"test:e2e:client": "vue-cli-service test:e2e --mode production --headless",
1111
"test:e2e:dev": "vue-cli-service test:e2e",
12-
"lint": "vue-cli-service lint",
1312
"api": "node server.js"
1413
},
1514
"dependencies": {
@@ -27,25 +26,13 @@
2726
},
2827
"devDependencies": {
2928
"@types/shortid": "^0.0.29",
30-
"@typescript-eslint/eslint-plugin": "^2.33.0",
31-
"@typescript-eslint/parser": "^2.33.0",
3229
"@vue/cli-plugin-babel": "~4.5.0",
3330
"@vue/cli-plugin-e2e-cypress": "~4.5.0",
34-
"@vue/cli-plugin-eslint": "~4.5.0",
3531
"@vue/cli-plugin-typescript": "~4.5.0",
3632
"@vue/cli-service": "~4.5.0",
3733
"@vue/compiler-sfc": "^3.0.0",
38-
"@vue/eslint-config-standard": "^5.1.2",
39-
"@vue/eslint-config-typescript": "^5.0.2",
4034
"axios": "^0.20.0",
41-
"eslint": "^6.7.2",
42-
"eslint-plugin-import": "^2.20.2",
43-
"eslint-plugin-node": "^11.1.0",
44-
"eslint-plugin-promise": "^4.2.1",
45-
"eslint-plugin-standard": "^4.0.0",
46-
"eslint-plugin-vue": "^7.0.0-0",
4735
"start-server-and-test": "^1.10.6",
48-
"tailwindcss": "^1.0.1",
49-
"typescript": "^4.0.3"
36+
"tailwindcss": "^1.0.1"
5037
}
5138
}

packages/test-e2e-composable-vue3/src/components/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="flex h-screen items-stretch bg-gray-100">
33
<ChannelList class="w-1/4 border-r border-gray-200" />
4-
<router-view class="flex-1 overflow-auto"/>
4+
<router-view class="flex-1 overflow-auto" />
55
</div>
66
</template>
77

packages/test-e2e-composable-vue3/src/components/ChannelList.vue

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { useQuery, useResult } from '@vue/apollo-composable'
44
import { defineComponent } from 'vue'
55
66
interface Channel {
7-
id: string;
8-
label: string;
7+
id: string
8+
label: string
99
}
1010
1111
export default defineComponent({
@@ -29,22 +29,28 @@ export default defineComponent({
2929
</script>
3030

3131
<template>
32-
<div v-if="loading" class="p-12 text-gray-500">
32+
<div
33+
v-if="loading"
34+
class="p-12 text-gray-500"
35+
>
3336
Loading channels...
3437
</div>
3538

36-
<div v-else class="flex flex-col bg-white">
39+
<div
40+
v-else
41+
class="flex flex-col bg-white"
42+
>
3743
<router-link
3844
v-for="channel of channels"
3945
:key="channel.id"
46+
v-slot="{ href, navigate, isActive }"
4047
:to="{
4148
name: 'channel',
4249
params: {
4350
id: channel.id,
4451
},
4552
}"
4653
custom
47-
#default="{ href, navigate, isActive }"
4854
>
4955
<a
5056
:href="href"

packages/test-e2e-composable-vue3/src/components/ChannelView.vue

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,22 @@ export default defineComponent({
6060
</script>
6161
6262
<template>
63-
<div v-if="loading">Loading channel...</div>
63+
<div v-if="loading">
64+
Loading channel...
65+
</div>
6466
65-
<div v-else class="flex flex-col">
67+
<div
68+
v-else
69+
class="flex flex-col"
70+
>
6671
<div class="flex-none p-6 border-b border-gray-200 bg-white">
6772
Currently viewing # {{ channel.label }}
6873
</div>
6974
70-
<div ref="messagesEl" class="flex-1 overflow-y-auto">
75+
<div
76+
ref="messagesEl"
77+
class="flex-1 overflow-y-auto"
78+
>
7179
<MessageItem
7280
v-for="message of channel.messages"
7381
:key="message.id"
@@ -77,7 +85,7 @@ export default defineComponent({
7785
</div>
7886
7987
<MessageForm
80-
:channelId="channel.id"
88+
:channel-id="channel.id"
8189
class="flex-none m-2 mt-0"
8290
/>
8391
</div>

packages/test-e2e-composable-vue3/src/components/LazyQuery.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,19 @@ export default defineComponent({
2222

2323
<template>
2424
<div class="m-6">
25-
<button class="bg-green-200 rounded-lg p-4" @click="load()">
25+
<button
26+
class="bg-green-200 rounded-lg p-4"
27+
@click="load()"
28+
>
2629
Load list
2730
</button>
2831

2932
<ul class="my-4">
30-
<li v-for="(item, index) of list" :key="index" class="list-disc ml-6">
33+
<li
34+
v-for="(item, index) of list"
35+
:key="index"
36+
class="list-disc ml-6"
37+
>
3138
{{ item }}
3239
</li>
3340
</ul>
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
module.exports = {
22
plugins: [
3-
'cypress'
3+
'cypress',
44
],
55
env: {
66
mocha: true,
7-
'cypress/globals': true
7+
'cypress/globals': true,
88
},
99
rules: {
10-
strict: 'off'
11-
}
10+
strict: 'off',
11+
},
1212
}

packages/test-e2e-composition/.eslintignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)