Skip to content

chore!: change default value of lintOnSave option #3975

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ test('should work', async () => {
done = resolve
})
// enable lintOnSave
await write('vue.config.js', 'module.exports = { lintOnSave: true }')
await write('vue.config.js', "module.exports = { lintOnSave: 'default' }")
// write invalid file
const app = await read('src/App.vue')
const updatedApp = app.replace(/;/, '')
Expand All @@ -74,7 +74,7 @@ test('should work', async () => {
data = data.toString()
if (isFirstMsg) {
// should fail on start
expect(data).toMatch(/Compiled with \d warning/)
expect(data).toMatch(/Failed to compile with \d error/)
isFirstMsg = false

// fix it
Expand Down
2 changes: 1 addition & 1 deletion packages/@vue/cli-service-global/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function createService (context, entry, asLib) {
return new Service(context, {
projectOptions: {
compiler: true,
lintOnSave: true
lintOnSave: 'default'
},
plugins: [
babelPlugin,
Expand Down
8 changes: 4 additions & 4 deletions packages/@vue/cli-service/__tests__/Service.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ test('loading plugins from package.json', () => {
test('load project options from package.json', () => {
mockPkg({
vue: {
lintOnSave: true
lintOnSave: 'default'
}
})
const service = createMockService()
expect(service.projectOptions.lintOnSave).toBe(true)
expect(service.projectOptions.lintOnSave).toBe('default')
})

test('deprecate baseUrl', () => {
Expand Down Expand Up @@ -144,7 +144,7 @@ test('load project options from vue.config.js', () => {
fs.writeFileSync('/vue.config.js', `module.exports = { lintOnSave: false }`)
mockPkg({
vue: {
lintOnSave: true
lintOnSave: 'default'
}
})
const service = createMockService()
Expand All @@ -160,7 +160,7 @@ test('load project options from vue.config.js', () => {
jest.mock('/vue.config.js', () => function () { return { lintOnSave: false } }, { virtual: true })
mockPkg({
vue: {
lintOnSave: true
lintOnSave: 'default'
}
})
const service = createMockService()
Expand Down
2 changes: 1 addition & 1 deletion packages/@vue/cli-service/lib/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ exports.defaults = () => ({
},

// whether to use eslint-loader
lintOnSave: true,
lintOnSave: 'default',

devServer: {
/*
Expand Down
1 change: 1 addition & 0 deletions packages/@vue/cli-ui-addon-widgets/src/components/News.vue
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export default {
this.widget.customTitle = this.feed.title
} catch (e) {
this.error = 'fetch'
// eslint-disable-next-line no-console
console.error(e)
}
this.loading = false
Expand Down
4 changes: 2 additions & 2 deletions packages/@vue/cli/__tests__/Generator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ test('api: addConfigTransform (multiple)', async () => {
test('api: addConfigTransform transform vue warn', async () => {
const configs = {
vue: {
lintOnSave: true
lintOnSave: 'default'
}
}

Expand All @@ -606,7 +606,7 @@ test('api: addConfigTransform transform vue warn', async () => {
extractConfigFiles: true
})

expect(fs.readFileSync('/vue.config.js', 'utf-8')).toMatch('module.exports = {\n lintOnSave: true\n}')
expect(fs.readFileSync('/vue.config.js', 'utf-8')).toMatch(`module.exports = {\n lintOnSave: 'default'\n}`)
expect(logs.warn.some(([msg]) => {
return msg.match(/Reserved config transform 'vue'/)
})).toBe(true)
Expand Down
2 changes: 1 addition & 1 deletion packages/@vue/cli/__tests__/invoke.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ test('invoke with ts', async () => {
await project.write('package.json', JSON.stringify(pkg, null, 2))

// mock existing vue.config.js
await project.write('vue.config.js', `module.exports = { lintOnSave: true }`)
await project.write('vue.config.js', `module.exports = { lintOnSave: 'default' }`)

const eslintrc = parseJS(await project.read('.eslintrc.js'))
expect(eslintrc).toEqual(Object.assign({}, baseESLintConfig, {
Expand Down