Skip to content

Commit

Permalink
chore: lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zyyv committed Dec 23, 2023
1 parent be0b469 commit 4b7397c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,10 @@ export function postprocessWithUnColor(unColor: string): Postprocessor {

export function importantProcess(): Postprocessor {
return (util) => {
util.entries.forEach(i => i[1] += ' !important')
util.entries.forEach((i) => {
if (i[1] != null && !String(i[1]).includes('!important'))
i[1] += ' !important'
})
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,5 @@ export function toArray<T>(val: T | T[]): T[] {
}

export function camelToHyphen(str: string): string {
return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()
}
4 changes: 2 additions & 2 deletions test/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { CSSObject } from 'unocss'
import { describe, expect, it } from 'vitest'
import { cssObj2StrSync, resolveAnimation, stringifyObj, camelToHyphen } from 'unocss-preset-useful'
import { cssObj2StrSync, resolveAnimation, stringifyObj } from 'unocss-preset-useful'

describe('utils', () => {
const _animation = {
Expand Down Expand Up @@ -54,7 +54,7 @@ describe('utils', () => {
const obj = {
foo: 'bb',
bar: 'dd',
fooBar: 'fooBar'
fooBar: 'fooBar',
}

expect(stringifyObj(obj)).toMatchInlineSnapshot(`"{foo:bb;bar:dd;foo-bar:fooBar;}"`)
Expand Down

0 comments on commit 4b7397c

Please sign in to comment.