Skip to content

Commit e8f036b

Browse files
committed
fix: also include import rule in eslint plugin
1 parent d391e47 commit e8f036b

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

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

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,28 @@ module.exports = (api, { config, lintOn = [] }) => {
6464
api.extendPackage(pkg)
6565

6666
if (api.hasPlugin('unit-mocha')) {
67+
const config = {
68+
env: { mocha: true }
69+
}
70+
if (config === 'airbnb') {
71+
config.rules = {
72+
'import/no-extraneous-dependencies': 'off'
73+
}
74+
}
6775
api.render(files => {
68-
files['test/unit/.eslintrc'] = JSON.stringify({
69-
env: { mocha: true }
70-
}, null, 2)
76+
files['test/unit/.eslintrc'] = JSON.stringify(config, null, 2)
7177
})
7278
} else if (api.hasPlugin('unit-jest')) {
79+
const config = {
80+
env: { jest: true }
81+
}
82+
if (config === 'airbnb') {
83+
config.rules = {
84+
'import/no-extraneous-dependencies': 'off'
85+
}
86+
}
7387
api.render(files => {
74-
files['test/unit/.eslintrc'] = JSON.stringify({
75-
env: { jest: true }
76-
}, null, 2)
88+
files['test/unit/.eslintrc'] = JSON.stringify(config, null, 2)
7789
})
7890
}
7991

0 commit comments

Comments
 (0)