Skip to content

Commit ae689d9

Browse files
committed
style: enabling more rules from standard config
1 parent 3fa79eb commit ae689d9

File tree

99 files changed

+788
-739
lines changed

Some content is hidden

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

99 files changed

+788
-739
lines changed

.eslintrc.js

-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ module.exports = {
99
indent: ['error', 2, {
1010
MemberExpression: 'off'
1111
}],
12-
'object-curly-newline': 'off',
13-
quotes: [2, 'single', { avoidEscape: true, allowTemplateLiterals: true }],
14-
'quote-props': 'off',
1512
'no-shadow': ['error'],
1613
'node/no-extraneous-require': ['error', {
1714
allowModules: [

packages/@vue/babel-preset-app/__tests__/babel-preset.spec.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,12 @@ test('object spread', () => {
102102
const a = { ...b }
103103
`.trim(), defaultOptions)
104104
// expect(code).toMatch(`import _objectSpread from`)
105-
expect(code).toMatch(`var a = _objectSpread({}, b)`)
105+
expect(code).toMatch('var a = _objectSpread({}, b)')
106106
})
107107

108108
test('dynamic import', () => {
109109
expect(() => {
110-
babel.transformSync(`const Foo = () => import('./Foo.vue')`, defaultOptions)
110+
babel.transformSync('const Foo = () => import(\'./Foo.vue\')', defaultOptions)
111111
}).not.toThrow()
112112
})
113113

@@ -120,7 +120,7 @@ test('async/await', () => {
120120
`.trim(), defaultOptions)
121121
expect(code).toMatch(getAbsolutePolyfill('es.promise'))
122122
// should use regenerator runtime
123-
expect(code).toMatch(`regenerator-runtime/runtime`)
123+
expect(code).toMatch('regenerator-runtime/runtime')
124124
})
125125

126126
test('jsx', () => {
@@ -131,8 +131,8 @@ test('jsx', () => {
131131
}
132132
}
133133
`.trim(), defaultOptions)
134-
expect(code).toMatch(`var h = arguments[0]`)
135-
expect(code).toMatch(`return h("div", ["bar"])`)
134+
expect(code).toMatch('var h = arguments[0]')
135+
expect(code).toMatch('return h("div", ["bar"])')
136136
})
137137

138138
test('jsx options', () => {
@@ -151,8 +151,8 @@ test('jsx options', () => {
151151
}]],
152152
filename: 'test-entry-file.js'
153153
})
154-
expect(code).not.toMatch(`var h = arguments[0]`)
155-
expect(code).toMatch(`return h("div", ["bar"])`)
154+
expect(code).not.toMatch('var h = arguments[0]')
155+
expect(code).toMatch('return h("div", ["bar"])')
156156
})
157157

158158
test('disable absoluteRuntime', () => {

packages/@vue/cli-plugin-babel/__tests__/babelRuntime.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ test('should not transpile babel helpers multiple times', async () => {
4545
await serve(
4646
() => project.run('vue-cli-service serve'),
4747
async ({ helpers }) => {
48-
const msg = `Welcome to Your Vue.js App`
48+
const msg = 'Welcome to Your Vue.js App'
4949
expect(await helpers.getText('h1')).toMatch(msg)
5050
}
5151
)

packages/@vue/cli-plugin-babel/__tests__/transpileDependencies.spec.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@ beforeAll(async () => {
1818

1919
await project.write(
2020
'node_modules/external-dep/package.json',
21-
`{ "name": "external-dep", "version": "1.0.0", "main": "index.js" }`
21+
'{ "name": "external-dep", "version": "1.0.0", "main": "index.js" }'
2222
)
2323

2424
await project.write(
2525
'node_modules/external-dep/index.js',
26-
`const test = () => "__TEST__";\nexport default test`
26+
'const test = () => "__TEST__";\nexport default test'
2727
)
2828

2929
await project.write(
3030
'node_modules/@scope/external-dep/package.json',
31-
`{ "name": "@scope/external-dep", "version": "1.0.0", "main": "index.js" }`
31+
'{ "name": "@scope/external-dep", "version": "1.0.0", "main": "index.js" }'
3232
)
3333

3434
await project.write(
3535
'node_modules/@scope/external-dep/index.js',
36-
`const test = () => "__SCOPE_TEST__";\nexport default test`
36+
'const test = () => "__SCOPE_TEST__";\nexport default test'
3737
)
3838

3939
let $packageJson = await project.read('package.json')
@@ -76,7 +76,7 @@ test('dep from node_modules should not been transpiled', async () => {
7676
test('dep from node_modules should been transpiled', async () => {
7777
await project.write(
7878
'vue.config.js',
79-
`module.exports = { transpileDependencies: ['external-dep', '@scope/external-dep'] }`
79+
'module.exports = { transpileDependencies: [\'external-dep\', \'@scope/external-dep\'] }'
8080
)
8181
await project.run('vue-cli-service build')
8282
expect(await readVendorFile()).toMatch('return "__TEST__"')
@@ -88,7 +88,7 @@ test('dep from node_modules should been transpiled', async () => {
8888
test('only transpile package with same name specified in transpileDependencies', async () => {
8989
await project.write(
9090
'vue.config.js',
91-
`module.exports = { transpileDependencies: ['babel-transpile-deps'] }`
91+
'module.exports = { transpileDependencies: [\'babel-transpile-deps\'] }'
9292
)
9393
try {
9494
await project.run('vue-cli-service build')

packages/@vue/cli-plugin-e2e-cypress/__tests__/cypressPlugin.spec.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ test('should work', async () => {
1919
await project.write('cypress.json', JSON.stringify(config))
2020

2121
if (!process.env.CI) {
22-
await project.run(`vue-cli-service test:e2e`)
22+
await project.run('vue-cli-service test:e2e')
2323
} else if (!process.env.APPVEYOR) {
24-
await project.run(`vue-cli-service test:e2e --headless`)
24+
await project.run('vue-cli-service test:e2e --headless')
2525
}
2626
})
2727

2828
test('should work with TS', async () => {
2929
const project = await create('e2e-cypress-ts', {
3030
plugins: {
3131
'@vue/cli-plugin-typescript': {
32-
'classComponent': true,
33-
'lintOn': ['save']
32+
classComponent: true,
33+
lintOn: ['save']
3434
},
3535
'@vue/cli-plugin-e2e-cypress': {}
3636
}
@@ -41,8 +41,8 @@ test('should work with TS', async () => {
4141
await project.write('cypress.json', JSON.stringify(config))
4242

4343
if (!process.env.CI) {
44-
await project.run(`vue-cli-service test:e2e`)
44+
await project.run('vue-cli-service test:e2e')
4545
} else if (!process.env.APPVEYOR) {
46-
await project.run(`vue-cli-service test:e2e --headless`)
46+
await project.run('vue-cli-service test:e2e --headless')
4747
}
4848
})

packages/@vue/cli-plugin-e2e-cypress/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ module.exports = (api, options) => {
1111
'-s, --spec': '(headless only) runs a specific spec file. defaults to "all"'
1212
},
1313
details:
14-
`All Cypress CLI options are also supported:\n` +
15-
chalk.yellow(`https://docs.cypress.io/guides/guides/command-line.html#cypress-run`)
14+
'All Cypress CLI options are also supported:\n' +
15+
chalk.yellow('https://docs.cypress.io/guides/guides/command-line.html#cypress-run')
1616
}, async (args, rawArgs) => {
1717
removeArg(rawArgs, 'mode')
1818
removeArg(rawArgs, 'url')
1919
removeArg(rawArgs, 'config')
2020

21-
info(`Starting e2e tests...`)
21+
info('Starting e2e tests...')
2222

2323
const { url, server } = args.url
2424
? { url: args.url }

packages/@vue/cli-plugin-e2e-nightwatch/__tests__/nightwatchPlugin.spec.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('nightwatch e2e plugin', () => {
3232
})
3333

3434
test('should run all tests successfully', async () => {
35-
await project.run(`vue-cli-service test:e2e --headless`)
35+
await project.run('vue-cli-service test:e2e --headless')
3636
let results = await project.read('test_results.json')
3737
results = JSON.parse(results)
3838
expect(Object.keys(results.modules)).toEqual([
@@ -44,15 +44,15 @@ describe('nightwatch e2e plugin', () => {
4444
test('should accept the --url cli option', async () => {
4545
let server
4646
try {
47-
await project.run(`vue-cli-service build`)
47+
await project.run('vue-cli-service build')
4848
server = createServer({ root: path.join(project.dir, 'dist') })
4949
await new Promise((resolve, reject) => {
5050
server.listen(8080, err => {
5151
if (err) return reject(err)
5252
resolve()
5353
})
5454
})
55-
await project.run(`vue-cli-service test:e2e --headless --url http://127.0.0.1:8080/`)
55+
await project.run('vue-cli-service test:e2e --headless --url http://127.0.0.1:8080/')
5656

5757
let results = await project.read('test_results.json')
5858
results = JSON.parse(results)
@@ -66,7 +66,7 @@ describe('nightwatch e2e plugin', () => {
6666
})
6767

6868
test('should run single test with custom nightwatch.json', async () => {
69-
await project.run(`vue-cli-service test:e2e --headless -t tests/e2e/specs/test.js`)
69+
await project.run('vue-cli-service test:e2e --headless -t tests/e2e/specs/test.js')
7070
let results = await project.read('test_results.json')
7171
results = JSON.parse(results)
7272
expect(Object.keys(results.modules)).toEqual([
@@ -75,7 +75,7 @@ describe('nightwatch e2e plugin', () => {
7575
})
7676

7777
test('should run single test with custom nightwatch.json and selenium server', async () => {
78-
await project.run(`vue-cli-service test:e2e --headless --use-selenium -t tests/e2e/specs/test.js`)
78+
await project.run('vue-cli-service test:e2e --headless --use-selenium -t tests/e2e/specs/test.js')
7979
let results = await project.read('test_results.json')
8080
results = JSON.parse(results)
8181

@@ -91,7 +91,7 @@ describe('nightwatch e2e plugin', () => {
9191
})
9292

9393
test('should run tests in parallel', async () => {
94-
await project.run(`vue-cli-service test:e2e --headless --parallel`)
94+
await project.run('vue-cli-service test:e2e --headless --parallel')
9595
let results = await project.read('test_results.json')
9696
results = JSON.parse(results)
9797

@@ -118,7 +118,7 @@ describe('nightwatch e2e plugin', () => {
118118

119119
await Promise.all([copyConfig, copyGlobals])
120120

121-
await project.run(`vue-cli-service test:e2e --headless --env firefox -t tests/e2e/specs/test.js`)
121+
await project.run('vue-cli-service test:e2e --headless --env firefox -t tests/e2e/specs/test.js')
122122
let results = await project.read('test_results_gecko.json')
123123
results = JSON.parse(results)
124124

packages/@vue/cli-plugin-e2e-nightwatch/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ module.exports = (api, options) => {
1616
'-f, --filter': 'glob to filter tests by filename'
1717
},
1818
details:
19-
`All Nightwatch CLI options are also supported.\n` +
20-
chalk.yellow(`https://nightwatchjs.org/guide/running-tests/#command-line-options`)
19+
'All Nightwatch CLI options are also supported.\n' +
20+
chalk.yellow('https://nightwatchjs.org/guide/running-tests/#command-line-options')
2121
}, (args, rawArgs) => {
2222
if (args.env && args.env.includes('firefox')) {
2323
try {
@@ -36,7 +36,7 @@ module.exports = (api, options) => {
3636

3737
if (userMajor !== driverMajor) {
3838
warn(`Local ${chalk.cyan.bold('Chrome')} version is ${chalk.cyan.bold(userMajor)}, but the installed ${chalk.cyan.bold('chromedriver')} is for version ${chalk.cyan.bold(driverMajor)}.`)
39-
warn(`There may be incompatibilities between them.`)
39+
warn('There may be incompatibilities between them.')
4040
warn(`Please update your ${chalk.cyan.bold('chromedriver')} dependency to match the ${chalk.cyan.bold('Chrome')} version.`)
4141
}
4242
}

packages/@vue/cli-plugin-e2e-nightwatch/prompts.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ const { installedBrowsers } = require('@vue/cli-shared-utils')
33
module.exports = [
44
{
55
name: 'webdrivers',
6-
type: `checkbox`,
7-
message: `Pick browsers to run end-to-end test on`,
6+
type: 'checkbox',
7+
message: 'Pick browsers to run end-to-end test on',
88
choices: [
99
{
10-
name: `Chrome`,
10+
name: 'Chrome',
1111
value: 'chrome',
1212
checked: true
1313
},

packages/@vue/cli-plugin-e2e-webdriverio/__tests__/wdioPlugin.spec.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ test('should work', async () => {
1717
})
1818

1919
if (!process.env.CI) {
20-
await project.run(`vue-cli-service test:e2e`)
20+
await project.run('vue-cli-service test:e2e')
2121
} else if (!process.env.APPVEYOR) {
22-
await project.run(`vue-cli-service test:e2e --headless`)
22+
await project.run('vue-cli-service test:e2e --headless')
2323
}
2424
})
2525

2626
test('should work with TS', async () => {
2727
const project = await create('e2e-webdriverio-ts', {
2828
plugins: {
2929
'@vue/cli-plugin-typescript': {
30-
'classComponent': true,
31-
'lintOn': ['save']
30+
classComponent: true,
31+
lintOn: ['save']
3232
},
3333
'@vue/cli-plugin-e2e-webdriverio': {
3434
webdrivers: ['chrome']
@@ -37,8 +37,8 @@ test('should work with TS', async () => {
3737
})
3838

3939
if (!process.env.CI) {
40-
await project.run(`vue-cli-service test:e2e`)
40+
await project.run('vue-cli-service test:e2e')
4141
} else if (!process.env.APPVEYOR) {
42-
await project.run(`vue-cli-service test:e2e --headless`)
42+
await project.run('vue-cli-service test:e2e --headless')
4343
}
4444
})

packages/@vue/cli-plugin-e2e-webdriverio/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ module.exports = (api, options) => {
2020
...CLI_OPTIONS
2121
},
2222
details:
23-
`All WebdriverIO CLI options are also supported.\n` +
24-
chalk.yellow(`https://webdriver.io/docs/clioptions.html`)
23+
'All WebdriverIO CLI options are also supported.\n' +
24+
chalk.yellow('https://webdriver.io/docs/clioptions.html')
2525
}, (args, rawArgs) => {
2626
return Promise.all([
2727
startDevServer(args, api)
2828
]).then((results) => {
2929
const { server, url } = results[0]
30-
info(`Running end-to-end tests...`)
30+
info('Running end-to-end tests...')
3131

3232
// expose dev server url to tests
3333
if (!args.baseUrl) {

packages/@vue/cli-plugin-e2e-webdriverio/prompts.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ const { installedBrowsers } = require('@vue/cli-shared-utils')
33
module.exports = [
44
{
55
name: 'webdrivers',
6-
type: `checkbox`,
7-
message: `Pick browsers to run end-to-end test on`,
6+
type: 'checkbox',
7+
message: 'Pick browsers to run end-to-end test on',
88
choices: [
99
{
10-
name: `Chrome`,
10+
name: 'Chrome',
1111
value: 'chrome',
1212
checked: true
1313
},

packages/@vue/cli-plugin-eslint/__tests__/eslintGenerator.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ test('append to existing .editorconfig', async () => {
201201
await write('.editorconfig', 'root = true\n')
202202

203203
const invoke = require('@vue/cli/lib/invoke')
204-
await invoke(`eslint`, { config: 'airbnb' }, dir)
204+
await invoke('eslint', { config: 'airbnb' }, dir)
205205

206206
const editorconfig = await read('.editorconfig')
207207
expect(editorconfig).toMatch('root = true')

packages/@vue/cli-plugin-eslint/__tests__/eslintMigrator.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ test('upgrade: replace babel-eslint with @babel/eslint-parser in eslintrc.js', a
146146

147147
const eslintrc = await project.read('.eslintrc.js')
148148
expect(eslintrc).toMatch('babel-eslint')
149-
const eslintrcMerge = eslintrc.replace(`parser: 'babel-eslint'`, `testMerge: 'testMerge', parser: 'babel-eslint'`)
149+
const eslintrcMerge = eslintrc.replace('parser: \'babel-eslint\'', 'testMerge: \'testMerge\', parser: \'babel-eslint\'')
150150
await project.write('.eslintrc.js', eslintrcMerge)
151151

152152
await project.upgrade('eslint')

packages/@vue/cli-plugin-eslint/__tests__/eslintPlugin.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ test('should persist cache', async () => {
227227
expect(has('node_modules/.cache/eslint/cache.json')).toBe(true)
228228
})
229229

230-
test(`should use formatter 'codeframe'`, async () => {
230+
test('should use formatter \'codeframe\'', async () => {
231231
const project = await create('eslint-formatter-codeframe', {
232232
plugins: {
233233
'@vue/cli-plugin-babel': {},

packages/@vue/cli-plugin-eslint/__tests__/ui.spec.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ describe('getEslintPrompts', () => {
9191

9292
// all rules
9393
const rules = {
94-
'lorem': {
94+
lorem: {
9595
meta: {
9696
docs: {
9797
category: undefined,
@@ -100,7 +100,7 @@ describe('getEslintPrompts', () => {
100100
}
101101
}
102102
},
103-
'ipsum': {
103+
ipsum: {
104104
meta: {
105105
docs: {
106106
category: 'recommended',
@@ -109,7 +109,7 @@ describe('getEslintPrompts', () => {
109109
}
110110
}
111111
},
112-
'dolor': {
112+
dolor: {
113113
meta: {
114114
docs: {
115115
category: 'strongly-recommended',
@@ -118,7 +118,7 @@ describe('getEslintPrompts', () => {
118118
}
119119
}
120120
},
121-
'sit': {
121+
sit: {
122122
meta: {
123123
docs: {
124124
category: 'base',

0 commit comments

Comments
 (0)