mirror of
				https://github.com/continew-org/continew-admin-ui.git
				synced 2025-10-31 22:57:15 +08:00 
			
		
		
		
	feat:git提交钩子(prettier格式化)
This commit is contained in:
		
							
								
								
									
										7
									
								
								.prettierignore
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								.prettierignore
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| /dist/* | ||||
| .local | ||||
| /node_modules/** | ||||
|  | ||||
| **/*.sh | ||||
|  | ||||
| /public/* | ||||
							
								
								
									
										13
									
								
								.prettierrc.cjs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								.prettierrc.cjs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| module.exports = { | ||||
|   printWidth: 100, // 单行字符数, 默认80 | ||||
|   tabWidth: 2, // 缩进字节数, 默认2 | ||||
|   semi: false, // 句尾使用分号, 默认true | ||||
|   singleQuote: true, // 使用单引号代替双引号, 默认false | ||||
|   trailingComma: 'none', // ,多行时尽可能打印尾随逗号 默认'none', 可选: ['none', 'es5', 'all'] | ||||
|   endOfLine: 'auto', // 结束行形式, 默认'auto', 结尾是 \n \r \n\r auto | ||||
|   bracketSpacing: true // 在对象前后添加空格-obj: { foo: bar } | ||||
|   // arrowParens: 'avoid', // 在单个箭头函数参数周围加上括号, 默认'avoid', 可选: ['avoid', 'always'] avoid: 尽可能  always: 始终 | ||||
|   // bracketSpacing: true, // 在对象文字中打印括号之间的空格, 默认true, 示例: true -- { name: 'abc' }  false -- {name:'abc'} | ||||
|   // useTabs: false, // 使用制表符 tab 缩进行而不是空格, 默认false | ||||
|   // jsxSingleQuote: false, // 在JSX中使用单引号代替双引号, 默认false | ||||
| } | ||||
							
								
								
									
										2
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							| @@ -5,7 +5,7 @@ | ||||
|  | ||||
|   // Disable the default formatter, use eslint instead | ||||
|   "prettier.enable": false, | ||||
|   "editor.formatOnSave": true, | ||||
|   "editor.formatOnSave": false, | ||||
|  | ||||
|   // Auto fix | ||||
|   "editor.codeActionsOnSave": { | ||||
|   | ||||
| @@ -10,7 +10,8 @@ | ||||
|     "preview": "vite preview --port 5050", | ||||
|     "typecheck": "vue-tsc --noEmit", | ||||
|     "lint": "eslint src", | ||||
|     "lint:fix": "eslint src --fix" | ||||
|     "lint:fix": "eslint src --fix", | ||||
|     "lint:prettier": "prettier --write \"src/**/*.{js,ts,json,tsx,css,less,scss,vue,html,md}\"" | ||||
|   }, | ||||
|   "dependencies": { | ||||
|     "@amap/amap-jsapi-loader": "^1.0.1", | ||||
| @@ -69,6 +70,7 @@ | ||||
|     "less-loader": "^11.0.0", | ||||
|     "lint-staged": "^15.2.2", | ||||
|     "picocolors": "^1.0.0", | ||||
|     "prettier": "3.3.0", | ||||
|     "sass": "^1.62.1", | ||||
|     "sass-loader": "^13.2.2", | ||||
|     "simple-git-hooks": "^2.11.1", | ||||
| @@ -85,6 +87,9 @@ | ||||
|     "pre-commit": "npm lint-staged" | ||||
|   }, | ||||
|   "lint-staged": { | ||||
|     "*": "eslint --fix" | ||||
|     "*": [ | ||||
|       "eslint --fix", | ||||
|       "prettier --write 'src/**/*.{js,ts,json,tsx,css,less,scss,vue,html,md}'" | ||||
|     ] | ||||
|   } | ||||
| } | ||||
|   | ||||
							
								
								
									
										1587
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										1587
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -25,14 +25,15 @@ const props = defineProps({ | ||||
|   } | ||||
| }) | ||||
|  | ||||
| const dictItem = computed(() => { | ||||
| const dictItem = computed((): LabelValueState => { | ||||
|   try { | ||||
|     return props.dict.find((d) => d.value === String(props.value) || d.value === Number(props.value)) | ||||
|     return props.dict.find( | ||||
|       (d) => d.value === String(props.value) || d.value === Number(props.value) | ||||
|     ) || { label: '', value: '' } | ||||
|   } catch (error) { | ||||
|     return [] | ||||
|     return { label: '', value: '' } | ||||
|   } | ||||
| } | ||||
| ) | ||||
| }) | ||||
| </script> | ||||
|  | ||||
| <style lang="scss" scoped></style> | ||||
|   | ||||
| @@ -20,7 +20,7 @@ | ||||
| import HeaderRightBar from '../HeaderRightBar/index.vue' | ||||
| import MenuFoldBtn from '../MenuFoldBtn.vue' | ||||
|  | ||||
| defineOptions({ name: 'Header' }) | ||||
| defineOptions({ name: 'LayoutHeader' }) | ||||
| </script> | ||||
|  | ||||
| <style lang="scss" scoped> | ||||
| @@ -31,6 +31,7 @@ defineOptions({ name: 'Header' }) | ||||
| .header { | ||||
|   display: flex; | ||||
|   align-items: center; | ||||
|  | ||||
|   .header-right { | ||||
|     flex: 1; | ||||
|     overflow: hidden; | ||||
|   | ||||
| @@ -13,7 +13,7 @@ | ||||
| <script setup lang="ts"> | ||||
| import { useAppStore, useTabsStore } from '@/stores' | ||||
|  | ||||
| defineOptions({ name: 'Main' }) | ||||
| defineOptions({ name: 'LayoutMain' }) | ||||
| const appStore = useAppStore() | ||||
| const tabsStore = useTabsStore() | ||||
| </script> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 秋帆
					秋帆