Skip to content

Commit a6e47ce

Browse files
dhenscheyyx990803
authored andcommitted
fix(typescript): add node_modules/** to tslint default excludes (#1200)
close #1194
1 parent be713a6 commit a6e47ce

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

packages/@vue/cli-plugin-typescript/__tests__/tsPluginTSLint.spec.js

+21
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,24 @@ test('should not fix with --no-fix option', async () => {
6767
expect(await read('src/main.ts')).not.toMatch(';')
6868
expect((await read('src/App.vue')).match(/<script(.|\n)*\/script>/)[1]).not.toMatch(';')
6969
})
70+
71+
test('should ignore issues in node_modules', async () => {
72+
const project = await create('ts-lint-node_modules', {
73+
plugins: {
74+
'@vue/cli-plugin-typescript': {
75+
tsLint: true
76+
}
77+
}
78+
})
79+
80+
const { read, write, run } = project
81+
const main = await read('src/main.ts')
82+
83+
// update file to not match tslint spec and dump it into the node_modules directory
84+
const updatedMain = main.replace(/;/g, '')
85+
await write('node_modules/bad.ts', updatedMain)
86+
87+
// lint
88+
await run('vue-cli-service lint')
89+
expect(await read('node_modules/bad.ts')).toMatch(updatedMain)
90+
})

packages/@vue/cli-plugin-typescript/generator/template/tslint.json

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
"extends": [
55
"tslint:recommended"
66
],
7+
"linterOptions": {
8+
"exclude": [
9+
"node_modules/**"
10+
]
11+
},
712
"rules": {
813
"quotemark": [true, "single"],
914
"indent": [true, "spaces", 2],

0 commit comments

Comments
 (0)