mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-01-26 00:59:02 -06:00
feat: bump lint-staged to v10 (#6136)
This commit is contained in:
@@ -169,10 +169,7 @@ When installed, `@vue/cli-service` also installs [yorkie](https://github.com/yyx
|
||||
"pre-commit": "lint-staged"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,vue}": [
|
||||
"vue-cli-service lint",
|
||||
"git add"
|
||||
]
|
||||
"*.{js,vue}": "vue-cli-service lint"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -166,10 +166,7 @@ npx vue-cli-service build --skip-plugins @vue/cli-plugin-pwa
|
||||
"pre-commit": "lint-staged"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,vue}": [
|
||||
"vue-cli-service lint",
|
||||
"git add"
|
||||
]
|
||||
"*.{js,vue}": "vue-cli-service lint"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -128,10 +128,7 @@ npx vue-cli-service help [command]
|
||||
"pre-commit": "lint-staged"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,vue}": [
|
||||
"vue-cli-service lint",
|
||||
"git add"
|
||||
]
|
||||
"*.{js,vue}": "vue-cli-service lint"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
12
package.json
12
package.json
@@ -26,14 +26,8 @@
|
||||
"commit-msg": "node scripts/verifyCommitMsg.js"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,vue}": [
|
||||
"eslint --fix",
|
||||
"git add"
|
||||
],
|
||||
"packages/**/bin/*": [
|
||||
"eslint --fix",
|
||||
"git add"
|
||||
]
|
||||
"*.{js,vue}": "eslint --fix",
|
||||
"packages/**/bin/*": "eslint --fix"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.12.9",
|
||||
@@ -67,7 +61,7 @@
|
||||
"jest": "^26.6.3",
|
||||
"lerna": "^3.22.0",
|
||||
"lerna-changelog": "^1.0.1",
|
||||
"lint-staged": "^9.5.0",
|
||||
"lint-staged": "^10.5.3",
|
||||
"memfs": "^3.2.0",
|
||||
"minimist": "^1.2.5",
|
||||
"node-fetch": "^2.6.1",
|
||||
|
||||
@@ -157,7 +157,7 @@ test('lint on commit', async () => {
|
||||
expect(pkg.gitHooks['pre-commit']).toBe('lint-staged')
|
||||
expect(pkg.devDependencies).toHaveProperty('lint-staged')
|
||||
expect(pkg['lint-staged']).toEqual({
|
||||
'*.{js,jsx,vue}': ['vue-cli-service lint', 'git add']
|
||||
'*.{js,jsx,vue}': 'vue-cli-service lint'
|
||||
})
|
||||
expect(pkg.vue).toEqual({
|
||||
lintOnSave: false
|
||||
@@ -176,7 +176,7 @@ test('should lint ts files when typescript plugin co-exists', async () => {
|
||||
const pkg = JSON.parse(await read('package.json'))
|
||||
expect(pkg).toMatchObject({
|
||||
'lint-staged': {
|
||||
'*.{js,jsx,vue,ts,tsx}': ['vue-cli-service lint', 'git add']
|
||||
'*.{js,jsx,vue,ts,tsx}': 'vue-cli-service lint'
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -45,7 +45,8 @@ test('should work', async () => {
|
||||
})
|
||||
const hook = await read('.git/hooks/pre-commit')
|
||||
expect(hook).toMatch('#yorkie')
|
||||
await write('src/main.js', updatedMain)
|
||||
// add a trivial change to avoid empty changeset after running lint-staged
|
||||
await write('src/main.js', updatedMain.replace('false', 'true'))
|
||||
// nvm doesn't like PREFIX env
|
||||
if (process.platform === 'darwin') {
|
||||
delete process.env.PREFIX
|
||||
|
||||
@@ -38,7 +38,7 @@ module.exports = (api, { config, lintOn = [] }, rootOptions, invoking) => {
|
||||
|
||||
if (lintOn.includes('commit')) {
|
||||
Object.assign(pkg.devDependencies, {
|
||||
'lint-staged': '^9.5.0'
|
||||
'lint-staged': '^10.5.3'
|
||||
})
|
||||
pkg.gitHooks = {
|
||||
'pre-commit': 'lint-staged'
|
||||
@@ -46,7 +46,7 @@ module.exports = (api, { config, lintOn = [] }, rootOptions, invoking) => {
|
||||
const extensions = require('../eslintOptions').extensions(api)
|
||||
.map(ext => ext.replace(/^\./, '')) // remove the leading `.`
|
||||
pkg['lint-staged'] = {
|
||||
[`*.{${extensions.join(',')}}`]: ['vue-cli-service lint', 'git add']
|
||||
[`*.{${extensions.join(',')}}`]: 'vue-cli-service lint'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,4 +11,6 @@ module.exports = (api) => {
|
||||
|
||||
api.exitLog('vue-cli-plugin-vue-next is removed because Vue 3 support has been built into the core plugins.')
|
||||
}
|
||||
|
||||
// TODO: lint-staged update
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^4.2.1",
|
||||
"eslint-plugin-vue": "^7.2.0",
|
||||
"lint-staged": "^9.5.0",
|
||||
"lint-staged": "^10.5.3",
|
||||
"lodash.debounce": "^4.0.8",
|
||||
"portal-vue": "^1.3.0",
|
||||
"rimraf": "^3.0.2",
|
||||
@@ -123,14 +123,7 @@
|
||||
"pre-commit": "lint-staged"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"vue-cli-service lint",
|
||||
"git add"
|
||||
],
|
||||
"*.vue": [
|
||||
"vue-cli-service lint",
|
||||
"git add"
|
||||
]
|
||||
"*.{js,vue}": "vue-cli-service lint"
|
||||
},
|
||||
"vuePlugins": {
|
||||
"ui": [
|
||||
|
||||
Reference in New Issue
Block a user