Skip to content

Commit 8dddff6

Browse files
author
Guillaume Chau
committed
chore: merge dev
2 parents b50cfe7 + afb3173 commit 8dddff6

File tree

5 files changed

+40
-5
lines changed

5 files changed

+40
-5
lines changed

packages/@vue/cli-plugin-eslint/index.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
module.exports = (api, { lintOnSave }) => {
22
if (lintOnSave) {
33
const extensions = require('./eslintOptions').extensions(api)
4+
const cacheIdentifier = genCacheIdentifier(api.resolve('.'))
5+
46
api.chainWebpack(webpackConfig => {
57
webpackConfig.module
68
.rule('eslint')
@@ -14,6 +16,8 @@ module.exports = (api, { lintOnSave }) => {
1416
.loader('eslint-loader')
1517
.options({
1618
extensions,
19+
cache: true,
20+
cacheIdentifier,
1721
emitWarning: lintOnSave !== 'error',
1822
formatter: require('eslint/lib/formatters/codeframe')
1923
})
@@ -34,3 +38,33 @@ module.exports = (api, { lintOnSave }) => {
3438
require('./lint')(args, api)
3539
})
3640
}
41+
42+
// eslint-loader doesn't bust cache when eslint config changes
43+
// so we have to manually generate a cache identifier that takes the config
44+
// into account.
45+
function genCacheIdentifier (context) {
46+
const fs = require('fs')
47+
const path = require('path')
48+
const files = [
49+
'.eslintrc.js',
50+
'.eslintrc.yaml',
51+
'.eslintrc.yml',
52+
'.eslintrc.json',
53+
'.eslintrc',
54+
'package.json'
55+
]
56+
57+
const configTimeStamp = (() => {
58+
for (const file of files) {
59+
if (fs.existsSync(path.join(context, file))) {
60+
return fs.statSync(file).mtimeMs
61+
}
62+
}
63+
})()
64+
65+
return JSON.stringify({
66+
'eslint-loader': require('eslint-loader/package.json').version,
67+
'eslint': require('eslint/package.json').version,
68+
'config': configTimeStamp
69+
})
70+
}

packages/@vue/cli-plugin-typescript/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ module.exports = (api, {
5050
})
5151
// make sure to append TSX suffix
5252
tsxRule.use('ts-loader').loader('ts-loader').tap(options => {
53+
options = Object.assign({}, options)
5354
delete options.appendTsSuffixTo
5455
options.appendTsxSuffixTo = [/\.vue$/]
5556
return options

packages/@vue/cli-service/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"thread-loader": "^1.1.5",
6060
"uglifyjs-webpack-plugin": "^1.2.5",
6161
"url-loader": "^1.0.1",
62-
"vue-loader": "^15.0.11",
62+
"vue-loader": "^15.1.0",
6363
"vue-template-compiler": "^2.5.16",
6464
"webpack": "^4.8.2",
6565
"webpack-chain": "^4.8.0",

packages/@vue/cli/__tests__/Generator.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const fs = require('fs-extra')
44
const path = require('path')
55
const Generator = require('../lib/Generator')
66
const { logs } = require('@vue/cli-shared-utils')
7-
const stringifyJS = require('../util/stringifyJS')
7+
const stringifyJS = require('../lib/util/stringifyJS')
88

99
// prepare template fixtures
1010
const templateDir = path.resolve(__dirname, 'template')

yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11490,9 +11490,9 @@ vue-jest@^2.6.0:
1149011490
tsconfig "^7.0.0"
1149111491
vue-template-es2015-compiler "^1.6.0"
1149211492

11493-
vue-loader@^15.0.11:
11494-
version "15.0.11"
11495-
resolved "https://registry.yarnpkg.com/vue-loader/-/vue-loader-15.0.11.tgz#b41dee864cdeb0012c8a2c02a66b13459e45e16e"
11493+
vue-loader@^15.1.0:
11494+
version "15.1.0"
11495+
resolved "https://registry.yarnpkg.com/vue-loader/-/vue-loader-15.1.0.tgz#82a2a5c310951aba17ad5d8680fe016c77d37e80"
1149611496
dependencies:
1149711497
"@vue/component-compiler-utils" "^1.2.1"
1149811498
hash-sum "^1.0.2"

0 commit comments

Comments
 (0)