Skip to content

Commit

Permalink
chore(eslint): update
Browse files Browse the repository at this point in the history
  • Loading branch information
manudeli committed Jul 27, 2024
1 parent bbc7699 commit d6eb8c3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 20 deletions.
8 changes: 5 additions & 3 deletions configs/eslint-config-ts/no-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
'@suspensive/eslint-config-js/no-import',
'plugin:jsdoc/recommended-typescript',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/strict-type-checked',
'plugin:@typescript-eslint/strict',
],
rules: {
'@typescript-eslint/no-unused-vars': 'error',
Expand All @@ -33,15 +33,17 @@ module.exports = {
'jsdoc/check-tag-names': 'off',
'jsdoc/no-types': 'off',

// @typescript-eslint/strict-type-checked
// @typescript-eslint/strict
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-floating-promises': 'warn',
'@typescript-eslint/no-unsafe-call': 'warn',
'@typescript-eslint/no-throw-literal': 'warn',
'@typescript-eslint/no-confusing-void-expression': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/only-throw-error': 'warn',
'@typescript-eslint/no-empty-function': 'warn',
'@typescript-eslint/no-extra-semi': 'warn',
'@typescript-eslint/no-empty-interface': 'warn',
'@typescript-eslint/ban-ts-comment': ['error', { minimumDescriptionLength: 3 }],
},
}
17 changes: 1 addition & 16 deletions packages/cache/src/CacheStore.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,11 @@ import { Cache } from './Cache'
import { cacheOptions } from './cacheOptions'
import { CacheStore } from './CacheStore'
import { CacheStoreProvider } from './CacheStoreProvider'
import { hashCacheKey } from './utils'

const errorCache = (id: number) =>
cacheOptions({
cacheKey: ['key', id] as const,
cacheFn: () =>
sleep(ms('0.1s')).then(() =>
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
Promise.reject(ERROR_MESSAGE)
),
cacheFn: () => sleep(ms('0.1s')).then(() => Promise.reject(ERROR_MESSAGE)),
})

const successCache = (id: number) =>
Expand Down Expand Up @@ -167,14 +162,4 @@ describe('CacheStore', () => {
expect(cacheStore.getData(errorCache(1))).toBe(TEXT)
})
})

describe('unsubscribe', () => {
it('should handle unsubscribe gracefully when no subscribers exist', () => {
const mockSync = vi.fn()
const cacheKey = ['nonexistent', 'key'] as const
cacheStore.unsubscribe({ cacheKey }, mockSync)

expect(cacheStore['syncsMap'].get(hashCacheKey(cacheKey))).toBeUndefined()
})
})
})
1 change: 0 additions & 1 deletion packages/cache/src/useCache.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const successCache = () =>
const failureCache = () =>
cacheOptions({
cacheKey: key('failure'),
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
cacheFn: () => sleep(ms('0.1s')).then(() => Promise.reject(ERROR_MESSAGE)),
})

Expand Down

0 comments on commit d6eb8c3

Please sign in to comment.