mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-01-23 23:59:02 -06:00
chore: merge dev
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
module.exports = (api, { lintOnSave }) => {
|
||||
if (lintOnSave) {
|
||||
const extensions = require('./eslintOptions').extensions(api)
|
||||
const cacheIdentifier = genCacheIdentifier(api.resolve('.'))
|
||||
|
||||
api.chainWebpack(webpackConfig => {
|
||||
webpackConfig.module
|
||||
.rule('eslint')
|
||||
@@ -14,6 +16,8 @@ module.exports = (api, { lintOnSave }) => {
|
||||
.loader('eslint-loader')
|
||||
.options({
|
||||
extensions,
|
||||
cache: true,
|
||||
cacheIdentifier,
|
||||
emitWarning: lintOnSave !== 'error',
|
||||
formatter: require('eslint/lib/formatters/codeframe')
|
||||
})
|
||||
@@ -34,3 +38,33 @@ module.exports = (api, { lintOnSave }) => {
|
||||
require('./lint')(args, api)
|
||||
})
|
||||
}
|
||||
|
||||
// eslint-loader doesn't bust cache when eslint config changes
|
||||
// so we have to manually generate a cache identifier that takes the config
|
||||
// into account.
|
||||
function genCacheIdentifier (context) {
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const files = [
|
||||
'.eslintrc.js',
|
||||
'.eslintrc.yaml',
|
||||
'.eslintrc.yml',
|
||||
'.eslintrc.json',
|
||||
'.eslintrc',
|
||||
'package.json'
|
||||
]
|
||||
|
||||
const configTimeStamp = (() => {
|
||||
for (const file of files) {
|
||||
if (fs.existsSync(path.join(context, file))) {
|
||||
return fs.statSync(file).mtimeMs
|
||||
}
|
||||
}
|
||||
})()
|
||||
|
||||
return JSON.stringify({
|
||||
'eslint-loader': require('eslint-loader/package.json').version,
|
||||
'eslint': require('eslint/package.json').version,
|
||||
'config': configTimeStamp
|
||||
})
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ module.exports = (api, {
|
||||
})
|
||||
// make sure to append TSX suffix
|
||||
tsxRule.use('ts-loader').loader('ts-loader').tap(options => {
|
||||
options = Object.assign({}, options)
|
||||
delete options.appendTsSuffixTo
|
||||
options.appendTsxSuffixTo = [/\.vue$/]
|
||||
return options
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
"thread-loader": "^1.1.5",
|
||||
"uglifyjs-webpack-plugin": "^1.2.5",
|
||||
"url-loader": "^1.0.1",
|
||||
"vue-loader": "^15.0.11",
|
||||
"vue-loader": "^15.1.0",
|
||||
"vue-template-compiler": "^2.5.16",
|
||||
"webpack": "^4.8.2",
|
||||
"webpack-chain": "^4.8.0",
|
||||
|
||||
@@ -4,7 +4,7 @@ const fs = require('fs-extra')
|
||||
const path = require('path')
|
||||
const Generator = require('../lib/Generator')
|
||||
const { logs } = require('@vue/cli-shared-utils')
|
||||
const stringifyJS = require('../util/stringifyJS')
|
||||
const stringifyJS = require('../lib/util/stringifyJS')
|
||||
|
||||
// prepare template fixtures
|
||||
const templateDir = path.resolve(__dirname, 'template')
|
||||
|
||||
@@ -11490,9 +11490,9 @@ vue-jest@^2.6.0:
|
||||
tsconfig "^7.0.0"
|
||||
vue-template-es2015-compiler "^1.6.0"
|
||||
|
||||
vue-loader@^15.0.11:
|
||||
version "15.0.11"
|
||||
resolved "https://registry.yarnpkg.com/vue-loader/-/vue-loader-15.0.11.tgz#b41dee864cdeb0012c8a2c02a66b13459e45e16e"
|
||||
vue-loader@^15.1.0:
|
||||
version "15.1.0"
|
||||
resolved "https://registry.yarnpkg.com/vue-loader/-/vue-loader-15.1.0.tgz#82a2a5c310951aba17ad5d8680fe016c77d37e80"
|
||||
dependencies:
|
||||
"@vue/component-compiler-utils" "^1.2.1"
|
||||
hash-sum "^1.0.2"
|
||||
|
||||
Reference in New Issue
Block a user