8000 fix: eslint should override env for **/tests/** subfolders (#4447) · vuejs/vue-cli@58177d2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 58177d2

Browse files
LinusBorghaoqunjiang
authored andcommitted
fix: eslint should override env for **/tests/** subfolders (#4447)
close #4397
1 parent 86f4f5f commit 58177d2

File tree

2 files changed

+25
-0
lines changed
  • packages/@vue

2 files changed

+25
-0
lines changed

packages/@vue/cli-plugin-unit-jest/generator/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,19 @@ module.exports = (api, _, __, invoking) => {
7777

7878
if (api.hasPlugin('eslint')) {
7979
applyESLint(api)
80+
81+
api.extendPackage({
82+
eslintConfig: {
83+
overrides: [
84+
{
85+
files: ['**/__tests__/*.{j,t}s?(x)'],
86+
env: {
87+
jest: true
88+
}
89+
}
90+
]
91+
}
92+
})
8093
}
8194
}
8295

packages/@vue/cli-plugin-unit-mocha/generator/index.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@ module.exports = (api, _, __, invoking) => {
1515

1616
if (api.hasPlugin('eslint')) {
1717
applyESLint(api)
18+
api.extendPackage({
19+
eslintConfig: {
20+
overrides: [
21+
{
22+
files: ['**/__tests__/*.{j,t}s?(x)'],
23+
env: {
24+
mocha: true
25+
}
26+
}
27+
]
28+
}
29+
})
1830
}
1931

2032
if (api.hasPlugin('typescript')) {

0 commit comments

Comments
 (0)
0