Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
holtwick committed Sep 5, 2024
1 parent 3958896 commit f9021ba
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 14 deletions.
5 changes: 4 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export default antfu(
},
{},
{
rules: eslintRulesDefaults(),
rules: {
...eslintRulesDefaults(),
'unicorn/consistent-function-scoping': 'off',
},
},
)
12 changes: 4 additions & 8 deletions src/browser/localstorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,13 @@ export class LocalStorage<T = Json> implements ObjectStorage<T> {
}

clear(): void {
Object.keys(localStorage)
.filter(key => key.startsWith(this.prefix))
.forEach((key) => {
localStorage.removeItem(key)
})
Object.keys(localStorage).filter(key => key.startsWith(this.prefix)).forEach((key) => {
localStorage.removeItem(key)
})
}

allKeys(): string[] {
const prefixLength = this.prefix.length
return Object.keys(localStorage)
.filter(key => key.startsWith(this.prefix))
.map(key => key.substr(prefixLength))
return Object.keys(localStorage).filter(key => key.startsWith(this.prefix)).map(key => key.substr(prefixLength))
}
}
2 changes: 1 addition & 1 deletion src/common/crypto.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const log = DefaultLogger('crypto.spec')
describe('crypto', () => {
it('should not have collisions', () => {
expect(equalBinary(new Uint8Array(2), new Uint8Array([0, 0]))).toBe(true)
const list: Uint8Array[] = Array.apply(null, Array(100)).map(() =>
const list: Uint8Array[] = Array.apply(null, Array.from({ length: 100 })).map(() =>
randomUint8Array(8),
)
let id: Uint8Array | undefined
Expand Down
2 changes: 1 addition & 1 deletion src/common/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function getGlobal(): any {
: typeof global !== 'undefined'
? global
// eslint-disable-next-line no-new-func
: Function('return this;')()
: new Function('return this;')()
}

/** @deprecated */
Expand Down
2 changes: 1 addition & 1 deletion src/common/schema/rpc.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { func, object, string } from './schema'
import type { Infer, Type } from './schema'
import type { Infer } from './schema'

// see https://github.com/colinhacks/zod?tab=readme-ov-file#functions

Expand Down
4 changes: 2 additions & 2 deletions src/common/uuid.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('uuid', () => {
})

it('should not have collisions', () => {
const list = Array.apply(null, Array(100)).map(uuid)
const list = Array.apply(null, Array.from({ length: 100 })).map(uuid)
while (list.length) {
const id = list.pop()
expect(id?.length).toBe(22)
Expand All @@ -29,7 +29,7 @@ describe('uuid', () => {
})

it('should not have collisions v4', () => {
const list = Array.apply(null, Array(100)).map(uuidv4)
const list = Array.apply(null, Array.from({ length: 100 })).map(uuidv4)
while (list.length) {
const id = list.pop()
expect(id?.length).toBe(36)
Expand Down

0 comments on commit f9021ba

Please sign in to comment.