Refactor to Vue 3 recommended ESLint rules

These updates ensure better adherence to Vue 3 standards and improve
overall code quality and readability.

- Update ESLint configuration from Vue 2.x to Vue 3 rules.
- Switch from "essential" to strictest "recommended" ESLint ruleset.
- Adjust ESLint script to treat warnings as errors by using
  `--max-warnings=0` flag. This enforces stricter code quality controls
  provided by Vue 3 rules.
This commit is contained in:
undergroundwires
2023-11-17 13:57:13 +01:00
parent bf3426f91b
commit 4531645b4c
50 changed files with 231 additions and 166 deletions

View File

@@ -201,14 +201,6 @@ function mountToggleSwitchParent(options?: {
ToggleSwitch,
},
emits: [parentClickEventName],
template: `
<div @click="handleParentClick">
<ToggleSwitch
:stopClickPropagation="stopClickPropagation"
:label="'test-label'"
/>
</div>
`,
setup(_, { emit }) {
const stopClickPropagation = options?.stopClickPropagation;
@@ -221,6 +213,14 @@ function mountToggleSwitchParent(options?: {
stopClickPropagation,
};
},
template: `
<div @click="handleParentClick">
<ToggleSwitch
:stopClickPropagation="stopClickPropagation"
:label="'test-label'"
/>
</div>
`,
});
const wrapper = mount(
parentComponent,

View File

@@ -61,6 +61,7 @@ describe('AppIcon.vue', () => {
// act
await wrapper.trigger('click');
await nextTick();
// assert
expect(wrapper.emitted().click).to.have.lengthOf(1);

View File

@@ -8,7 +8,6 @@ export function createSizeObserverStub(
) {
const component = defineComponent({
name: COMPONENT_SIZE_OBSERVER_NAME,
template: `<div id="${COMPONENT_SIZE_OBSERVER_NAME}-stub"><slot /></div>`,
emits: {
/* eslint-disable @typescript-eslint/no-unused-vars */
widthChanged: (newWidth: number) => true,
@@ -19,6 +18,7 @@ export function createSizeObserverStub(
emit('widthChanged', newValue);
});
},
template: `<div id="${COMPONENT_SIZE_OBSERVER_NAME}-stub"><slot /></div>`,
});
return {
name: COMPONENT_SIZE_OBSERVER_NAME,