diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..a25d4c75 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +packages/docs/src/.vitepress/cache diff --git a/.eslintrc.js b/.eslintrc.js index 8e74fcb8..a9da7669 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -9,7 +9,7 @@ module.exports = { '@vue/typescript/recommended', ], parserOptions: { - ecmaVersion: 2020, + ecmaVersion: 2022, }, globals: { name: 'off', @@ -46,6 +46,9 @@ module.exports = { '@typescript-eslint/no-empty-function': 'warn', 'no-return-assign': 'off', 'multiline-ternary': 'off', + '@typescript-eslint/no-explicit-any': 'off', + 'no-undef': 'off', + 'vue/multi-word-component-names': 'off', }, overrides: [ { diff --git a/packages/test-e2e-ssr/tests/e2e/specs/test.cy.ts b/packages/test-e2e-ssr/tests/e2e/specs/test.cy.ts index 882c3dab..a469b16d 100644 --- a/packages/test-e2e-ssr/tests/e2e/specs/test.cy.ts +++ b/packages/test-e2e-ssr/tests/e2e/specs/test.cy.ts @@ -4,7 +4,7 @@ describe('Vue 3 + Apollo Composable', () => { }) it('loads channels', () => { - cy.intercept('http://localhost:4042/graphql', (req) => { + cy.intercept('http://localhost:4042/graphql', () => { throw new Error('Should not be called') }) cy.visit('/') @@ -17,7 +17,7 @@ describe('Vue 3 + Apollo Composable', () => { it('load one channel', () => { let shouldCallGraphQL = false - cy.intercept('http://localhost:4042/graphql', (req) => { + cy.intercept('http://localhost:4042/graphql', () => { if (!shouldCallGraphQL) { throw new Error('Should not be called') } diff --git a/packages/test-e2e/apollo-server/connectors/channels.js b/packages/test-e2e/apollo-server/connectors/channels.js index c6f24113..32aa1501 100644 --- a/packages/test-e2e/apollo-server/connectors/channels.js +++ b/packages/test-e2e/apollo-server/connectors/channels.js @@ -4,10 +4,10 @@ const channels = [ { id: 'help', name: 'Ask for or give help' }, ] -exports.getAll = (context) => { +exports.getAll = () => { return channels } -exports.getOne = (id, context) => { +exports.getOne = (id) => { return channels.find(c => c.id === id) } diff --git a/packages/test-e2e/apollo-server/connectors/messages.js b/packages/test-e2e/apollo-server/connectors/messages.js index 573144a0..71b04c04 100644 --- a/packages/test-e2e/apollo-server/connectors/messages.js +++ b/packages/test-e2e/apollo-server/connectors/messages.js @@ -24,7 +24,7 @@ function publishChange ({ type, message }, context) { }) } -exports.getAll = (channelId, context) => { +exports.getAll = (channelId) => { return new Promise((resolve) => { setTimeout(() => { resolve(messages.filter(m => m.channelId === channelId)) @@ -32,7 +32,7 @@ exports.getAll = (channelId, context) => { }) } -exports.getOne = (id, context) => { +exports.getOne = (id) => { return messages.find(m => m.id === id) } @@ -70,7 +70,7 @@ exports.update = ({ id, content }, context) => { return message } -exports.remove = (id, context) => { +exports.remove = (id) => { const index = messages.findIndex(m => m.id === id) if (index === -1) throw new Error('Message not found') const message = messages[index] diff --git a/packages/test-e2e/apollo-server/connectors/users.js b/packages/test-e2e/apollo-server/connectors/users.js index c1186a9b..f5d9dafb 100644 --- a/packages/test-e2e/apollo-server/connectors/users.js +++ b/packages/test-e2e/apollo-server/connectors/users.js @@ -14,7 +14,7 @@ function createDefaultUsers () { let users = createDefaultUsers() -exports.register = (input, context) => { +exports.register = (input) => { if (users.find(u => u.email === input.email)) { throw new Error('Email already used') } @@ -34,7 +34,7 @@ exports.register = (input, context) => { }) } -exports.login = ({ email, password }, context) => { +exports.login = ({ email, password }) => { const user = users.find( u => u.email === email && u.password === password, ) @@ -62,7 +62,7 @@ exports.logout = (context) => { return true } -exports.getOne = (id, context) => { +exports.getOne = (id) => { return users.find(u => u.id === id) } diff --git a/packages/vue-apollo-components/src/index.js b/packages/vue-apollo-components/src/index.js index 022174b8..7a7bd9a8 100644 --- a/packages/vue-apollo-components/src/index.js +++ b/packages/vue-apollo-components/src/index.js @@ -4,7 +4,7 @@ import CApolloMutation from './ApolloMutation' const plugin = {} -export function install (app, options) { +export function install (app) { app.component('ApolloQuery', CApolloQuery) app.component('ApolloSubscribeToMore', CApolloSubscribeToMore) app.component('ApolloMutation', CApolloMutation) diff --git a/packages/vue-apollo-composable/src/useSubscription.ts b/packages/vue-apollo-composable/src/useSubscription.ts index c05a5e7d..bc396456 100644 --- a/packages/vue-apollo-composable/src/useSubscription.ts +++ b/packages/vue-apollo-composable/src/useSubscription.ts @@ -257,7 +257,7 @@ export function useSubscription < // Applying variables let currentVariables: TVariables | undefined let currentVariablesSerialized: string - watch(variablesRef, (value, oldValue) => { + watch(variablesRef, (value) => { const serialized = JSON.stringify(value) if (serialized !== currentVariablesSerialized) { currentVariables = value diff --git a/packages/vue-apollo-option/src/apollo-provider.js b/packages/vue-apollo-option/src/apollo-provider.js index c8a5bda1..a4a5b961 100644 --- a/packages/vue-apollo-option/src/apollo-provider.js +++ b/packages/vue-apollo-option/src/apollo-provider.js @@ -22,7 +22,7 @@ export class ApolloProvider { install (app) { // Options merging - app.config.optionMergeStrategies.apollo = function (toVal, fromVal, vm) { + app.config.optionMergeStrategies.apollo = function (toVal, fromVal) { if (!toVal) return fromVal if (!fromVal) return toVal diff --git a/packages/vue-apollo-option/src/smart-apollo.js b/packages/vue-apollo-option/src/smart-apollo.js index 54cd5439..5b8f11ab 100644 --- a/packages/vue-apollo-option/src/smart-apollo.js +++ b/packages/vue-apollo-option/src/smart-apollo.js @@ -154,7 +154,7 @@ export default class SmartApollo { return apolloOptions } - executeApollo (variables) { + executeApollo () { this.starting = false } diff --git a/packages/vue-apollo-option/types/vue-apollo.d.ts b/packages/vue-apollo-option/types/vue-apollo.d.ts index f63dd301..882b18e4 100644 --- a/packages/vue-apollo-option/types/vue-apollo.d.ts +++ b/packages/vue-apollo-option/types/vue-apollo.d.ts @@ -16,6 +16,7 @@ import { VueApolloSubscriptionDefinition, } from './options' +// eslint-disable-next-line @typescript-eslint/no-unused-vars interface SmartApollo { skip: boolean refresh(): void @@ -65,5 +66,6 @@ export interface DollarApollo extends ApolloClientMethods { getClient(): ApolloClient addSmartQuery(key: string, options: VueApolloQueryDefinition): SmartQuery + // eslint-disable-next-line @typescript-eslint/no-unused-vars addSmartSubscription(key: string, options: VueApolloSubscriptionDefinition): SmartSubscription } diff --git a/packages/vue-apollo-option/types/vue.d.ts b/packages/vue-apollo-option/types/vue.d.ts index 60eb3fc6..ed7c060b 100644 --- a/packages/vue-apollo-option/types/vue.d.ts +++ b/packages/vue-apollo-option/types/vue.d.ts @@ -12,6 +12,7 @@ declare module '@vue/runtime-core' { Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, E extends EmitsOptions, + // eslint-disable-next-line @typescript-eslint/no-unused-vars EE extends string = string, // eslint-disable-next-line @typescript-eslint/ban-types Defaults = {}