Skip to content

Commit

Permalink
chore: refactor eslint config, now at root
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Feb 11, 2021
1 parent 9787fc8 commit 55147c4
Show file tree
Hide file tree
Showing 38 changed files with 200 additions and 845 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ jobs:
key: v4-dependencies-{{ checksum "yarn.lock" }}

# run tests!
- run: yarn lint
- run: cd packages/vue-apollo && yarn build
- run: cd packages/vue-apollo && yarn test:eslint
- run: cd packages/vue-apollo && yarn test:types
- run: cd packages/vue-apollo && yarn test:unit
- run: cd packages/test-e2e && yarn test:e2e
Expand Down
11 changes: 9 additions & 2 deletions packages/vue-apollo/.eslintrc.js → .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,14 @@ module.exports = {
},
},
{
files: ['tests/unit/*.js', 'ssr/*', 'build/*', 'lib/*'],
files: [
'**/tests/unit/*.js',
'**/ssr/*',
'**/build/*',
'**/lib/*',
'apollo.config.js',
'**/apollo-server/**/*',
],
rules: {
'@typescript-eslint/no-var-requires': 'off',
},
Expand All @@ -62,6 +69,6 @@ module.exports = {
'dist/',
'!.*',
'schema.graphql',
'types/test/*.js',
'**/types/test/*.js',
],
}
16 changes: 14 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,24 @@
],
"private": true,
"scripts": {
"release": "lerna publish"
"lint": "eslint --ext .js,.ts,.vue .",
"release": "yarn lint && lerna publish"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.2.0",
"@typescript-eslint/parser": "^4.2.0",
"@vue/eslint-config-standard": "^6.0.0",
"@vue/eslint-config-typescript": "^7.0.0",
"core-js": "^3.4.1",
"eslint": "^7.19.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^5.0.0",
"eslint-plugin-vue": "^7.5.0",
"eslint-scope": "^5.0.0",
"lerna": "^3.18.4"
"lerna": "^3.18.4",
"typescript": "^4.1.3"
},
"resolutions": {
"eslint-scope": "^5.0.0",
Expand Down
13 changes: 9 additions & 4 deletions packages/docs/src/.vuepress/components/sponsor-button.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<template>
<p class="sponsor-button">
<github-button href="https://github.com/sponsors/Akryum" data-icon="octicon-heart" data-size="large" aria-label="Sponsor @Akryum on GitHub">
<github-button
href="https://github.com/sponsors/Akryum"
data-icon="octicon-heart"
data-size="large"
aria-label="Sponsor @Akryum on GitHub"
>
Sponsor on GitHub
</github-button>
</p>
Expand All @@ -11,13 +16,13 @@ import GithubButton from 'vue-github-button'
export default {
components: {
GithubButton
}
GithubButton,
},
}
</script>

<style lang="stylus" scoped>
.sponsor-button
text-align center
margin 24px 0
</style>
</style>
10 changes: 5 additions & 5 deletions packages/docs/src/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ module.exports = {
lang: 'fr-FR',
title: 'Vue Apollo',
description: '🚀 Intégrez GraphQL dans vos apps Vue.js !',
}
},
},
plugins: {
'@vuepress/pwa': {
serviceWorker: true,
updatePopup: {
'/': {
message: "New content is available.",
buttonText: "Refresh"
message: 'New content is available.',
buttonText: 'Refresh',
},
'/fr/': {
message: "Du nouveau contenu est disponible.",
buttonText: "Rafraîchir"
message: 'Du nouveau contenu est disponible.',
buttonText: 'Rafraîchir',
},
},
},
Expand Down
2 changes: 0 additions & 2 deletions packages/test-e2e/.eslintignore

This file was deleted.

31 changes: 0 additions & 31 deletions packages/test-e2e/.eslintrc.js

This file was deleted.

4 changes: 2 additions & 2 deletions packages/test-e2e/apollo-server/connectors/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const messages = [
userId: '__bot',
channelId: 'general',
content: 'Welcome to the chat!',
dateAdded: Date.now()
}
dateAdded: Date.now(),
},
]

function publishChange ({ type, message }, context) {
Expand Down
8 changes: 4 additions & 4 deletions packages/test-e2e/apollo-server/connectors/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const users = [
email: '[email protected]',
password: 'bot',
nickname: 'The Bot',
tokens: []
}
tokens: [],
},
]

exports.register = (input, context) => {
Expand All @@ -24,15 +24,15 @@ exports.register = (input, context) => {
nickname: input.nickname,
tokens: [],
})

resolve(true)
}, 100)
})
}

exports.login = ({ email, password }, context) => {
const user = users.find(
u => u.email === email && u.password === password
u => u.email === email && u.password === password,
)
if (!user) throw new Error('User not found')
const token = {
Expand Down
2 changes: 1 addition & 1 deletion packages/test-e2e/apollo-server/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports = {
messageChanged: {
subscribe: withFilter(
(parent, args, { pubsub }) => pubsub.asyncIterator(triggers.MESSAGE_CHANGED),
(payload, vars) => payload.messageChanged.message.channelId === vars.channelId
(payload, vars) => payload.messageChanged.message.channelId === vars.channelId,
),
},
},
Expand Down
6 changes: 0 additions & 6 deletions packages/test-e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,7 @@
"devDependencies": {
"@vue/cli-plugin-babel": "^4.0.4",
"@vue/cli-plugin-e2e-cypress": "^4.0.4",
"@vue/cli-plugin-eslint": "^4.0.4",
"@vue/cli-service": "^4.0.4",
"@vue/eslint-config-standard": "^4.0.0",
"babel-eslint": "^10.0.3",
"eslint": "^4.19.1",
"eslint-plugin-graphql": "^3.1.0",
"eslint-plugin-vue": "^5.2.3",
"graphql-tag": "^2.5.0",
"start-server-and-test": "^1.10.6",
"stylus": "^0.54.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/test-e2e/src/components/ChannelView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default {
},
async scrollToBottom (force = false) {
let el = this.$refs.body
const el = this.$refs.body
// No body element yet
if (!el) {
Expand Down
2 changes: 0 additions & 2 deletions packages/test-ssr/.eslintignore

This file was deleted.

33 changes: 0 additions & 33 deletions packages/test-ssr/.eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/test-ssr/apollo-server/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { processUpload } from './utils/upload'
export default ({ req, connection }) => {
return {
db,
processUpload
processUpload,

}
}
22 changes: 11 additions & 11 deletions packages/test-ssr/apollo-server/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ export default {
JSON: GraphQLJSON,

Counter: {
countStr: counter => `Current count: ${counter.count}`
countStr: counter => `Current count: ${counter.count}`,
},

Query: {
hello: (root, { name }) => `Hello ${name || 'World'}!`,
messages: (root, args, { db }) => db.get('messages').value(),
uploads: (root, args, { db }) => db.get('uploads').value()
uploads: (root, args, { db }) => db.get('uploads').value(),

},

Expand All @@ -24,7 +24,7 @@ export default {
addMessage: (root, { input }, { pubsub, db }) => {
const message = {
id: shortid.generate(),
text: input.text
text: input.text,
}

db
Expand All @@ -39,13 +39,13 @@ export default {
},

singleUpload: (root, { file }, { processUpload }) => processUpload(file),
multipleUpload: (root, { files }, { processUpload }) => Promise.all(files.map(processUpload))
multipleUpload: (root, { files }, { processUpload }) => Promise.all(files.map(processUpload)),

},

Subscription: {
mySub: {
subscribe: (parent, args, { pubsub }) => pubsub.asyncIterator('hey')
subscribe: (parent, args, { pubsub }) => pubsub.asyncIterator('hey'),
},
counter: {
subscribe: (parent, args, { pubsub }) => {
Expand All @@ -55,16 +55,16 @@ export default {
channel,
{
// eslint-disable-next-line no-plusplus
counter: { count: count++ }
}
counter: { count: count++ },
},
), 2000)
return pubsub.asyncIterator(channel)
}
},
},

messageAdded: {
subscribe: (parent, args, { pubsub }) => pubsub.asyncIterator('messages')
}
subscribe: (parent, args, { pubsub }) => pubsub.asyncIterator('messages'),
},

}
},
}
2 changes: 1 addition & 1 deletion packages/test-ssr/apollo-server/utils/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ db.defaults({
text: 'Message 3',
},
],
uploads: []
uploads: [],
}).write()
2 changes: 1 addition & 1 deletion packages/test-ssr/apollo-server/utils/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const storeUpload = async ({ stream, filename }) => {
stream
.pipe(createWriteStream(path))
.on('finish', () => resolve({ id, path: urlPath }))
.on('error', reject)
.on('error', reject),
)
}

Expand Down
10 changes: 5 additions & 5 deletions packages/test-ssr/apollo.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ const path = require('path')
const { loadEnv } = require('vue-cli-plugin-apollo/utils/load-env')
const env = loadEnv([
path.resolve(__dirname, '.env'),
path.resolve(__dirname, '.env.local')
path.resolve(__dirname, '.env.local'),
])

module.exports = {
client: {
service: env.VUE_APP_APOLLO_ENGINE_SERVICE,
includes: ['src/**/*.{js,jsx,ts,tsx,vue,gql}']
includes: ['src/**/*.{js,jsx,ts,tsx,vue,gql}'],
},
service: {
name: env.VUE_APP_APOLLO_ENGINE_SERVICE,
localSchemaFile: path.resolve(__dirname, './node_modules/.temp/graphql/schema.json')
localSchemaFile: path.resolve(__dirname, './node_modules/.temp/graphql/schema.json'),
},
engine: {
endpoint: process.env.APOLLO_ENGINE_API_ENDPOINT,
apiKey: env.VUE_APP_APOLLO_ENGINE_KEY
}
apiKey: env.VUE_APP_APOLLO_ENGINE_KEY,
},
}
4 changes: 2 additions & 2 deletions packages/test-ssr/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
'@vue/cli-plugin-babel/preset',
],
}
Loading

0 comments on commit 55147c4

Please sign in to comment.