Skip to content

Commit 596a49d

Browse files
AnWeberhaoqunjiang
authored andcommittedJan 16, 2019
feat: support yml, yaml and json tslint configuration files (#3305)
1 parent 90c27cf commit 596a49d

File tree

1 file changed

+4
-2
lines changed
  • packages/@vue/cli-plugin-typescript/lib

1 file changed

+4
-2
lines changed
 

‎packages/@vue/cli-plugin-typescript/lib/tslint.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ module.exports = function lint (args = {}, api, silent) {
8080
patchProgram(this.program)
8181
}
8282

83-
const tslintConfigPath = api.resolve('tslint.json')
83+
const tslintConfigPath = tslint.Configuration.CONFIG_FILENAMES
84+
.map(filename => api.resolve(filename))
85+
.find(file => fs.existsSync(file))
8486

8587
const config = tslint.Configuration.findConfiguration(tslintConfigPath).results
8688
// create a patched config that disables the blank lines rule,
@@ -113,7 +115,7 @@ module.exports = function lint (args = {}, api, silent) {
113115
// respect linterOptions.exclude from tslint.json
114116
if (config.linterOptions && config.linterOptions.exclude) {
115117
// use the raw tslint.json data because config contains absolute paths
116-
const rawTslintConfig = JSON.parse(fs.readFileSync(tslintConfigPath, 'utf-8'))
118+
const rawTslintConfig = tslint.Configuration.readConfigurationFile(tslintConfigPath)
117119
const excludedGlobs = rawTslintConfig.linterOptions.exclude
118120
excludedGlobs.forEach((g) => files.push('!' + g))
119121
}

0 commit comments

Comments
 (0)