Skip to content

Commit ed7c9e8

Browse files
committed
ditch pretties for stronger eslint. skin exceptions
1 parent 12cbc56 commit ed7c9e8

11 files changed

+139
-14
lines changed

.eslintrc.cjs

+34-3
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,45 @@ module.exports = {
77
'plugin:vue/vue3-essential',
88
'eslint:recommended',
99
'@vue/eslint-config-typescript',
10-
'@vue/eslint-config-prettier/skip-formatting',
11-
'prettier'
10+
'@vue/eslint-config-prettier/skip-formatting'
1211
],
1312
parserOptions: {
1413
ecmaVersion: 'latest'
1514
},
1615
rules: {
16+
'@typescript-eslint/type-annotation-spacing': 'error',
17+
'arrow-parens': ['error', 'always'],
18+
'arrow-spacing': ['error', {
19+
'before': true, 'after': true
20+
}],
21+
'comma-spacing': ['error', {
22+
'before': false, 'after': true
23+
}],
24+
'block-spacing': ['error', 'always'],
25+
'default-case': 'error',
26+
'default-case-last': 'error',
27+
'default-param-last': 'error',
28+
'eqeqeq': 'error',
29+
'func-call-spacing': ['error', 'never'],
30+
'indent': [ 'error', 2, {
31+
'SwitchCase': 1
32+
} ],
33+
'keyword-spacing': ['error', {
34+
'after': true, 'before': true,
35+
}],
36+
'no-trailing-spaces': 'error',
37+
'no-unreachable': 'error',
38+
'no-unreachable-loop': 'error',
39+
'no-unused-vars': 'error',
40+
'no-var': 'error',
41+
'object-curly-spacing': ['error', 'always'],
42+
'quotes': [ 'error', 'single' ],
43+
'semi': [ 'error', 'never' ],
44+
'space-infix-ops': 'error',
45+
'switch-colon-spacing': ['error', {
46+
'after': true, 'before': false
47+
}],
1748
'vue/multi-word-component-names': 'off',
18-
'prettier/prettier': ['error']
49+
'yoda': 'error',
1950
}
2051
}

.prettierrc.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
"trailingComma": "none",
66
"bracketSpacing": true,
77
"bracketSameLine": false,
8-
"arrowParens": "always"
8+
"arrowParens": "always",
9+
"printWidth": 999
910
}

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ Sure ! Fork the repository and fix a bug you've found, a bug someone else found,
1414
Make sure mobile display is good enough ( not asking for perfection ), grab width and conditions from other components to have the same workflow. To test it out run ```npm run serve``` and open a network url on your mobile device ( connected on the same wifi ! ) to instantly test out your modification on mobile.
1515

1616
## Pull Requests requirements
17-
Before asking any pull request, run ```npm run format``` and ```npm run lint```, fix all the warning and errors from eslint.
17+
Before asking any pull request, run ```npm run lint```, fix all the warning and errors from eslint.
1818
If your feature require to use files, especially spine assets, "si_" icons, "mi_" banners, or anything else, host them on [https://github.com/Nikke-db/Nikke-db.github.io](https://github.com/Nikke-db/Nikke-db.github.io) and make a Pull Request there as well.
1919

src/components/common/Spine/Loader.vue

+5-3
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ const spineLoader = () => {
4545
usedSpine = spine41
4646
break
4747
default:
48-
console.log('TBA ALERT MESSAGE')
48+
break
4949
}
5050
5151
spineCanvas = new usedSpine.SpinePlayer('player-container', {
5252
skelUrl: getPathing('skel'),
5353
atlasUrl: getPathing('atlas'),
5454
animation: getDefaultAnimation(),
55-
// skin: skin,
55+
skin: market.live2d.getSkin(),
5656
backgroundColor: '#00000000',
5757
alpha: true,
5858
mipmaps: market.live2d.current_pose === 'fb' ? true : false,
@@ -333,6 +333,8 @@ document.addEventListener('wheel', (e) => {
333333
? (transformScale = 0.02)
334334
: ''
335335
break
336+
default:
337+
break
336338
}
337339
338340
canvas.style.transform = 'scale(' + transformScale + ')'
@@ -343,7 +345,7 @@ document.addEventListener('wheel', (e) => {
343345
<style scoped lang="less">
344346
#player-container {
345347
// height: calc(100vh - 100px);
346-
// overflow:hidden
348+
overflow:hidden
347349
}
348350
.mobile {
349351
height: -webkit-fill-available;

src/components/common/Spine/ToolList.vue

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
<Screenshot />
2525
<ChangeScreenshotSize />
2626
</div>
27+
<div>
28+
<CustomLoader />
29+
</div>
2730
</n-card>
2831
</n-scrollbar>
2932
</div>
@@ -37,6 +40,7 @@ import BackgroundColor from './Tools/BackgroundColor.vue'
3740
import BackgroundImage from './Tools/BackgroundImage.vue'
3841
import Screenshot from './Tools/Screenshot.vue'
3942
import ChangeScreenshotSize from './Tools/ChangeScreenshotSize.vue'
43+
import CustomLoader from './Tools/CustomLoader.vue'
4044
</script>
4145

4246
<style scoped lang="less">

src/components/common/Spine/Tools/ChangeScreenshotSize.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<template>
22
<span>
33
<n-button ghost type="info" round @click="openScSzModal()">
4-
Screenshot <br />options
4+
Screenshot <br />
5+
Options
56
</n-button>
67

78
<n-modal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<template>
2+
<n-button ghost type="error" round @click="customLoader()">
3+
Custom Spine<br />
4+
Loader
5+
</n-button>
6+
</template>
7+
8+
<script setup lang="ts">
9+
import {
10+
useMarket
11+
} from '@/stores/market'
12+
13+
const market = useMarket()
14+
15+
const customLoader = () => {
16+
market.message.getMessage().error('(FEATURE TO BE ADDED)')
17+
}
18+
</script>
19+
20+
<style scoped lang="less">
21+
.n-button {
22+
width: 100%;
23+
height: 40px;
24+
}
25+
</style>

src/components/common/Spine/Tools/PoseSelector.vue

+6-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ const market = useMarket()
2323
const poses = [
2424
{
2525
value: 'aim',
26-
label: h('div', {}, [
26+
label: h('div', {
27+
}, [
2728
h(NIcon, {
2829
component: AimOutlined,
2930
size: 18,
@@ -34,7 +35,8 @@ const poses = [
3435
},
3536
{
3637
value: 'cover',
37-
label: h('div', {}, [
38+
label: h('div', {
39+
}, [
3840
h(NIcon, {
3941
component: ManageProtection,
4042
size: 18,
@@ -45,7 +47,8 @@ const poses = [
4547
},
4648
{
4749
value: 'fb',
48-
label: h('div', {}, [
50+
label: h('div', {
51+
}, [
4952
h(NIcon, {
5053
component: AccessibilityTwotone,
5154
size: 18,

src/components/common/Spine/WrapperMobile.vue

+2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ watch(showHeaderBool, () => {
9595
case false:
9696
market.globalParams.hideMobileHeader()
9797
break
98+
default:
99+
break
98100
}
99101
})
100102
</script>

src/stores/live2dStore.ts

+56-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,60 @@ export const useLive2dStore = defineStore('live2d', () => {
4848
screenshot.value = new Date().getTime()
4949
}
5050

51+
const getSkin = () => {
52+
let skin = ''
53+
switch (current_pose.value) {
54+
case 'aim':
55+
skin = getSkinAim()
56+
break
57+
case 'cover':
58+
skin = getSkinCover()
59+
break
60+
default:
61+
skin = getSkinFb()
62+
break
63+
}
64+
65+
if (current_id.value === 'c010_01' || current_id.value === 'c907_01' ) {
66+
skin = '00'
67+
}
68+
69+
return skin
70+
}
71+
72+
const getSkinAim = () => {
73+
return 'default'
74+
}
75+
76+
const getSkinCover = () => {
77+
switch (current_id.value) {
78+
case 'c220':
79+
return 'weapon_1'
80+
default:
81+
return 'default'
82+
}
83+
}
84+
85+
const getSkinFb = () => {
86+
switch (current_id.value) {
87+
case 'c220':
88+
case 'c102':
89+
case 'c940':
90+
case 'c101_01':
91+
case 'c350':
92+
case 'c810':
93+
case 'c810_01':
94+
case 'c321':
95+
return 'acc'
96+
case 'c351':
97+
case 'c070_02':
98+
case 'c810_02':
99+
return 'bg'
100+
default:
101+
return 'default'
102+
}
103+
}
104+
51105
return {
52106
filtered_l2d_Array,
53107
current_id,
@@ -58,6 +112,7 @@ export const useLive2dStore = defineStore('live2d', () => {
58112
resetPlacement,
59113
triggerResetPlacement,
60114
screenshot,
61-
triggerScreenshot
115+
triggerScreenshot,
116+
getSkin
62117
}
63118
})

src/utils/enum/globalParams.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable */
12
enum globalParams {
23
GITHUB = 'https://github.com/Nikke-db/nikke-db-vue',
34
NIKKE_DB = 'https://nikke-db.pages.dev/',
@@ -14,7 +15,7 @@ enum messagesEnum {
1415
MESSAGE_LOCALSTORAGE_SAVED = 'Data saved to the local storage',
1516
MESSAGE_CANCELLED = 'Action Cancelled',
1617
MESSAGE_CANNOT_SAVE_EMPTY = 'Cannot save an empty value',
17-
MESSAGE_WRONG_FORM_DATA = "Something is wrong with the form data you've entered",
18+
MESSAGE_WRONG_FORM_DATA = 'Something is wrong with the form data you\'ve entered',
1819
MESSAGE_PROCESSING = 'Processing'
1920
}
2021

0 commit comments

Comments
 (0)