update: add lint script to package.json

* lint files
This commit is contained in:
Braks
2021-07-09 19:18:46 +02:00
parent 179b5c5d4d
commit 65332cfde3
5 changed files with 12 additions and 8 deletions

View File

@@ -2,9 +2,10 @@ const baseRules = {
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/ban-ts-ignore': 0,
'@typescript-eslint/ban-ts-comment': 0,
'@typescript-eslint/no-empty-function': 0,
'no-use-before-define': 0,
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': ['error'],
'@typescript-eslint/no-unused-vars': ['warn'],
indent: ['warn', 2, { SwitchCase: 1, flatTernaryExpressions: true }],
quotes: ['error', 'single', { avoidEscape: true }],
semi: ['error', 'always'],

View File

@@ -20,8 +20,10 @@
"build": "vue-tsc --noEmit && vite build",
"build:dist": "rollup -c --environment NODE_ENV:production && postcss src/*.css --dir dist",
"serve": "vite preview",
"prepublishOnly": "yarn build:dist",
"test": "exit 0"
"prepublishOnly": "yarn lint && yarn build:dist",
"test": "exit 0",
"lint:js": "eslint --ext \".js,.jsx,.ts,.tsx\" --fix --ignore-path .gitignore .",
"lint": "yarn lint:js"
},
"dependencies": {
"d3": "^7.0.0",

View File

@@ -137,7 +137,7 @@ const NodeRenderer = defineComponent({
{visibleNodes.value.map((node) => {
const nodeType = node.type || 'default';
if (props.nodeTypes) {
const NodeComponent: any = (props.nodeTypes[nodeType] || props.nodeTypes.default);
const NodeComponent: any = props.nodeTypes[nodeType] || props.nodeTypes.default;
if (!props.nodeTypes[nodeType]) {
console.warn(`Node type "${nodeType}" not found. Using fallback type "default".`);
}

View File

@@ -18,7 +18,7 @@ export {
getConnectedEdges,
updateEdge,
getTransformForBounds,
getRectOfNodes,
getRectOfNodes
} from './utils/graph';
export { default as useZoomPanHelper } from './hooks/useZoomPanHelper';
export { default as useUpdateNodeInternals } from './hooks/useUpdateNodeInternals';

7
src/shims-vue.d.ts vendored
View File

@@ -1,5 +1,6 @@
declare module '*.vue' {
import { DefineComponent } from 'vue'
const component: DefineComponent<{}, {}, any>
export default component
import { DefineComponent } from 'vue';
// eslint-disable-next-line @typescript-eslint/ban-types
const component: DefineComponent<{}, {}, any>;
export default component;
}