feat(stylelint): 移除没用的规则 (#584)

* feat(stylelint): 移除没用的规则

* fix: types error
This commit is contained in:
liweijie0812 2023-08-05 16:57:30 +08:00 committed by GitHub
parent 6a4ffa9f4b
commit e98d1555d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 48 deletions

View File

@ -35,10 +35,20 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { Data, FormRule, MessagePlugin, SubmitContext } from 'tdesign-vue-next'; import { FormRules, MessagePlugin, SubmitContext } from 'tdesign-vue-next';
import type { PropType } from 'vue';
import { ref, watch } from 'vue'; import { ref, watch } from 'vue';
const INITIAL_DATA = { export interface FormData {
name: string;
status: string;
description: string;
type: string;
mark: string;
amount: number;
}
const INITIAL_DATA: FormData = {
name: '', name: '',
status: '', status: '',
description: '', description: '',
@ -58,19 +68,13 @@ const props = defineProps({
type: Boolean, type: Boolean,
default: false, default: false,
}, },
data: { data: Object as PropType<FormData>,
type: Object,
default: () => {
return {};
},
},
}); });
const formVisible = ref(false); const formVisible = ref(false);
const formData = ref(); const formData = ref({ ...INITIAL_DATA });
const textareaValue = ref(''); const textareaValue = ref('');
const onSubmit = ({ validateResult, firstError }: SubmitContext<Data>) => { const onSubmit = ({ validateResult, firstError }: SubmitContext<FormData>) => {
if (!firstError) { if (!firstError) {
MessagePlugin.success('提交成功'); MessagePlugin.success('提交成功');
formVisible.value = false; formVisible.value = false;
@ -107,7 +111,7 @@ watch(
}, },
); );
const rules: Record<string, FormRule[]> = { const rules: FormRules<FormData> = {
name: [{ required: true, message: '请输入产品名称', type: 'error' }], name: [{ required: true, message: '请输入产品名称', type: 'error' }],
}; };
</script> </script>

View File

@ -76,23 +76,14 @@ import { getCardList } from '@/api/list';
import type { CardProductType } from '@/components/product-card/index.vue'; import type { CardProductType } from '@/components/product-card/index.vue';
import ProductCard from '@/components/product-card/index.vue'; import ProductCard from '@/components/product-card/index.vue';
import type { FormData } from './components/DialogForm.vue';
import DialogForm from './components/DialogForm.vue'; import DialogForm from './components/DialogForm.vue';
interface FormData {
name: string;
status: string;
description: string;
type: number;
mark: string;
amount: number;
[key: string]: unknown;
}
const INITIAL_DATA: FormData = { const INITIAL_DATA: FormData = {
name: '', name: '',
status: '', status: '',
description: '', description: '',
type: 0, type: '0',
mark: '', mark: '',
amount: 0, amount: 0,
}; };
@ -158,7 +149,7 @@ const handleManageProduct = (product: CardProductType) => {
name: product.name, name: product.name,
status: product?.isSetup ? '1' : '0', status: product?.isSetup ? '1' : '0',
description: product.description, description: product.description,
type: product.type, type: product.type.toString(),
mark: '', mark: '',
amount: 0, amount: 0,
}; };

View File

@ -1,3 +1,2 @@
@import './font-family.less'; @import './font-family.less';
@import './reset.less'; @import './reset.less';

View File

@ -45,7 +45,7 @@
} }
.t-menu--dark .t-menu__operations .t-icon { .t-menu--dark .t-menu__operations .t-icon {
color: rgba(255, 255, 255, 55%); color: rgb(255 255 255 / 55%);
&:hover { &:hover {
cursor: pointer; cursor: pointer;

View File

@ -2,30 +2,11 @@ module.exports = {
defaultSeverity: 'error', defaultSeverity: 'error',
extends: ['stylelint-config-standard'], extends: ['stylelint-config-standard'],
rules: { rules: {
'no-duplicate-selectors': null,
'block-no-empty': null,
'selector-class-pattern': null,
'declaration-block-no-redundant-longhand-properties': [true, { ignoreShorthands: ['/flex/'] }],
'custom-property-pattern': null,
'keyframes-name-pattern': null,
'no-empty-source': null,
'font-family-no-missing-generic-family-keyword': [
true,
{
ignoreFontFamilies: ['PingFangSC-Regular', 'PingFangSC-Medium', 't'],
},
],
'unit-no-unknown': [true, { ignoreUnits: ['rpx'] }],
'function-url-quotes': null,
'max-line-length': null,
'at-rule-empty-line-before': ['always', { ignore: ['after-comment'] }],
'declaration-colon-newline-after': null,
'no-descending-specificity': null, 'no-descending-specificity': null,
'selector-type-no-unknown': null,
'color-function-notation': 'legacy',
'value-keyword-case': null,
'property-no-unknown': [true, { checkPrefixed: true }],
'import-notation': 'string', 'import-notation': 'string',
'no-empty-source': null,
'custom-property-pattern': null,
'selector-class-pattern': null,
'selector-pseudo-class-no-unknown': [ 'selector-pseudo-class-no-unknown': [
true, true,
{ {