Skip to content

Commit

Permalink
fix(lint): autofixed files
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Jun 8, 2020
1 parent 3ded722 commit aab0110
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 51 deletions.
30 changes: 15 additions & 15 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ module.exports = {
parser: 'vue-eslint-parser',
parserOptions: {
// Use babel-eslint for JavaScript
'parser': 'babel-eslint',
'ecmaVersion': 2017,
parser: 'babel-eslint',
ecmaVersion: 2017,
// With import/export syntax
'sourceType': 'module'
sourceType: 'module',
},
// Environment global objects
env: {
Expand All @@ -27,22 +27,22 @@ module.exports = {

// Vue

// Error
'vue/html-closing-bracket-newline': ['error', {
'singleline': 'never',
'multiline': 'always',
// Error
'vue/html-closing-bracket-newline': ['error', {
singleline: 'never',
multiline: 'always',
}],
'vue/html-closing-bracket-spacing': ['error', {
'startTag': 'never',
'endTag': 'never',
'selfClosingTag': 'never',
startTag: 'never',
endTag: 'never',
selfClosingTag: 'never',
}],
'vue/max-attributes-per-line': ['error', {
"singleline": 2,
"multiline": {
"max": 1,
"allowFirstLine": false
}
singleline: 2,
multiline: {
max: 1,
allowFirstLine: false,
},
}],
// Warn
'vue/require-default-prop': 'warn',
Expand Down
14 changes: 7 additions & 7 deletions generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = (api, options, rootOptions) => {
'graphql-type-json': '^0.2.1',
},
scripts: {
'apollo': 'vue-cli-service apollo:dev --generate-schema',
apollo: 'vue-cli-service apollo:dev --generate-schema',
'apollo:start': 'vue-cli-service apollo:start',
'apollo:schema:generate': 'vue-cli-service apollo:schema:generate',
// 'apollo:client:check': 'vue-cli-service apollo:client:check',
Expand Down Expand Up @@ -57,9 +57,9 @@ module.exports = (api, options, rootOptions) => {
if (options.addExamples) {
api.extendPackage({
dependencies: {
'lowdb': '^1.0.0',
'mkdirp': '^0.5.1',
'shortid': '^2.2.8',
lowdb: '^1.0.0',
mkdirp: '^0.5.1',
shortid: '^2.2.8',
},
})

Expand Down Expand Up @@ -102,10 +102,10 @@ module.exports = (api, options, rootOptions) => {
}

const file = tsExists ? 'src/main.ts' : 'src/main.js'
api.injectImports(file, `import { createProvider } from './vue-apollo'`)
api.injectRootOptions(file, `apolloProvider: createProvider(),`)
api.injectImports(file, 'import { createProvider } from \'./vue-apollo\'')
api.injectRootOptions(file, 'apolloProvider: createProvider(),')
} catch (e) {
api.exitLog(`Your main file couldn't be modified. You will have to edit the code yourself: https://github.com/Akryum/vue-cli-plugin-apollo#manual-code-changes`, 'warn')
api.exitLog('Your main file couldn\'t be modified. You will have to edit the code yourself: https://github.com/Akryum/vue-cli-plugin-apollo#manual-code-changes', 'warn')
}

api.onCreateComplete(async () => {
Expand Down
6 changes: 3 additions & 3 deletions graphql-client/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,14 @@ export function createApolloClient ({
operation === 'subscription'
},
wsLink,
link
link,
)
}
}
}

if (clientState) {
console.warn(`clientState is deprecated, see https://vue-cli-plugin-apollo.netlify.com/guide/client-state.html`)
console.warn('clientState is deprecated, see https://vue-cli-plugin-apollo.netlify.com/guide/client-state.html')
stateLink = withClientState({
cache,
...clientState,
Expand Down Expand Up @@ -206,7 +206,7 @@ export function restartWebsockets (wsClient) {
wsClient.sendMessage(
id,
MessageTypes.GQL_START,
operations[id].options
operations[id].options,
)
})
}
Expand Down
10 changes: 5 additions & 5 deletions graphql-server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = (options, cb = null) => {
} catch (e) {
if (process.env.NODE_ENV !== 'production' && !options.quiet) {
console.log(chalk.yellow('Using default PubSub implementation for subscriptions.'))
console.log(chalk.grey(`You should provide a different implementation in production (for example with Redis) by exporting it in 'apollo-server/pubsub.js'.`))
console.log(chalk.grey('You should provide a different implementation in production (for example with Redis) by exporting it in \'apollo-server/pubsub.js\'.'))
}
}
let dataSources
Expand Down Expand Up @@ -112,9 +112,9 @@ module.exports = (options, cb = null) => {

if (!options.quiet) {
if (process.env.NODE_ENV === 'production') {
console.warn(`Automatic mocking is enabled, consider disabling it with the 'enableMocks' option.`)
console.warn('Automatic mocking is enabled, consider disabling it with the \'enableMocks\' option.')
} else {
console.log(`✔️ Automatic mocking is enabled`)
console.log('✔️ Automatic mocking is enabled')
}
}
}
Expand All @@ -127,7 +127,7 @@ module.exports = (options, cb = null) => {
schemaTag: options.schemaTag,
...options.engineOptions || {},
}
console.log(`✔️ Apollo Engine is enabled`)
console.log('✔️ Apollo Engine is enabled')
} else if (!options.quiet) {
console.log(chalk.yellow('Apollo Engine key not found.') + `To enable Engine, set the ${chalk.cyan('VUE_APP_APOLLO_ENGINE_KEY')} env variable.`)
console.log('Create a key at https://engine.apollographql.com/')
Expand Down Expand Up @@ -201,7 +201,7 @@ function processSchema (typeDefs) {
function removeFromSchema (document, kind, name) {
const definitions = document.definitions
const index = definitions.findIndex(
def => def.kind === kind && def.name.kind === 'Name' && def.name.value === name
def => def.kind === kind && def.name.kind === 'Name' && def.name.value === name,
)
if (index !== -1) {
definitions.splice(index, 1)
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@ module.exports = (api, options) => {
})
},
onCrash: () => {
console.log(chalk.bold(chalk.red(`💥 GraphQL API crashed!`)))
console.log(chalk.bold(chalk.red('💥 GraphQL API crashed!')))
sendIpcMessage({
urls: null,
error: true,
})
},
onRestart: () => {
console.log(chalk.bold(chalk.green(`⏳ GraphQL API is restarting...`)))
console.log(chalk.bold(chalk.green('⏳ GraphQL API is restarting...')))
sendIpcMessage({
error: false,
})
Expand Down Expand Up @@ -237,7 +237,7 @@ module.exports = (api, options) => {
options: SCHEMA_OPTIONS,
details: 'For more info, see https://github.com/Akryum/vue-cli-plugin-apollo',
}, async args => {
throw new Error(`Not implemented yet`)
throw new Error('Not implemented yet')

/* eslint-disable no-unreachable */

Expand Down
2 changes: 1 addition & 1 deletion prompts.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = [
type: 'input',
name: 'apolloEngineKey',
message: 'API Key:',
description: `It should look like this: 'service:name-xxxx:xxxxxxxxxxxxxxxxxxxxxx'`,
description: 'It should look like this: \'service:name-xxxx:xxxxxxxxxxxxxxxxxxxxxx\'',
group: 'GraphQL Server',
validate: input => !!input,
when: answers => answers.addApolloEngine,
Expand Down
6 changes: 3 additions & 3 deletions ui/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = api => {
})

function onGraphqlServerMessage ({ data }) {
let message = data['org.akryum.vue-apollo']
const message = data['org.akryum.vue-apollo']
if (message) {
ifDef(message.urls, value => setSharedData('urls', value))
ifDef(message.error, value => setSharedData('error', value))
Expand Down Expand Up @@ -286,7 +286,7 @@ module.exports = api => {
id: OPEN_ENGINE,
type: 'action',
label: 'Open Apollo Engine',
message: `Apollo Engine is a cloud service that provides deep insights into your GraphQL layer, with performance and error analytics.`,
message: 'Apollo Engine is a cloud service that provides deep insights into your GraphQL layer, with performance and error analytics.',
image: '/_plugin/vue-cli-plugin-apollo/apollo-engine.png',
link: 'https://www.apollographql.com/engine',
actionLink: `${ENGINE_FRONTEND}/service/${env.VUE_APP_APOLLO_ENGINE_SERVICE}`,
Expand All @@ -304,7 +304,7 @@ module.exports = api => {
id: PUBLISH_SCHEMA_TIP,
type: 'action',
label: 'Publish your schema',
message: `You can publish your schema to Apollo Engine with the 'apollo:schema:publish' task.`,
message: 'You can publish your schema to Apollo Engine with the \'apollo:schema:publish\' task.',
image: '/_plugin/vue-cli-plugin-apollo/publish-task.png',
handler () {
api.requestRoute({
Expand Down
2 changes: 1 addition & 1 deletion ui/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = api => {
id: 'engine-key-metrics',
title: 'Engine Key Metrics',
description: 'Get Engine analytics at a glance',
longDescription: `Displays key metrics of the Apollo Engine metrics. You can choose between different types of metrics.`,
longDescription: 'Displays key metrics of the Apollo Engine metrics. You can choose between different types of metrics.',
link: 'https://www.apollographql.com/engine',
component: 'org.akryum.vue-apollo.components.widgets.engine-key-metrics',
minWidth: 2,
Expand Down
2 changes: 1 addition & 1 deletion utils/check-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = async ({ endpoint, key, tag, engineEndpoint }) => {
const execa = require('execa')
const { logWithSpinner, stopSpinner, done } = require('@vue/cli-shared-utils')

logWithSpinner('📡', `Comparing schema from Engine...`)
logWithSpinner('📡', 'Comparing schema from Engine...')
await execa('apollo', [
'client:check',
`--endpoint=${endpoint}`,
Expand Down
8 changes: 4 additions & 4 deletions utils/engine-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { print } = require('graphql')

const ENGINE_ENDPOINT = process.env.APOLLO_ENGINE_API_ENDPOINT || 'https://engine-graphql.apollographql.com/api/graphql/'

let engineLink = createHttpLink({
const engineLink = createHttpLink({
uri: ENGINE_ENDPOINT,
fetch,
})
Expand All @@ -21,13 +21,13 @@ exports.execute = async ({ query, variables, key }) => {
uri: ENGINE_ENDPOINT,
},
},
})
}),
)
if (process.env.VUE_APP_CLI_UI_DEBUG) {
console.log(`${ENGINE_ENDPOINT}\n`, print(query), `\nKey: ${key}`, `\nVariables:\n`, variables, `\nResponse:\n`, response)
console.log(`${ENGINE_ENDPOINT}\n`, print(query), `\nKey: ${key}`, '\nVariables:\n', variables, '\nResponse:\n', response)
}
if (response.errors) {
const error = new Error(`Errors were returned from API`)
const error = new Error('Errors were returned from API')
error.response = response
console.log(response.errors)
throw error
Expand Down
8 changes: 4 additions & 4 deletions utils/generate-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,22 @@ module.exports = async (options) => {
})

// JSON schema
logWithSpinner(`📄`, 'Generating JSON file...')
logWithSpinner('📄', 'Generating JSON file...')
await fs.ensureDir(path.dirname(options.jsonOutput))
const result = await graphql(schema, introspectionQuery)
fs.writeFileSync(
options.jsonOutput,
JSON.stringify(result, null, 2)
JSON.stringify(result, null, 2),
)
stopSpinner()
done(`Generated ${options.jsonOutput}`)

// GraphQL schema
logWithSpinner(`📄`, 'Generating GraphQL file...')
logWithSpinner('📄', 'Generating GraphQL file...')
await fs.ensureDir(path.dirname(options.graphqlOutput))
fs.writeFileSync(
options.graphqlOutput,
printSchema(schema)
printSchema(schema),
)
stopSpinner()
done(`Generated ${options.graphqlOutput}`)
Expand Down
6 changes: 3 additions & 3 deletions utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function sendIpcMessage (message) {
}

function getFlatArgs (args, ignore) {
let flatArgs = []
const flatArgs = []
for (const key in args) {
if (ignore.includes(key)) continue
const value = args[key]
Expand Down Expand Up @@ -117,7 +117,7 @@ function runWatch (api, options, {

nodemon.on('crash', () => {
onCrash && onCrash()
console.log(chalk.red(` Waiting for changes...`))
console.log(chalk.red(' Waiting for changes...'))
})

nodemon.on('stdout', (...args) => {
Expand Down Expand Up @@ -158,7 +158,7 @@ function getServerOptions (api, options, args) {
// Plugin options
const { apolloOptions, baseFolder } = getBasicServerOptions(api, options, args)

let engineOptions = Object.assign({}, apolloOptions.engineOptions)
const engineOptions = Object.assign({}, apolloOptions.engineOptions)
if (!engineOptions.endpointUrl && process.env.APOLLO_ENGINE_TRACING_ENDPOINT) {
engineOptions.endpointUrl = process.env.APOLLO_ENGINE_TRACING_ENDPOINT
}
Expand Down
2 changes: 1 addition & 1 deletion utils/publish-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = async ({ endpoint, key, tag, engineEndpoint }) => {
const execa = require('execa')
const { logWithSpinner, stopSpinner, done } = require('@vue/cli-shared-utils')

logWithSpinner('⬆️', `Publishing schema to Engine...`)
logWithSpinner('⬆️', 'Publishing schema to Engine...')
await execa('apollo', [
'schema:publish',
`--endpoint=${endpoint}`,
Expand Down

0 comments on commit aab0110

Please sign in to comment.