mirror of
				https://gitee.com/vant-contrib/vant.git
				synced 2025-10-31 03:22:08 +08:00 
			
		
		
		
	chore(eslint-config): update dependencies test cases (#10221)
* chore(eslint-config): update dependencies, test cases * chore: update file .lock * fix: wrong .lock file * fix: code style * chore: update `eslint-plugin-vue`
This commit is contained in:
		
							parent
							
								
									f65c4198dc
								
							
						
					
					
						commit
						07dfa9b981
					
				
							
								
								
									
										4
									
								
								packages/vant-eslint-config/jest.config.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								packages/vant-eslint-config/jest.config.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,4 @@ | |||||||
|  | /** @type {import('@jest/types').Config.InitialOptions} */ | ||||||
|  | module.exports = { | ||||||
|  |   resolver: '<rootDir>/jest.resolver.js', | ||||||
|  | }; | ||||||
							
								
								
									
										13
									
								
								packages/vant-eslint-config/jest.resolver.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								packages/vant-eslint-config/jest.resolver.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,13 @@ | |||||||
|  | // https://github.com/facebook/jest/issues/9771#issuecomment-871585234
 | ||||||
|  | const resolver = require('enhanced-resolve').create.sync({ | ||||||
|  |   conditionNames: ['require', 'node', 'default'], | ||||||
|  |   extensions: ['.js', '.json', '.node', '.ts', '.tsx'], | ||||||
|  | }); | ||||||
|  | 
 | ||||||
|  | module.exports = function (request, options) { | ||||||
|  |   // list global module that must be resolved by defaultResolver here
 | ||||||
|  |   if (['fs', 'http', 'path'].includes(request)) { | ||||||
|  |     return options.defaultResolver(request, options); | ||||||
|  |   } | ||||||
|  |   return resolver(options.basedir, request); | ||||||
|  | }; | ||||||
| @ -7,6 +7,10 @@ | |||||||
|     "access": "public", |     "access": "public", | ||||||
|     "registry": "https://registry.npmjs.org/" |     "registry": "https://registry.npmjs.org/" | ||||||
|   }, |   }, | ||||||
|  |   "scripts": { | ||||||
|  |     "update:deps": "pnpm update --latest --interactive", | ||||||
|  |     "test": "jest" | ||||||
|  |   }, | ||||||
|   "repository": { |   "repository": { | ||||||
|     "type": "git", |     "type": "git", | ||||||
|     "url": "https://github.com/youzan/vant.git", |     "url": "https://github.com/youzan/vant.git", | ||||||
| @ -16,15 +20,19 @@ | |||||||
|   "author": "chenjiahan", |   "author": "chenjiahan", | ||||||
|   "license": "MIT", |   "license": "MIT", | ||||||
|   "dependencies": { |   "dependencies": { | ||||||
|     "@typescript-eslint/eslint-plugin": "^5.3.1", |     "@typescript-eslint/eslint-plugin": "^5.10.0", | ||||||
|     "@typescript-eslint/parser": "5.3.1", |     "@typescript-eslint/parser": "^5.10.0", | ||||||
|     "eslint-config-airbnb-base": "^14.2.1", |     "eslint-config-airbnb-base": "^15.0.0", | ||||||
|     "eslint-config-prettier": "^8.3.0", |     "eslint-config-prettier": "^8.3.0", | ||||||
|     "eslint-plugin-import": "^2.24.0", |     "eslint-plugin-import": "^2.25.4", | ||||||
|     "eslint-plugin-vue": "^7.18.0" |     "eslint-plugin-vue": "^8.4.0" | ||||||
|   }, |   }, | ||||||
|   "devDependencies": { |   "devDependencies": { | ||||||
|     "eslint": "^8.0.0", |     "enhanced-resolve": "^5.8.3", | ||||||
|     "typescript": "~4.5.2" |     "eslint": "^8.7.0", | ||||||
|  |     "typescript": "~4.5.5" | ||||||
|  |   }, | ||||||
|  |   "peerDependencies": { | ||||||
|  |     "eslint": "^7.32.0 || ^8.2.0" | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | |||||||
| @ -20,9 +20,11 @@ async function lintProject(name) { | |||||||
| 
 | 
 | ||||||
| test('a vue project should pass lint', async () => { | test('a vue project should pass lint', async () => { | ||||||
|   const rest = await lintProject('vue'); |   const rest = await lintProject('vue'); | ||||||
|  | 
 | ||||||
|   expect([ |   expect([ | ||||||
|     'no-const-assign', |     'no-const-assign', | ||||||
|     '@typescript-eslint/no-unused-vars', |     '@typescript-eslint/no-unused-vars', | ||||||
|  |     'vue/multi-word-component-names', | ||||||
|     'no-undef', |     'no-undef', | ||||||
|   ]).toEqual(rest); |   ]).toEqual(rest); | ||||||
| }); | }); | ||||||
| @ -32,6 +34,7 @@ test('a vue-tsx project should pass lint', async () => { | |||||||
| 
 | 
 | ||||||
|   expect([ |   expect([ | ||||||
|     '@typescript-eslint/no-unused-vars', |     '@typescript-eslint/no-unused-vars', | ||||||
|  |     'vue/multi-word-component-names', | ||||||
|     'vue/no-ref-as-operand', |     'vue/no-ref-as-operand', | ||||||
|     '@typescript-eslint/no-empty-interface', |     '@typescript-eslint/no-empty-interface', | ||||||
|   ]).toEqual(rest); |   ]).toEqual(rest); | ||||||
|  | |||||||
| @ -8,6 +8,7 @@ | |||||||
| const a = 1; | const a = 1; | ||||||
| a = 1; | a = 1; | ||||||
| export default { | export default { | ||||||
|  |   name: 'Todo', | ||||||
|   data() { |   data() { | ||||||
|     return { |     return { | ||||||
|       arr: [1, 2, 3], |       arr: [1, 2, 3], | ||||||
|  | |||||||
| @ -310,7 +310,9 @@ export default defineComponent({ | |||||||
| 
 | 
 | ||||||
|     watch( |     watch( | ||||||
|       () => props.columnsNum, |       () => props.columnsNum, | ||||||
|       () => nextTick(setValues) |       () => { | ||||||
|  |         nextTick(setValues); | ||||||
|  |       } | ||||||
|     ); |     ); | ||||||
| 
 | 
 | ||||||
|     useExpose({ reset, getArea, getValues }); |     useExpose({ reset, getArea, getValues }); | ||||||
|  | |||||||
| @ -33,7 +33,8 @@ export function runRuleValidator(value: unknown, rule: FieldRule) { | |||||||
|     const returnVal = rule.validator!(value, rule); |     const returnVal = rule.validator!(value, rule); | ||||||
| 
 | 
 | ||||||
|     if (isPromise(returnVal)) { |     if (isPromise(returnVal)) { | ||||||
|       return returnVal.then(resolve); |       returnVal.then(resolve); | ||||||
|  |       return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     resolve(returnVal); |     resolve(returnVal); | ||||||
|  | |||||||
| @ -107,12 +107,17 @@ test('should support async validator in rules prop', async () => { | |||||||
|       validator: (value, rule) => { |       validator: (value, rule) => { | ||||||
|         expect(value).toEqual('123'); |         expect(value).toEqual('123'); | ||||||
|         expect(typeof rule).toEqual('object'); |         expect(typeof rule).toEqual('object'); | ||||||
|         return new Promise((resolve) => resolve(true)); |         return new Promise((resolve) => { | ||||||
|  |           resolve(true); | ||||||
|  |         }); | ||||||
|       }, |       }, | ||||||
|       message: 'should pass', |       message: 'should pass', | ||||||
|     }, |     }, | ||||||
|     { |     { | ||||||
|       validator: () => new Promise((resolve) => resolve(false)), |       validator: () => | ||||||
|  |         new Promise((resolve) => { | ||||||
|  |           resolve(false); | ||||||
|  |         }), | ||||||
|       message: 'should fail', |       message: 'should fail', | ||||||
|     }, |     }, | ||||||
|   ]; |   ]; | ||||||
|  | |||||||
| @ -162,7 +162,9 @@ export default defineComponent({ | |||||||
|       } |       } | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     const init = () => nextTick(onScroll); |     const init = () => { | ||||||
|  |       nextTick(onScroll); | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|     useEventListener('scroll', onScroll, { target: scrollParent }); |     useEventListener('scroll', onScroll, { target: scrollParent }); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -426,7 +426,10 @@ test('before-delete prop resolved', async () => { | |||||||
|   const wrapper = mount(Uploader, { |   const wrapper = mount(Uploader, { | ||||||
|     props: { |     props: { | ||||||
|       modelValue: [{ url: IMAGE }], |       modelValue: [{ url: IMAGE }], | ||||||
|       beforeDelete: () => new Promise<boolean>((resolve) => resolve(true)), |       beforeDelete: () => | ||||||
|  |         new Promise<boolean>((resolve) => { | ||||||
|  |           resolve(true); | ||||||
|  |         }), | ||||||
|     }, |     }, | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
| @ -439,7 +442,10 @@ test('before-delete prop rejected', async () => { | |||||||
|   const wrapper = mount(Uploader, { |   const wrapper = mount(Uploader, { | ||||||
|     props: { |     props: { | ||||||
|       modelValue: [{ url: IMAGE }], |       modelValue: [{ url: IMAGE }], | ||||||
|       beforeDelete: () => new Promise<boolean>((resolve, reject) => reject()), |       beforeDelete: () => | ||||||
|  |         new Promise<boolean>((resolve, reject) => { | ||||||
|  |           reject(); | ||||||
|  |         }), | ||||||
|     }, |     }, | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										6779
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										6779
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user