chore(deps-dev): update eslint to v9 (#147)

This commit is contained in:
Marco Pasqualetti
2024-12-01 10:07:35 +01:00
committed by GitHub
parent 5fc68a1926
commit 11d425faa9
42 changed files with 665 additions and 504 deletions
@@ -1,8 +1,10 @@
import * as fsp from 'fs/promises'
import path from 'path'
import { format } from 'prettier'
import { buildRouteConfig } from './build-route-config'
import { hasParentRoute } from './has-parent-route'
import {
cleanPath,
determineNodePath,
@@ -19,7 +21,6 @@ import {
import type { Config, RouteNode } from './types'
import { ROUTES_FOLDER, ROOT_PATH_ID, GENERATED_ROUTE_TREE } from './constants'
import { format } from 'prettier'
import { sortRouteNodes } from './sort-route-nodes'
import isDefaultExported from './utils/is-default-exported'
@@ -130,7 +131,7 @@ export async function routeGenerator(config = defaultConfig): Promise<void> {
// Loop over the flat list of routeNodes and
// build up a tree based on the routeNodes' routePath
const handleNode = async (node: RouteNode): Promise<void> => {
const handleNode = (node: RouteNode): void => {
const parentRoute = hasParentRoute(routeNodes, node, node.routePath)
if (parentRoute) node.parent = parentRoute
@@ -149,7 +150,7 @@ export async function routeGenerator(config = defaultConfig): Promise<void> {
}
for (const node of preRouteNodes) {
await handleNode(node)
handleNode(node)
}
const routeConfigChildrenText = buildRouteConfig(routeNodes)
@@ -237,7 +238,8 @@ export async function routeGenerator(config = defaultConfig): Promise<void> {
const routeTreeContent = await fsp
.readFile(path.resolve(config.generatedRouteTree), 'utf-8')
.catch((err: any) => {
.catch((e) => {
const err = e as Error & { code?: string }
if (err.code === 'ENOENT') {
return undefined
}