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

Commitcd0ca0d

Browse files
authored
fix: ensure there's only one instance of plugin-vue in the config (#184)
Fixes#161
1 parent44557f8 commitcd0ca0d

31 files changed

+1032
-190
lines changed

‎pnpm-lock.yaml‎

Lines changed: 329 additions & 187 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎renovate.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"schedule:monthly"
66
],
77
"ignorePaths": [
8-
"**/node_modules/**"
8+
"**/node_modules/**",
9+
"test/fixtures/redefine-plugin-vue"
910
],
1011
"ignoreDeps": ["espree"]
1112
}

‎src/utilities.ts‎

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
importprocessfrom'node:process'
22
importtseslintfrom'typescript-eslint'
33
importtype{TSESLint}from'@typescript-eslint/utils'
4+
importpluginVuefrom'eslint-plugin-vue'
45

56
import{TsEslintConfigForVue}from'./configs'
67
importgroupVueFilesfrom'./groupVueFiles'
@@ -78,9 +79,10 @@ export function defineConfigWithVueTs(
7879
returnpipe(
7980
configs,
8081
flattenConfigs,
82+
deduplicateVuePlugin,
8183
insertAndReorderConfigs,
8284
resolveVueTsConfigs,
83-
tseslint.config,// this might not be necessary, but it doesn't hurt to keep it
85+
tseslint.config,// this might not be necessary, but it doesn't hurt to keep it
8486
)
8587
}
8688

@@ -191,7 +193,10 @@ function insertAndReorderConfigs(configs: RawConfigItem[]): RawConfigItem[] {
191193

192194
return[
193195
...configsWithoutTypeAwareRules.slice(0,lastExtendedConfigIndex+1),
194-
...createBasicSetupConfigs(projectOptions.tsSyntaxInTemplates,projectOptions.scriptLangs),
196+
...createBasicSetupConfigs(
197+
projectOptions.tsSyntaxInTemplates,
198+
projectOptions.scriptLangs,
199+
),
195200

196201
// user-turned-off type-aware rules must come after the last extended config
197202
// in case some rules re-enabled by the extended config
@@ -248,3 +253,34 @@ const rulesRequiringTypeInformation = new Set(
248253
functiondoesRuleRequireTypeInformation(ruleName:string):boolean{
249254
returnrulesRequiringTypeInformation.has(ruleName)
250255
}
256+
257+
functiondeduplicateVuePlugin(configs:RawConfigItem[]):RawConfigItem[]{
258+
returnconfigs.map(config=>{
259+
if(configinstanceofTsEslintConfigForVue||!config.plugins?.vue){
260+
returnconfig
261+
}
262+
263+
constcurrentVuePlugin=config.plugins.vue
264+
if(currentVuePlugin!==pluginVue){
265+
constcurrentVersion:string=currentVuePlugin.meta?.version||'unknown'
266+
constexpectedVersion:string=pluginVue.meta?.version||'unknown'
267+
268+
constconfigName:string=config.name||'unknown config'
269+
270+
console.warn(
271+
`Warning: Multiple instances of eslint-plugin-vue detected in${configName}. `+
272+
`Replacing version${currentVersion} with version${expectedVersion}.`,
273+
)
274+
275+
return{
276+
...config,
277+
plugins:{
278+
...config.plugins,
279+
vue:pluginVue,
280+
},
281+
}
282+
}
283+
284+
returnconfig
285+
})
286+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue,css,scss,sass,less,styl}]
2+
charset =utf-8
3+
indent_size =2
4+
indent_style =space
5+
insert_final_newline =true
6+
trim_trailing_whitespace =true
7+
8+
end_of_line =lf
9+
max_line_length =100
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*text=autoeol=lf
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
.DS_Store
12+
dist
13+
dist-ssr
14+
coverage
15+
*.local
16+
17+
/cypress/videos/
18+
/cypress/screenshots/
19+
20+
# Editor directories and files
21+
.vscode/*
22+
!.vscode/extensions.json
23+
.idea
24+
*.suo
25+
*.ntvs*
26+
*.njsproj
27+
*.sln
28+
*.sw?
29+
30+
*.tsbuildinfo
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"Vue.volar",
4+
"dbaeumer.vscode-eslint",
5+
"EditorConfig.EditorConfig"
6+
]
7+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#redefine-plugin-vue
2+
3+
This template should help get you started developing with Vue 3 in Vite.
4+
5+
##Recommended IDE Setup
6+
7+
[VSCode](https://code.visualstudio.com/) +[Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
8+
9+
##Type Support for`.vue` Imports in TS
10+
11+
TypeScript cannot handle type information for`.vue` imports by default, so we replace the`tsc` CLI with`vue-tsc` for type checking. In editors, we need[Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of`.vue` types.
12+
13+
##Customize configuration
14+
15+
See[Vite Configuration Reference](https://vite.dev/config/).
16+
17+
##Project Setup
18+
19+
```sh
20+
pnpm install
21+
```
22+
23+
###Compile and Hot-Reload for Development
24+
25+
```sh
26+
pnpm dev
27+
```
28+
29+
###Type-Check, Compile and Minify for Production
30+
31+
```sh
32+
pnpm build
33+
```
34+
35+
###Lint with[ESLint](https://eslint.org/)
36+
37+
```sh
38+
pnpm lint
39+
```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="vite/client" />
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import{globalIgnores}from'eslint/config'
2+
import{defineConfigWithVueTs,vueTsConfigs}from'@vue/eslint-config-typescript'
3+
importpluginVuefrom'eslint-plugin-vue'
4+
5+
// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
6+
// import { configureVueProject } from '@vue/eslint-config-typescript'
7+
// configureVueProject({ scriptLangs: ['ts', 'tsx'] })
8+
// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup
9+
10+
exportdefaultdefineConfigWithVueTs(
11+
{
12+
name:'app/files-to-lint',
13+
files:['**/*.{ts,mts,tsx,vue}'],
14+
},
15+
16+
globalIgnores(['**/dist/**','**/dist-ssr/**','**/coverage/**']),
17+
18+
pluginVue.configs['flat/essential'],
19+
vueTsConfigs.recommended,
20+
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp