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

@@ -2,10 +2,11 @@
<div class="wrapper">
<div
class="expansible-node"
@click="toggleCheck"
:style="{
'padding-left': `${currentNode.hierarchy.depthInTree * 24}px`,
}">
}"
@click="toggleCheck"
>
<div
class="expand-collapse-arrow"
:class="{
@@ -15,10 +16,10 @@
@click.stop="toggleExpand"
/>
<LeafTreeNode
:nodeId="nodeId"
:treeRoot="treeRoot"
:node-id="nodeId"
:tree-root="treeRoot"
>
<template v-slot:node-content="slotProps">
<template #node-content="slotProps">
<slot name="node-content" v-bind="slotProps" />
</template>
</LeafTreeNode>
@@ -32,11 +33,11 @@
<HierarchicalTreeNode
v-for="id in renderedNodeIds"
:key="id"
:nodeId="id"
:treeRoot="treeRoot"
:renderingStrategy="renderingStrategy"
:node-id="id"
:tree-root="treeRoot"
:rendering-strategy="renderingStrategy"
>
<template v-slot:node-content="slotProps">
<template #node-content="slotProps">
<slot name="node-content" v-bind="slotProps" />
</template>
</HierarchicalTreeNode>

View File

@@ -5,11 +5,11 @@
>
<div
class="node focusable"
@focus="onNodeFocus"
tabindex="-1"
:class="{
'keyboard-focus': hasKeyboardFocus,
}"
tabindex="-1"
@focus="onNodeFocus"
>
<div
class="checkbox"
@@ -22,7 +22,7 @@
<div class="content">
<slot
name="node-content"
:nodeMetadata="currentNode.metadata"
:node-metadata="currentNode.metadata"
/>
</div>
</div>

View File

@@ -5,11 +5,11 @@
<HierarchicalTreeNode
v-for="nodeId in renderedNodeIds"
:key="nodeId"
:nodeId="nodeId"
:treeRoot="treeRoot"
:renderingStrategy="renderingStrategy"
:node-id="nodeId"
:tree-root="treeRoot"
:rendering-strategy="renderingStrategy"
>
<template v-slot:node-content="slotProps">
<template #node-content="slotProps">
<slot v-bind="slotProps" />
</template>
</HierarchicalTreeNode>

View File

@@ -1,10 +1,10 @@
<template>
<div
class="tree"
ref="treeContainerElement"
class="tree"
>
<TreeRoot :treeRoot="tree" :renderingStrategy="nodeRenderingScheduler">
<template v-slot="slotProps">
<TreeRoot :tree-root="tree" :rendering-strategy="nodeRenderingScheduler">
<template #default="slotProps">
<slot name="node-content" v-bind="slotProps" />
</template>
</TreeRoot>
@@ -34,11 +34,6 @@ export default defineComponent({
components: {
TreeRoot,
},
emits: {
/* eslint-disable @typescript-eslint/no-unused-vars */
nodeStateChanged: (node: TreeNodeStateChangedEmittedEvent) => true,
/* eslint-enable @typescript-eslint/no-unused-vars */
},
props: {
initialNodes: {
type: Array as PropType<readonly TreeInputNodeData[]>,
@@ -53,6 +48,11 @@ export default defineComponent({
default: () => [],
},
},
emits: {
/* eslint-disable @typescript-eslint/no-unused-vars */
nodeStateChanged: (node: TreeNodeStateChangedEmittedEvent) => true,
/* eslint-enable @typescript-eslint/no-unused-vars */
},
setup(props, { emit }) {
const treeContainerElement = shallowRef<HTMLElement | undefined>();