Skip to content

Commit b4020a3

Browse files
committed
fix(lint): enable Vue strictTypeChecked and fix config
1 parent 2990944 commit b4020a3

16 files changed

Lines changed: 200 additions & 182 deletions

‎cspell.config.yaml‎

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
version: '0.2'
2+
words:
3+
- DECI
4+
- CENTI
5+
- MILLI
6+
- MILLIWATT
7+
- Benoit
8+
- catppuccin
9+
- chargingstations
10+
- ctrlr
11+
- csms
12+
- idtag
13+
- idtags
14+
- iccid
15+
- imsi
16+
- ocpp
17+
- onconnection
18+
- opencode
19+
- evse
20+
- evses
21+
- kvar
22+
- kvarh
23+
- varh
24+
- rfid
25+
- workerset
26+
- worktree
27+
- dedup
28+
- unpushed
29+
- logform
30+
- mnemonist
31+
- poolifier
32+
- measurand
33+
- measurands
34+
- mikro
35+
- neostandard
36+
- recurrency
37+
- shutdowning
38+
- VCAP
39+
- workerd
40+
- yxxx
41+
- cppwm
42+
- heartbeatinterval
43+
- HEARTBEATINTERVAL
44+
- websocketpinginterval
45+
- WEBSOCKETPINGINTERVAL
46+
- connectionurl
47+
- CONNECTIONURL
48+
- chargingstation
49+
- CHARGINGSTATION
50+
- authctrlr
51+
- AUTHCTRLR
52+
- recloser
53+
- deauthorize
54+
- Deauth
55+
- DEAUTHORIZE
56+
- deauthorized
57+
- DEAUTHORIZED
58+
- Deauthorization
59+
- Selftest
60+
- SECC
61+
- Secc
62+
- Overcurrent
63+
- ocsp
64+
- OCSP
65+
- EMAID
66+
- emaid
67+
- IDTOKEN
68+
- idtoken
69+
- issuerkeyhash
70+
- issuernamehash
71+
- SRPC
72+
- CALLRESULT
73+
- CALLERROR
74+
- CALLRESULTERROR
75+
- reservability
76+
- PPTP
77+
- UIMCP
78+
- Streamable
79+
- modelcontextprotocol
80+
- OCMF
81+
- ocmf
82+
- secp
83+
- brainpool
84+
- Eichrecht
85+
- eichrecht
86+
- signingmethod
87+
- SIGNINGMETHOD
88+
- encodingmethod
89+
- ENCODINGMETHOD
90+
- signedmeterdata
91+
- SIGNEDMETERDATA
92+
- fiscalmetering
93+
- FISCALMETERING
94+
- publickeywithsignedmetervalue
95+
- PUBLICKEYWITHSIGNEDMETERVALUE
96+
- sampleddatasignreadings
97+
- SAMPLEDDATASIGNREADINGS
98+
- focusables
99+
- Focusables
100+
- secret

‎eslint.config.js‎

Lines changed: 48 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -6,129 +6,23 @@ import perfectionist from 'eslint-plugin-perfectionist'
66
import pluginVue from 'eslint-plugin-vue'
77
import { defineConfig } from 'eslint/config'
88
import neostandard, { plugins } from 'neostandard'
9+
import vueParser from 'vue-eslint-parser'
10+
11+
const GLOB_TS = ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts']
12+
const GLOB_TS_VUE = [...GLOB_TS, '**/*.vue']
13+
const GLOB_JS = ['**/*.js', '**/*.mjs', '**/*.cjs']
914

1015
export default defineConfig([
1116
{
1217
ignores: ['**/dist/**'],
1318
},
19+
20+
// Base configs
21+
1422
cspellConfigs.recommended,
1523
{
1624
rules: {
17-
'@cspell/spellchecker': [
18-
'warn',
19-
{
20-
autoFix: true,
21-
cspell: {
22-
words: [
23-
'DECI',
24-
'CENTI',
25-
'MILLI',
26-
'MILLIWATT',
27-
'Benoit',
28-
'catppuccin',
29-
'chargingstations',
30-
'ctrlr',
31-
'csms',
32-
'idtag',
33-
'idtags',
34-
'iccid',
35-
'imsi',
36-
'ocpp',
37-
'onconnection',
38-
'opencode',
39-
'evse',
40-
'evses',
41-
'kvar',
42-
'kvarh',
43-
'varh',
44-
'rfid',
45-
'workerset',
46-
'worktree',
47-
'dedup',
48-
'unpushed',
49-
'logform',
50-
'mnemonist',
51-
'poolifier',
52-
'measurand',
53-
'measurands',
54-
'mikro',
55-
'neostandard',
56-
'recurrency',
57-
'shutdowning',
58-
'VCAP',
59-
'workerd',
60-
'yxxx',
61-
// OCPP 2.0.x domain terms
62-
'cppwm',
63-
'heartbeatinterval',
64-
'HEARTBEATINTERVAL',
65-
'websocketpinginterval',
66-
'WEBSOCKETPINGINTERVAL',
67-
'connectionurl',
68-
'CONNECTIONURL',
69-
'chargingstation',
70-
'CHARGINGSTATION',
71-
'authctrlr',
72-
'AUTHCTRLR',
73-
'recloser',
74-
'deauthorize',
75-
'Deauth',
76-
'DEAUTHORIZE',
77-
'deauthorized',
78-
'DEAUTHORIZED',
79-
'Deauthorization',
80-
'Selftest',
81-
'SECC',
82-
'Secc',
83-
'Overcurrent',
84-
'ocsp',
85-
'OCSP',
86-
'EMAID',
87-
'emaid',
88-
'IDTOKEN',
89-
'idtoken',
90-
'issuerkeyhash',
91-
'issuernamehash',
92-
// OCPP SRPC
93-
'SRPC',
94-
'CALLRESULT',
95-
'CALLERROR',
96-
'CALLRESULTERROR',
97-
'reservability',
98-
// VPN protocol acronyms
99-
'PPTP',
100-
// UI server protocol acronyms
101-
'UIMCP',
102-
'Streamable',
103-
'modelcontextprotocol',
104-
// Signed meter values
105-
'OCMF',
106-
'ocmf',
107-
'secp',
108-
'brainpool',
109-
'Eichrecht',
110-
'eichrecht',
111-
'signingmethod',
112-
'SIGNINGMETHOD',
113-
'encodingmethod',
114-
'ENCODINGMETHOD',
115-
'signedmeterdata',
116-
'SIGNEDMETERDATA',
117-
'fiscalmetering',
118-
'FISCALMETERING',
119-
'publickeywithsignedmetervalue',
120-
'PUBLICKEYWITHSIGNEDMETERVALUE',
121-
'sampleddatasignreadings',
122-
'SAMPLEDDATASIGNREADINGS',
123-
// UI component terms
124-
'focusables',
125-
'Focusables',
126-
// Test credential fragments
127-
'secret',
128-
],
129-
},
130-
},
131-
],
25+
'@cspell/spellchecker': ['warn', { autoFix: true }],
13226
},
13327
},
13428
js.configs.recommended,
@@ -146,27 +40,27 @@ export default defineConfig([
14640
],
14741
},
14842
},
43+
44+
// neostandard
45+
46+
...neostandard({ ts: true }),
47+
48+
// Vue
49+
14950
...pluginVue.configs['flat/recommended'],
150-
{
151-
files: ['**/*.vue'],
152-
languageOptions: {
153-
globals: {
154-
localStorage: 'readonly',
155-
},
156-
parserOptions: {
157-
parser: '@typescript-eslint/parser',
158-
},
159-
},
160-
},
51+
52+
// TypeScript
53+
16154
...plugins['typescript-eslint'].config(
16255
{
16356
extends: [
16457
...plugins['typescript-eslint'].configs.strictTypeChecked,
16558
...plugins['typescript-eslint'].configs.stylisticTypeChecked,
16659
],
167-
files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts', '*/**.vue'],
60+
files: GLOB_TS_VUE,
16861
languageOptions: {
16962
parserOptions: {
63+
extraFileExtensions: ['.vue'],
17064
projectService: true,
17165
// eslint-disable-next-line n/no-unsupported-features/node-builtins
17266
tsconfigRootDir: import.meta.dirname,
@@ -186,22 +80,44 @@ export default defineConfig([
18680
},
18781
},
18882
{
189-
files: ['**/*.js', '**/*.mjs', '**/*.cjs'],
83+
files: GLOB_JS,
19084
...plugins['typescript-eslint'].configs.disableTypeChecked,
19185
}
19286
),
87+
88+
// Vue parser restoration
89+
90+
{
91+
files: ['**/*.vue'],
92+
languageOptions: {
93+
globals: {
94+
localStorage: 'readonly',
95+
},
96+
parser: vueParser,
97+
parserOptions: {
98+
extraFileExtensions: ['.vue'],
99+
parser: plugins['typescript-eslint'].parser,
100+
projectService: true,
101+
// eslint-disable-next-line n/no-unsupported-features/node-builtins
102+
tsconfigRootDir: import.meta.dirname,
103+
},
104+
},
105+
},
106+
107+
// Perfectionist
108+
193109
perfectionist.configs['recommended-natural'],
194110
{
195111
files: ['**/*.vue'],
196112
rules: {
197113
'perfectionist/sort-vue-attributes': 'off',
198114
},
199115
},
200-
...neostandard({
201-
ts: true,
202-
}),
116+
117+
// Rule overrides
118+
203119
{
204-
files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts', '**/*.vue'],
120+
files: GLOB_TS_VUE,
205121
rules: {
206122
'@typescript-eslint/no-unused-vars': [
207123
'error',

‎ui/web/src/App.vue‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</template>
2222

2323
<script setup lang="ts">
24-
import { computed, defineAsyncComponent, markRaw, watch } from 'vue'
24+
import { type Component, computed, defineAsyncComponent, markRaw, watch } from 'vue'
2525
2626
import { ASYNC_COMPONENT_DELAY_MS, ASYNC_COMPONENT_TIMEOUT_MS } from '@/core/index.js'
2727
import SkinLoadError from '@/shared/components/SkinLoadError.vue'
@@ -43,9 +43,9 @@ const skinLayoutMap = new Map(
4343
markRaw(
4444
defineAsyncComponent({
4545
delay: ASYNC_COMPONENT_DELAY_MS,
46-
errorComponent: SkinLoadError,
46+
errorComponent: SkinLoadError as Component,
4747
loader: () => s.loadLayout(),
48-
loadingComponent: SkinLoading,
48+
loadingComponent: SkinLoading as Component,
4949
timeout: ASYNC_COMPONENT_TIMEOUT_MS,
5050
})
5151
),

‎ui/web/src/skins/classic/ClassicLayout.vue‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@
3636
:key="state.renderAddChargingStations"
3737
:off="
3838
() => {
39-
$router.push({ name: ROUTE_NAMES.CHARGING_STATIONS })
39+
$router.push({ name: ROUTE_NAMES.CHARGING_STATIONS }).catch(() => undefined)
4040
}
4141
"
4242
:on="
4343
() => {
44-
$router.push({ name: ROUTE_NAMES.ADD_CHARGING_STATIONS })
44+
$router.push({ name: ROUTE_NAMES.ADD_CHARGING_STATIONS }).catch(() => undefined)
4545
}
4646
"
4747
:shared="true"
@@ -166,7 +166,7 @@ const {
166166
clearToggleButtons()
167167
refresh()
168168
if ($route.name !== ROUTE_NAMES.CHARGING_STATIONS) {
169-
$router.push({ name: ROUTE_NAMES.CHARGING_STATIONS })
169+
$router.push({ name: ROUTE_NAMES.CHARGING_STATIONS }).catch(() => undefined)
170170
}
171171
},
172172
onSimulatorStopped: () => {

‎ui/web/src/skins/classic/components/actions/AddChargingStations.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ const $router = useRouter()
133133
const { formState, pending, submitForm, templates } = useAddStationsForm({
134134
onFinally: () => {
135135
resetToggleButtonState('add-charging-stations', true)
136-
$router.push({ name: ROUTE_NAMES.CHARGING_STATIONS })
136+
$router.push({ name: ROUTE_NAMES.CHARGING_STATIONS }).catch(() => undefined)
137137
},
138138
})
139139

‎ui/web/src/skins/classic/components/actions/SetSupervisionUrl.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const setSupervisionUrl = async (): Promise<void> => {
6161
const success = await submitForm()
6262
if (success) {
6363
resetToggleButtonState(`${props.hashId}-set-supervision-url`, true)
64-
$router.push({ name: ROUTE_NAMES.CHARGING_STATIONS })
64+
$router.push({ name: ROUTE_NAMES.CHARGING_STATIONS }).catch(() => undefined)
6565
}
6666
}
6767
</script>

0 commit comments

Comments
 (0)