Skip to content

Commit 027ee20

Browse files
committed
style: code linting
1 parent e9de922 commit 027ee20

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1118
-928
lines changed

error.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
NotFound
33
</template>
44

5-
<script>
5+
<script lang="ts">
66
import NotFound from '@/components/shared/NotFound.vue';
77
88
export default {

eslint.config.mjs

+19-3
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ export default tseslint.config(
99
...pluginVue.configs["flat/essential"],
1010
...vueTsEslintConfig(),
1111
{
12-
files: [ 'src/**/*.{ts,tsx,vue}', 'test/**/*.{ts,tsx}' ],
1312
...configs[configs.length - 2],
13+
files: [ 'src/**/*.{ts,tsx,vue,mjs}', 'test/**/*.{ts,tsx}' ],
1414
},
1515
{
16+
files: ['**/*.{js,mjs}'],
1617
rules: {
17-
'@stylistic/indent': [ 'error', 2 ],
18+
'@stylistic/indent': ['error', 2],
1819
}
1920
},
2021
{
@@ -24,7 +25,22 @@ export default tseslint.config(
2425
parser: tsParser,
2526
project: 'tsconfig.json',
2627
extraFileExtensions: ['.vue']
27-
},
28+
}
29+
},
30+
rules: {
31+
'vue/multi-word-component-names': 'off',
32+
33+
}
34+
},
35+
{
36+
files: ['**/*.js', '**/*.vue'],
37+
rules: {
38+
'vue/multi-word-component-names': 'off',
39+
'vue/no-reserved-component-names': 'off',
40+
'@typescript-eslint/naming-convention': 'off',
41+
'@typescript-eslint/unbound-method': 'off',
42+
'@typescript-eslint/restrict-template-expressions': 'off',
43+
'@typescript-eslint/restrict-plus-operands': 'off',
2844
}
2945
}
3046
)

src/components/Content.vue

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ IViewContent.content
33
slot
44
</template>
55

6-
<script>
7-
import { Content as IViewContent } from 'view-ui-plus-es';
6+
<script lang="ts">
7+
import { Content as IViewContent } from 'view-ui-plus-es'
88
99
export default {
1010
components: {
11-
IViewContent,
12-
},
13-
};
11+
IViewContent
12+
}
13+
}
1414
</script>
1515

1616
<style lang="sass" scoped>

src/components/ExamplesNav.vue

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ Nav(:list="navigation.children" :active="$route.path")
66
ProTag(v-if="data.pro")
77
</template>
88

9-
<script>
10-
import ProTag from './shared/ProTag.vue';
9+
<script lang="ts">
10+
import ProTag from './shared/ProTag.vue'
1111
1212
export default {
1313
props: ['navigation'],
1414
components: {
15-
ProTag,
16-
},
17-
};
15+
ProTag
16+
}
17+
}
1818
</script>
1919

2020
<style lang="sass" scoped>

src/components/FetchNav.vue

+7-8
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,17 @@ ContentNavigation(v-slot="{ navigation }")
33
slot(:navigation="resolveNavigation(navigation, 'docs')")
44
</template>
55

6-
<script>
7-
/* eslint-disable no-underscore-dangle */
6+
<script lang="ts">
87
98
export default {
109
props: ['target'],
1110
methods: {
1211
resolveNavigation(navigation) {
13-
const localeContent = navigation.find((n) => n._path === `/${this.$i18n.locale}`);
14-
const targetContent = localeContent.children.find((n) => n._path === `/${this.$i18n.locale}/${this.target}`);
12+
const localeContent = navigation.find(n => n._path === `/${this.$i18n.locale}`)
13+
const targetContent = localeContent.children.find(n => n._path === `/${this.$i18n.locale}/${this.target}`)
1514
16-
return targetContent;
17-
},
18-
},
19-
};
15+
return targetContent
16+
}
17+
}
18+
}
2019
</script>

src/components/Footer.vue

+9-8
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,24 @@ IViewFooter.footer
77
div Copyright © {{releaseYear}}-{{year}} {{author}}
88
</template>
99

10-
<script>
11-
import { Footer as IViewFooter } from 'view-ui-plus-es';
12-
import { license, author, release as releaseYear } from '@/consts/product.json';
10+
<script lang="ts">
11+
import { Footer as IViewFooter } from 'view-ui-plus-es'
12+
13+
import { author, license, release as releaseYear } from '@/consts/product.json'
1314
1415
export default {
1516
data() {
1617
return {
1718
license,
1819
author,
1920
releaseYear,
20-
year: new Date().getFullYear(),
21-
};
21+
year: new Date().getFullYear()
22+
}
2223
},
2324
components: {
24-
IViewFooter,
25-
},
26-
};
25+
IViewFooter
26+
}
27+
}
2728
</script>
2829

2930
<style lang="sass" scoped>

src/components/Header.vue

+23-21
Original file line numberDiff line numberDiff line change
@@ -24,43 +24,45 @@
2424
Links.links
2525
</template>
2626

27-
<script>
28-
import { defineComponent, ref, onMounted } from 'vue';
29-
import { useDrawer } from '../shared/drawer';
30-
import Logo from './Logo.vue';
31-
import Language from './Language.vue';
32-
import MenuItems from './MenuItems.vue';
33-
import Links from './Links.vue';
34-
import Search from './Search.vue';
35-
import Drawer from './shared/Drawer.vue';
27+
<script lang="ts">
28+
import { defineComponent, onMounted, ref } from 'vue'
29+
30+
import { useDrawer } from '../shared/drawer'
31+
import Language from './Language.vue'
32+
import Links from './Links.vue'
33+
import Logo from './Logo.vue'
34+
import MenuItems from './MenuItems.vue'
35+
import Search from './Search.vue'
36+
import Drawer from './shared/Drawer.vue'
3637
3738
export default defineComponent({
3839
setup() {
39-
const element = ref(null);
40-
const drawer = useDrawer();
40+
const element = ref(null)
41+
const drawer = useDrawer()
4142
4243
onMounted(() => {
4344
window.addEventListener('scroll', () => {
44-
if (!element.value) return;
45+
if (!element.value) return
46+
47+
const { bottom } = element.value.getBoundingClientRect()
4548
46-
const { bottom } = element.value.getBoundingClientRect();
47-
document.body.style.setProperty('--header-offset', `${bottom}px`);
48-
}, false);
49-
});
49+
document.body.style.setProperty('--header-offset', `${bottom}px`)
50+
}, false)
51+
})
5052
return {
5153
element,
52-
drawer: drawer.active,
53-
};
54+
drawer: drawer.active
55+
}
5456
},
5557
components: {
5658
Logo,
5759
Language,
5860
MenuItems,
5961
Search,
6062
Drawer,
61-
Links,
62-
},
63-
});
63+
Links
64+
}
65+
})
6466
</script>
6567

6668
<style lang="sass" scoped>

src/components/Intro.vue

+13-7
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,23 @@ Video(
88
</template>
99

1010
<script lang="ts" setup>
11-
import { computed } from 'vue';
12-
import Video from './shared/Video.vue';
13-
import media from '../consts/media.json';
11+
import { computed } from 'vue'
12+
13+
import media from '../consts/media.json'
14+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
15+
import Video from './shared/Video.vue'
1416
1517
const props = defineProps({
1618
show: Boolean,
1719
scroll: Boolean,
18-
autoplay: Boolean,
19-
});
20+
autoplay: Boolean
21+
})
22+
23+
const video = media.youtube.intro
2024
21-
const video = media.youtube.intro;
25+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
26+
const url = computed(() => `https://www.youtube.com/embed/${video.id}?${props.autoplay
27+
? 'autoplay=1'
28+
: ''}`)
2229
23-
const url = computed(() => `https://www.youtube.com/embed/${video.id}?${props.autoplay ? 'autoplay=1' : ''}`);
2430
</script>

src/components/Language.vue

+9-8
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,21 @@
1212
SsrSelect {{ $i18n.locale }}
1313
</template>
1414

15-
<script>
16-
import { defineComponent } from 'vue';
17-
import SsrSelect from './ssr/SsrSelect.vue';
15+
<script lang="ts">
16+
import { defineComponent } from 'vue'
17+
18+
import SsrSelect from './ssr/SsrSelect.vue'
1819
1920
export default defineComponent({
2021
methods: {
2122
setLocale(lang) {
22-
this.$router.push(this.switchLocalePath(lang));
23-
},
23+
this.$router.push(this.switchLocalePath(lang))
24+
}
2425
},
2526
components: {
26-
SsrSelect,
27-
},
28-
});
27+
SsrSelect
28+
}
29+
})
2930
</script>
3031

3132
<style lang="sass" scoped>

src/components/Links.vue

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@
66

77
</template>
88

9-
<script>
10-
import { social } from '@/consts/product.json';
9+
<script lang="ts">
10+
import { social } from '@/consts/product.json'
1111
1212
export default {
1313
data() {
1414
return {
15-
links: social,
16-
};
17-
},
18-
};
15+
links: social
16+
}
17+
}
18+
}
1919
</script>
2020

2121
<style lang="sass" scoped>

src/components/Logo.vue

+6-6
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,19 @@
7979
</svg>
8080
</template>
8181

82-
<script>
82+
<script lang="ts">
8383
export default {
8484
props: {
8585
hover: {
8686
type: Boolean,
87-
default: true,
87+
default: true
8888
},
8989
zoomIn: {
9090
type: Boolean,
91-
default: true,
92-
},
93-
},
94-
};
91+
default: true
92+
}
93+
}
94+
}
9595
</script>
9696

9797
<style scoped>

src/components/MenuItems.vue

+13-9
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,22 @@
1414
</style>
1515

1616
<script setup lang="ts">
17-
import { useRoute } from 'vue-router';
18-
import { useI18n } from 'vue-i18n';
19-
import { omitLocale } from '../shared/route';
17+
import { useI18n } from 'vue-i18n'
18+
import { useRoute } from 'vue-router'
2019
21-
const route = useRoute();
22-
const i18n = useI18n();
20+
import { omitLocale } from '../shared/route'
2321
22+
const route = useRoute()
23+
const i18n = useI18n()
24+
25+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2426
function activeClass(name: string) {
25-
return omitLocale(route.path, i18n.locale.value).startsWith(`/${name}`) ? {
26-
'ivu-menu-item-active': true,
27-
'ivu-menu-item-selected': true,
28-
} : {};
27+
return omitLocale(route.path, i18n.locale.value).startsWith(`/${name}`)
28+
? {
29+
'ivu-menu-item-active': true,
30+
'ivu-menu-item-selected': true
31+
}
32+
: {}
2933
}
3034
3135
</script>

0 commit comments

Comments
 (0)