Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Aug 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions src/pages/list/card/components/DialogForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,20 @@
</template>

<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';

const INITIAL_DATA = {
export interface FormData {
name: string;
status: string;
description: string;
type: string;
mark: string;
amount: number;
}

const INITIAL_DATA: FormData = {
name: '',
status: '',
description: '',
Expand All @@ -58,19 +68,13 @@ const props = defineProps({
type: Boolean,
default: false,
},
data: {
type: Object,
default: () => {
return {};
},
},
data: Object as PropType<FormData>,
});

const formVisible = ref(false);
const formData = ref();
const formData = ref({ ...INITIAL_DATA });
const textareaValue = ref('');

const onSubmit = ({ validateResult, firstError }: SubmitContext<Data>) => {
const onSubmit = ({ validateResult, firstError }: SubmitContext<FormData>) => {
if (!firstError) {
MessagePlugin.success('提交成功');
formVisible.value = false;
Expand Down Expand Up @@ -107,7 +111,7 @@ watch(
},
);

const rules: Record<string, FormRule[]> = {
const rules: FormRules<FormData> = {
name: [{ required: true, message: '请输入产品名称', type: 'error' }],
};
</script>
15 changes: 3 additions & 12 deletions src/pages/list/card/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,14 @@ import { getCardList } from '@/api/list';
import type { CardProductType } 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';

interface FormData {
name: string;
status: string;
description: string;
type: number;
mark: string;
amount: number;
[key: string]: unknown;
}

const INITIAL_DATA: FormData = {
name: '',
status: '',
description: '',
type: 0,
type: '0',
mark: '',
amount: 0,
};
Expand Down Expand Up @@ -158,7 +149,7 @@ const handleManageProduct = (product: CardProductType) => {
name: product.name,
status: product?.isSetup ? '1' : '0',
description: product.description,
type: product.type,
type: product.type.toString(),
mark: '',
amount: 0,
};
Expand Down
1 change: 0 additions & 1 deletion src/style/index.less
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
@import './font-family.less';

@import './reset.less';
2 changes: 1 addition & 1 deletion src/style/layout.less
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
}

.t-menu--dark .t-menu__operations .t-icon {
color: rgba(255, 255, 255, 55%);
color: rgb(255 255 255 / 55%);

&:hover {
cursor: pointer;
Expand Down
25 changes: 3 additions & 22 deletions stylelint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,11 @@ module.exports = {
defaultSeverity: 'error',
extends: ['stylelint-config-standard'],
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,
'selector-type-no-unknown': null,
'color-function-notation': 'legacy',
'value-keyword-case': null,
'property-no-unknown': [true, { checkPrefixed: true }],
'import-notation': 'string',
'no-empty-source': null,
'custom-property-pattern': null,
'selector-class-pattern': null,
'selector-pseudo-class-no-unknown': [
true,
{
Expand Down