mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
fix imports and adjust biome and linting configuration
remove unused `SecretSchema` import, adjust biome settings to modify linting behavior, and clean formatting in `slugify` and other functions.
This commit is contained in:
@@ -19,7 +19,9 @@ function getCleanRequest(req: Request, cleanRequest: NextjsBkndConfig["cleanRequ
|
|||||||
if (!cleanRequest) return req;
|
if (!cleanRequest) return req;
|
||||||
|
|
||||||
const url = new URL(req.url);
|
const url = new URL(req.url);
|
||||||
cleanRequest?.searchParams?.forEach((k) => url.searchParams.delete(k));
|
cleanRequest?.searchParams?.forEach((k) => {
|
||||||
|
url.searchParams.delete(k);
|
||||||
|
});
|
||||||
|
|
||||||
if (isNode()) {
|
if (isNode()) {
|
||||||
return new Request(url.toString(), {
|
return new Request(url.toString(), {
|
||||||
|
|||||||
@@ -120,17 +120,14 @@ export function patternMatch(target: string, pattern: RegExp | string): boolean
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function slugify(str: string): string {
|
export function slugify(str: string): string {
|
||||||
return (
|
return String(str)
|
||||||
String(str)
|
.normalize("NFKD") // split accented characters into their base characters and diacritical marks
|
||||||
.normalize("NFKD") // split accented characters into their base characters and diacritical marks
|
.replace(/[\u0300-\u036f]/g, "") // remove all the accents, which happen to be all in the \u03xx UNICODE block.
|
||||||
// biome-ignore lint/suspicious/noMisleadingCharacterClass: <explanation>
|
.trim() // trim leading or trailing whitespace
|
||||||
.replace(/[\u0300-\u036f]/g, "") // remove all the accents, which happen to be all in the \u03xx UNICODE block.
|
.toLowerCase() // convert to lowercase
|
||||||
.trim() // trim leading or trailing whitespace
|
.replace(/[^a-z0-9 -]/g, "") // remove non-alphanumeric characters
|
||||||
.toLowerCase() // convert to lowercase
|
.replace(/\s+/g, "-") // replace spaces with hyphens
|
||||||
.replace(/[^a-z0-9 -]/g, "") // remove non-alphanumeric characters
|
.replace(/-+/g, "-"); // remove consecutive hyphens
|
||||||
.replace(/\s+/g, "-") // replace spaces with hyphens
|
|
||||||
.replace(/-+/g, "-") // remove consecutive hyphens
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function truncate(str: string, length = 50, end = "..."): string {
|
export function truncate(str: string, length = 50, end = "..."): string {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { mark, stripMark, $console, s, SecretSchema, setPath } from "bknd/utils";
|
import { mark, stripMark, $console, s, setPath } from "bknd/utils";
|
||||||
import { BkndError } from "core/errors";
|
import { BkndError } from "core/errors";
|
||||||
import * as $diff from "core/object/diff";
|
import * as $diff from "core/object/diff";
|
||||||
import type { Connection } from "data/connection";
|
import type { Connection } from "data/connection";
|
||||||
|
|||||||
35
biome.json
35
biome.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://biomejs.dev/schemas/2.3.3/schema.json",
|
"$schema": "https://biomejs.dev/schemas/2.3.3/schema.json",
|
||||||
"assist": { "actions": { "source": { "organizeImports": "on" } } },
|
"assist": { "actions": { "source": { "organizeImports": "off" } } },
|
||||||
"vcs": {
|
"vcs": {
|
||||||
"defaultBranch": "main"
|
"defaultBranch": "main"
|
||||||
},
|
},
|
||||||
@@ -31,16 +31,15 @@
|
|||||||
"files": {
|
"files": {
|
||||||
"includes": [
|
"includes": [
|
||||||
"**",
|
"**",
|
||||||
"!**/node_modules",
|
"!!**/node_modules",
|
||||||
"!**/node_modules",
|
"!!**/.cache",
|
||||||
"!**/.cache",
|
"!!**/.wrangler",
|
||||||
"!**/.wrangler",
|
"!!**/build",
|
||||||
"!**/build",
|
"!!**/dist",
|
||||||
"!**/dist",
|
"!!**/data.sqld",
|
||||||
"!**/data.sqld",
|
"!!**/data.sqld",
|
||||||
"!**/data.sqld",
|
"!!**/public",
|
||||||
"!**/public",
|
"!!**/.history"
|
||||||
"!**/.history"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"linter": {
|
"linter": {
|
||||||
@@ -53,7 +52,13 @@
|
|||||||
"useExhaustiveDependencies": "off",
|
"useExhaustiveDependencies": "off",
|
||||||
"noUnreachable": "warn",
|
"noUnreachable": "warn",
|
||||||
"noChildrenProp": "off",
|
"noChildrenProp": "off",
|
||||||
"noSwitchDeclarations": "warn"
|
"noSwitchDeclarations": "warn",
|
||||||
|
"noUnusedVariables": {
|
||||||
|
"options": {
|
||||||
|
"ignoreRestSiblings": true
|
||||||
|
},
|
||||||
|
"level": "warn"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"complexity": {
|
"complexity": {
|
||||||
"noUselessFragments": "warn",
|
"noUselessFragments": "warn",
|
||||||
@@ -68,7 +73,11 @@
|
|||||||
"noArrayIndexKey": "off",
|
"noArrayIndexKey": "off",
|
||||||
"noImplicitAnyLet": "warn",
|
"noImplicitAnyLet": "warn",
|
||||||
"noConfusingVoidType": "off",
|
"noConfusingVoidType": "off",
|
||||||
"noConsole": { "level": "warn", "options": { "allow": ["error"] } }
|
"noConsole": {
|
||||||
|
"level": "warn",
|
||||||
|
"options": { "allow": ["error", "info"] }
|
||||||
|
},
|
||||||
|
"noTsIgnore": "off"
|
||||||
},
|
},
|
||||||
"security": {
|
"security": {
|
||||||
"noDangerouslySetInnerHtml": "off"
|
"noDangerouslySetInnerHtml": "off"
|
||||||
|
|||||||
Reference in New Issue
Block a user