chore: lint
This commit is contained in:
parent
2516bd2b05
commit
15079bad87
|
|
@ -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}`
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ type NestedRecord = Record<string, unknown> | { [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<string, unknown> {
|
||||
return obj !== null && !!obj && typeof obj === 'object' && !Array.isArray(obj)
|
||||
|
|
@ -132,7 +132,7 @@ function isContainerValue(value: unknown): value is Record<string, unknown> {
|
|||
}
|
||||
function cleanupNonNestedPath(path: string) {
|
||||
if (isNotNestedPath(path))
|
||||
return path.replace(/\[|\]/gi, '')
|
||||
return path.replace(/\[|\]/g, '')
|
||||
|
||||
return path
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ type NestedRecord = Record<string, unknown> | { [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<string, unknown> {
|
||||
return obj !== null && !!obj && typeof obj === 'object' && !Array.isArray(obj)
|
||||
|
|
@ -132,7 +132,7 @@ function isContainerValue(value: unknown): value is Record<string, unknown> {
|
|||
}
|
||||
function cleanupNonNestedPath(path: string) {
|
||||
if (isNotNestedPath(path))
|
||||
return path.replace(/\[|\]/gi, '')
|
||||
return path.replace(/\[|\]/g, '')
|
||||
|
||||
return path
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user