frat: add lint for scoped-css (#138)

This commit is contained in:
Kerwin Bryant 2022-04-30 23:16:41 +08:00 committed by GitHub
parent 01305b6853
commit 0fc86fcd76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 82 additions and 49 deletions

View File

@ -3,6 +3,7 @@
"plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended",
"eslint-config-airbnb-base", "eslint-config-airbnb-base",
"plugin:vue/vue3-recommended", "plugin:vue/vue3-recommended",
"plugin:vue-scoped-css/base",
"plugin:prettier/recommended" "plugin:prettier/recommended"
], ],
"env": { "env": {
@ -53,7 +54,8 @@
"vue/require-default-prop": 0, "vue/require-default-prop": 0,
"vue/multi-word-component-names": 0, "vue/multi-word-component-names": 0,
"vue/no-reserved-props": 0, "vue/no-reserved-props": 0,
"vue/no-v-html": 0 "vue/no-v-html": 0,
"vue-scoped-css/enforce-style-type": ["error", { "allows": ["scoped"] }]
} }
} }
] ]

View File

@ -49,6 +49,7 @@
"eslint-plugin-import": "^2.24.2", "eslint-plugin-import": "^2.24.2",
"eslint-plugin-prettier": "^4.0.0", "eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^7.16.0", "eslint-plugin-vue": "^7.16.0",
"eslint-plugin-vue-scoped-css": "^2.2.0",
"husky": "^7.0.4", "husky": "^7.0.4",
"less": "^4.1.1", "less": "^4.1.1",
"lint-staged": "^12.1.2", "lint-staged": "^12.1.2",

View File

@ -16,7 +16,7 @@ onMounted(() => {
store.updateConfig({ ...config }); store.updateConfig({ ...config });
}); });
</script> </script>
<style lang="less"> <style lang="less" scoped>
@import '@/style/variables.less'; @import '@/style/variables.less';
#nprogress .bar { #nprogress .bar {

View File

@ -3,7 +3,7 @@
<router-view /> <router-view />
</div> </div>
</template> </template>
<style lang="less"> <style lang="less" scoped>
.tdesign-wrapper { .tdesign-wrapper {
height: 100vh; height: 100vh;
display: flex; display: flex;

View File

@ -154,7 +154,7 @@ const navToHelper = () => {
window.open('http://tdesign.tencent.com/starter/docs/get-started'); window.open('http://tdesign.tencent.com/starter/docs/get-started');
}; };
</script> </script>
<style lang="less"> <style lang="less" scoped>
@import '@/style/variables.less'; @import '@/style/variables.less';
.@{prefix}-header { .@{prefix}-header {
&-layout { &-layout {
@ -188,7 +188,7 @@ const navToHelper = () => {
flex: 1 1 1; flex: 1 1 1;
display: inline-flex; display: inline-flex;
.t-menu__item { :deep(.t-menu__item) {
min-width: unset; min-width: unset;
padding: 0px 16px; padding: 0px 16px;
} }
@ -261,7 +261,7 @@ const navToHelper = () => {
} }
} }
.t-head-menu__inner { :deep(.t-head-menu__inner) {
border-bottom: 1px solid @border-level-1-color; border-bottom: 1px solid @border-level-1-color;
} }
@ -294,7 +294,7 @@ const navToHelper = () => {
margin-right: 8px; margin-right: 8px;
} }
.t-dropdown__item { :deep(.t-dropdown__item) {
.t-dropdown__item__content { .t-dropdown__item__content {
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -306,12 +306,12 @@ const navToHelper = () => {
} }
} }
.t-dropdown__item { :deep(.t-dropdown__item) {
width: 100%; width: 100%;
margin-bottom: 0px; margin-bottom: 0px;
} }
&:last-child { &:last-child {
.t-dropdown__item { :deep(.t-dropdown__item) {
margin-bottom: 8px; margin-bottom: 8px;
} }
} }

View File

@ -192,4 +192,15 @@ const goDetail = () => {
} }
} }
} }
.t-button {
margin: 0 8px;
.t-icon {
font-size: 20px;
&.general {
margin-right: 16px;
}
}
}
</style> </style>

View File

@ -1,7 +1,7 @@
<template> <template>
<div v-if="layout === 'side'" class="header-menu-search"> <div v-if="layout === 'side'" class="header-menu-search">
<t-input <t-input
:class="{ 'hover-active': isSearchFocus }" :class="['header-search', { 'hover-active': isSearchFocus }]"
placeholder="请输入搜索内容" placeholder="请输入搜索内容"
@blur="changeSearchFocus(false)" @blur="changeSearchFocus(false)"
@focus="changeSearchFocus(true)" @focus="changeSearchFocus(true)"
@ -52,7 +52,7 @@ const changeSearchFocus = (value: boolean) => {
isSearchFocus.value = value; isSearchFocus.value = value;
}; };
</script> </script>
<style lang="less"> <style lang="less" scoped>
@import '@/style/variables.less'; @import '@/style/variables.less';
.header-menu-search { .header-menu-search {
@ -71,42 +71,38 @@ const changeSearchFocus = (value: boolean) => {
font-size: 20px !important; font-size: 20px !important;
color: @text-color-primary !important; color: @text-color-primary !important;
} }
.t-input { .header-search {
border: none; :deep(.t-input) {
outline: none; border: none;
box-shadow: none; outline: none;
transition: background @anim-duration-base linear; box-shadow: none;
.t-input__inner {
transition: background @anim-duration-base linear; transition: background @anim-duration-base linear;
}
.t-input__inner {
background: none;
}
&:hover {
background: @bg-color-secondarycontainer;
.t-input__inner { .t-input__inner {
transition: background @anim-duration-base linear;
}
.t-input__inner {
background: none;
}
&:hover {
background: @bg-color-secondarycontainer; background: @bg-color-secondarycontainer;
.t-input__inner {
background: @bg-color-secondarycontainer;
}
} }
} }
} }
} }
.header-search { .t-button {
width: 200px; margin: 0 8px;
transition: width @anim-duration-base @anim-time-fn-easing; transition: opacity @anim-duration-base @anim-time-fn-easing;
.t-input {
border: 0; .t-icon {
&:focus { font-size: 20px;
box-shadow: none; &.general {
margin-right: 16px;
} }
} }
&.width-zero {
width: 0;
opacity: 0;
}
}
.t-button {
transition: opacity @anim-duration-base @anim-time-fn-easing;
} }
.search-icon-hide { .search-icon-hide {
opacity: 0; opacity: 0;
@ -114,5 +110,20 @@ const changeSearchFocus = (value: boolean) => {
.header-menu-search-left { .header-menu-search-left {
display: flex; display: flex;
align-items: center; align-items: center;
.header-search {
width: 200px;
transition: width @anim-duration-base @anim-time-fn-easing;
:deep(.t-input) {
border: 0;
&:focus {
box-shadow: none;
}
}
&.width-zero {
width: 0;
opacity: 0;
}
}
} }
</style> </style>

View File

@ -201,7 +201,7 @@ watchEffect(() => {
settingStore.updateConfig(formData.value); settingStore.updateConfig(formData.value);
}); });
</script> </script>
<style lang="less"> <style lang="less" scoped>
@import '@/style/variables'; @import '@/style/variables';
.tdesign-setting { .tdesign-setting {
@ -288,7 +288,7 @@ watchEffect(() => {
.setting-container { .setting-container {
padding-bottom: 100px; padding-bottom: 100px;
} }
.t-radio-group.t-size-m { :deep(.t-radio-group.t-size-m) {
min-height: 32px; min-height: 32px;
width: 100%; width: 100%;
height: auto; height: auto;
@ -302,7 +302,7 @@ watchEffect(() => {
align-items: center; align-items: center;
margin-bottom: 16px; margin-bottom: 16px;
.t-radio-button { :deep(.t-radio-button) {
display: inline-flex; display: inline-flex;
max-height: 78px; max-height: 78px;
padding: 8px; padding: 8px;
@ -313,22 +313,22 @@ watchEffect(() => {
} }
} }
.t-is-checked { :deep(.t-is-checked) {
border: 2px solid @brand-color !important; border: 2px solid @brand-color !important;
} }
.t-form__controls-content { :deep(.t-form__controls-content) {
justify-content: end; justify-content: end;
} }
} }
.t-form__controls-content { :deep(.t-form__controls-content) {
justify-content: end; justify-content: end;
} }
} }
.setting-route-theme { .setting-route-theme {
.t-form__label { :deep(.t-form__label) {
min-width: 310px !important; min-width: 310px !important;
color: @text-color-secondary; color: @text-color-secondary;
} }
@ -336,7 +336,7 @@ watchEffect(() => {
.setting-color-theme { .setting-color-theme {
.setting-layout-drawer { .setting-layout-drawer {
.t-radio-button { :deep(.t-radio-button) {
height: 32px; height: 32px;
} }

View File

@ -265,7 +265,7 @@ const getContainer = () => {
}; };
</script> </script>
<style lang="less"> <style lang="less" scoped>
@import '@/style/variables.less'; @import '@/style/variables.less';
.list-common-table { .list-common-table {
background-color: @bg-color-container; background-color: @bg-color-container;

View File

@ -124,3 +124,7 @@ const onSubmit = async ({ validateResult }) => {
} }
}; };
</script> </script>
<style lang="less" scoped>
@import url('../index.less');
</style>

View File

@ -120,3 +120,7 @@ const switchType = (val) => {
type.value = val; type.value = val;
}; };
</script> </script>
<style lang="less" scoped>
@import url('../index.less');
</style>

View File

@ -115,7 +115,7 @@
justify-content: space-between; justify-content: space-between;
} }
.t-checkbox__label { :deep(.t-checkbox__label) {
color: @text-color-secondary; color: @text-color-secondary;
} }
@ -132,7 +132,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
.t-form__controls { :deep(.t-form__controls) {
width: 100%; width: 100%;
button { button {

View File

@ -41,6 +41,6 @@ const switchType = (val: string) => {
}; };
</script> </script>
<style lang="less"> <style lang="less" scoped>
@import url('./index.less'); @import url('./index.less');
</style> </style>