From 0278f24ea34df0da0bdfe9a15ca627563c898771 Mon Sep 17 00:00:00 2001
From: 07akioni <07akioni2@gmail.com>
Date: Fri, 5 Apr 2024 23:49:36 +0800
Subject: [PATCH] fix: some ci fix
---
.eslintrc.js | 4 ++--
package.json | 8 +++----
src/auto-complete/tests/AutoComplete.spec.ts | 5 +----
.../tests/{Code.spec.ts => Code.spec.tsx} | 21 ++++++++-----------
src/form/src/Form.tsx | 1 +
src/form/src/FormItem.tsx | 1 +
6 files changed, 18 insertions(+), 22 deletions(-)
rename src/code/tests/{Code.spec.ts => Code.spec.tsx} (82%)
diff --git a/.eslintrc.js b/.eslintrc.js
index 044934db6f0..d47a697a9b1 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -1,5 +1,5 @@
module.exports = {
- extends: ['plugin:markdown/recommended', 'prettier'],
+ extends: ['plugin:markdown/recommended-legacy', 'prettier'],
overrides: [
{
files: '*.mjs',
@@ -39,7 +39,7 @@ module.exports = {
},
{
files: ['*.ts', '*.tsx'],
- extends: ['standard-with-typescript', 'plugin:import/typescript'],
+ extends: ['love', 'plugin:import/typescript'],
parserOptions: {
project: './tsconfig.json',
ecmaFeatures: {
diff --git a/package.json b/package.json
index f0dffb4a0a8..6eb5db6f022 100644
--- a/package.json
+++ b/package.json
@@ -88,8 +88,8 @@
"@rollup/plugin-terser": "^0.4.3",
"@types/estree": "^1.0.1",
"@types/jest": "^29.5.4",
- "@typescript-eslint/eslint-plugin": "^6.6.0",
- "@typescript-eslint/parser": "^7.0.2",
+ "@typescript-eslint/eslint-plugin": "^7.5.0",
+ "@typescript-eslint/parser": "^7.5.0",
"@vicons/fluent": "^0.12.0",
"@vicons/ionicons4": "^0.12.0",
"@vicons/ionicons5": "^0.12.0",
@@ -106,11 +106,11 @@
"deepmerge": "^4.3.1",
"esbuild": "0.20.1",
"eslint": "^8.48.0",
+ "eslint-config-love": "^44.0.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-standard": "^17.1.0",
- "eslint-config-standard-with-typescript": "^43.0.0",
"eslint-plugin-import": "^2.28.1",
- "eslint-plugin-markdown": "^3.0.1",
+ "eslint-plugin-markdown": "^4.0.1",
"eslint-plugin-n": "^16.0.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.1.1",
diff --git a/src/auto-complete/tests/AutoComplete.spec.ts b/src/auto-complete/tests/AutoComplete.spec.ts
index d67ae7b6cea..35ec1140742 100644
--- a/src/auto-complete/tests/AutoComplete.spec.ts
+++ b/src/auto-complete/tests/AutoComplete.spec.ts
@@ -114,10 +114,7 @@ describe('n-auto-complete', () => {
const wrapper = mount(NAutoComplete)
await wrapper.setProps({
getShow: (value: string | null) => {
- if (value && value.endsWith('@')) {
- return true
- }
- return false
+ return !!value?.endsWith('@')
},
options
})
diff --git a/src/code/tests/Code.spec.ts b/src/code/tests/Code.spec.tsx
similarity index 82%
rename from src/code/tests/Code.spec.ts
rename to src/code/tests/Code.spec.tsx
index ef30216a044..26a97c1e9a0 100644
--- a/src/code/tests/Code.spec.ts
+++ b/src/code/tests/Code.spec.tsx
@@ -1,3 +1,4 @@
+import { toRaw, h } from 'vue'
import { mount } from '@vue/test-utils'
import { NCode } from '../index'
import hljs from 'highlight.js/lib/core'
@@ -21,23 +22,19 @@ describe('n-code', () => {
wrapper.unmount()
})
it('should work with `language` prop', () => {
- const wrapper = mount(NCode, {
- props: {
- code: 'console.log(a)',
- language: 'javascript',
- hljs
- }
+ const wrapper = mount(() => {
+ return (
+
+ )
})
expect(wrapper.find('.hljs-variable').text()).toBe('console')
wrapper.unmount()
})
it('should work with `hljs` prop', () => {
- const wrapper = mount(NCode, {
- props: {
- code: 'console.log(a)',
- language: 'javascript',
- hljs
- }
+ const wrapper = mount(() => {
+ return (
+
+ )
})
expect(wrapper.find('.function_').text()).toBe('log')
wrapper.unmount()
diff --git a/src/form/src/Form.tsx b/src/form/src/Form.tsx
index 928b9a09424..a69e6c00791 100644
--- a/src/form/src/Form.tsx
+++ b/src/form/src/Form.tsx
@@ -124,6 +124,7 @@ export default defineComponent({
})
}
if (formInvalid) {
+ // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
reject(errors.length ? errors : undefined)
} else {
resolve({
diff --git a/src/form/src/FormItem.tsx b/src/form/src/FormItem.tsx
index 5f5ee5b7e34..56aef2cc9b8 100644
--- a/src/form/src/FormItem.tsx
+++ b/src/form/src/FormItem.tsx
@@ -266,6 +266,7 @@ export default defineComponent({
if (validateCallback) {
validateCallback(errors, { warnings })
}
+ // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
reject(errors)
}
})