From 15079bad8797f2b2aea8f4fc2349c071a9f5188a Mon Sep 17 00:00:00 2001 From: sadeghbarati Date: Sun, 9 Jun 2024 08:53:55 +0330 Subject: [PATCH] chore: lint --- apps/www/.vitepress/theme/components/TableOfContent.vue | 2 +- apps/www/scripts/build-registry.ts | 2 +- apps/www/src/lib/registry/default/ui/auto-form/utils.ts | 4 ++-- apps/www/src/lib/registry/new-york/ui/auto-form/utils.ts | 4 ++-- packages/cli/src/utils/transformers/transform-cjs-to-esm.ts | 2 +- packages/cli/src/utils/transformers/transform-css-vars.ts | 2 +- packages/cli/src/utils/transformers/transform-tw-prefix.ts | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/www/.vitepress/theme/components/TableOfContent.vue b/apps/www/.vitepress/theme/components/TableOfContent.vue index e6c1e693..7e02aae4 100644 --- a/apps/www/.vitepress/theme/components/TableOfContent.vue +++ b/apps/www/.vitepress/theme/components/TableOfContent.vue @@ -24,7 +24,7 @@ function getHeadingsWithHierarchy(divId: string) { const level = Number.parseInt(heading.tagName.charAt(1)) if (!heading.id) { const newId = heading.textContent - .replaceAll(/[^a-zA-Z0-9 ]/g, '') + .replaceAll(/[^a-z0-9 ]/gi, '') .replaceAll(' ', '-') .toLowerCase() heading.id = `${newId}` diff --git a/apps/www/scripts/build-registry.ts b/apps/www/scripts/build-registry.ts index 56535b0d..773fae96 100644 --- a/apps/www/scripts/build-registry.ts +++ b/apps/www/scripts/build-registry.ts @@ -282,7 +282,7 @@ for (const baseColor of ['slate', 'gray', 'zinc', 'neutral', 'stone', 'lime']) { for (const [key, value] of Object.entries(values)) { if (typeof value === 'string') { const resolvedColor = value.replace( - /{{base}}-/g, + /\{\{base\}\}-/g, `${baseColor}-`, ) base.inlineColors[mode][key] = resolvedColor diff --git a/apps/www/src/lib/registry/default/ui/auto-form/utils.ts b/apps/www/src/lib/registry/default/ui/auto-form/utils.ts index da3d33f2..1fa3a296 100644 --- a/apps/www/src/lib/registry/default/ui/auto-form/utils.ts +++ b/apps/www/src/lib/registry/default/ui/auto-form/utils.ts @@ -122,7 +122,7 @@ type NestedRecord = Record | { [k: string]: NestedRecord } * Checks if the path opted out of nested fields using `[fieldName]` syntax */ export function isNotNestedPath(path: string) { - return /^\[.+\]$/i.test(path) + return /^\[.+\]$/.test(path) } function isObject(obj: unknown): obj is Record { return obj !== null && !!obj && typeof obj === 'object' && !Array.isArray(obj) @@ -132,7 +132,7 @@ function isContainerValue(value: unknown): value is Record { } function cleanupNonNestedPath(path: string) { if (isNotNestedPath(path)) - return path.replace(/\[|\]/gi, '') + return path.replace(/\[|\]/g, '') return path } diff --git a/apps/www/src/lib/registry/new-york/ui/auto-form/utils.ts b/apps/www/src/lib/registry/new-york/ui/auto-form/utils.ts index da3d33f2..1fa3a296 100644 --- a/apps/www/src/lib/registry/new-york/ui/auto-form/utils.ts +++ b/apps/www/src/lib/registry/new-york/ui/auto-form/utils.ts @@ -122,7 +122,7 @@ type NestedRecord = Record | { [k: string]: NestedRecord } * Checks if the path opted out of nested fields using `[fieldName]` syntax */ export function isNotNestedPath(path: string) { - return /^\[.+\]$/i.test(path) + return /^\[.+\]$/.test(path) } function isObject(obj: unknown): obj is Record { return obj !== null && !!obj && typeof obj === 'object' && !Array.isArray(obj) @@ -132,7 +132,7 @@ function isContainerValue(value: unknown): value is Record { } function cleanupNonNestedPath(path: string) { if (isNotNestedPath(path)) - return path.replace(/\[|\]/gi, '') + return path.replace(/\[|\]/g, '') return path } diff --git a/packages/cli/src/utils/transformers/transform-cjs-to-esm.ts b/packages/cli/src/utils/transformers/transform-cjs-to-esm.ts index 1966e4c7..882e52db 100644 --- a/packages/cli/src/utils/transformers/transform-cjs-to-esm.ts +++ b/packages/cli/src/utils/transformers/transform-cjs-to-esm.ts @@ -1,7 +1,7 @@ export function transformCJSToESM(filename: string, code: string) { if (filename.endsWith('.mjs')) { return code - .replace(/const\s([\w\d_]+)\s*=\s*require\((.*)\);?/g, 'import $1 from $2') + .replace(/const\s(\w+)\s*=\s*require\((.*)\);?/g, 'import $1 from $2') .replace(/module\.exports = /g, 'export default ') } return code diff --git a/packages/cli/src/utils/transformers/transform-css-vars.ts b/packages/cli/src/utils/transformers/transform-css-vars.ts index c9de5402..4882ddb4 100644 --- a/packages/cli/src/utils/transformers/transform-css-vars.ts +++ b/packages/cli/src/utils/transformers/transform-css-vars.ts @@ -40,7 +40,7 @@ export const transformCssVars: Transformer = async ({ else { const s = new MagicString(value) s.replace(/'(.*?)'/g, (substring) => { - return `'${applyColorMapping(substring.replace(/\'/g, ''), baseColor.inlineColors)}'` + return `'${applyColorMapping(substring.replace(/'/g, ''), baseColor.inlineColors)}'` }) node.replaceWithText(s.toString()) } diff --git a/packages/cli/src/utils/transformers/transform-tw-prefix.ts b/packages/cli/src/utils/transformers/transform-tw-prefix.ts index 6f7495fb..5dbe4f03 100644 --- a/packages/cli/src/utils/transformers/transform-tw-prefix.ts +++ b/packages/cli/src/utils/transformers/transform-tw-prefix.ts @@ -39,7 +39,7 @@ export const transformTwPrefixes: Transformer = async ({ else { const s = new MagicString(value) s.replace(/'(.*?)'/g, (substring) => { - return `'${applyPrefix(substring.replace(/\'/g, ''), config.tailwind.prefix)}'` + return `'${applyPrefix(substring.replace(/'/g, ''), config.tailwind.prefix)}'` }) node.replaceWithText(s.toString()) }