Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcf88c6d

Browse files
committed
feat: add eslint support
1 parentdc4b430 commitcf88c6d

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

‎generator/index.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,42 @@ module.exports = (api) => {
1313
prune:true
1414
})
1515

16+
if(api.hasPlugin('eslint')){
17+
api.extendPackage({
18+
devDependencies:{
19+
'eslint-plugin-vue':'^7.0.0-alpha.0'
20+
}
21+
})
22+
23+
// `plugin:vue/essential` -> `plugin:vue/vue3-essential`, etc.
24+
constupdateConfig=cfg=>
25+
cfg.replace(
26+
/plugin:vue\/(essential|recommended|strongly-recommended)/gi,
27+
'plugin:vue/vue3-$1'
28+
)
29+
30+
// if the config is placed in `package.json`
31+
consteslintConfigInPkg=api.generator.pkg.eslintConfig
32+
if(eslintConfigInPkg&&eslintConfigInPkg.extends){
33+
eslintConfigInPkg.extends=eslintConfigInPkg.extends.map(cfg=>updateConfig(cfg))
34+
}
35+
// if the config has been extracted to a standalone file
36+
api.render((files)=>{
37+
for(constfilenameof[
38+
'.eslintrc.js',
39+
'.eslintrc.cjs',
40+
'.eslintrc.yaml',
41+
'.eslintrc.yml',
42+
'.eslinrc.json',
43+
'.eslintrc'
44+
]){
45+
if(files[filename]){
46+
files[filename]=updateConfig(files[filename])
47+
}
48+
}
49+
})
50+
}
51+
1652
if(api.hasPlugin('vuex')||api.generator.pkg.dependencies['vuex']){
1753
api.extendPackage({
1854
dependencies:{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp