diff --git a/eslint.config.js b/eslint.config.js index a159663..81e0f5d 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,8 +1,13 @@ import antfu from '@antfu/eslint-config' export default antfu({ - ignores: ['assets/'], + ignores: [ + 'assets/', + 'node_modules/', + 'dist/', + ], typescript: true, + gitignore: false, rules: { 'curly': ['error', 'multi-line'], 'style/brace-style': ['error', '1tbs', { allowSingleLine: true }], diff --git a/scripts/misc/shikimori/utils.ts b/scripts/misc/shikimori/utils.ts index e25dc28..27cc5d5 100644 --- a/scripts/misc/shikimori/utils.ts +++ b/scripts/misc/shikimori/utils.ts @@ -12,28 +12,4 @@ export const ffetchShiki = ffetchBase.extend({ ...(rateLimitBypass as any), }) -export function counterIter(start = 0, end = Infinity) { - let i = start - let ended = false - - const iter: IterableIterator = { - [Symbol.iterator]: () => iter, - next() { - if (ended) { - return { value: undefined, done: true } - } - - if (i > end) { - return { value: undefined, done: true } - } - - return { value: i++, done: false } - }, - } - return { - iter, - end: () => { - ended = true - }, - } -} +export { counterIter } from '../../../utils/counter.ts' diff --git a/utils/counter.ts b/utils/counter.ts new file mode 100644 index 0000000..7c7c6fd --- /dev/null +++ b/utils/counter.ts @@ -0,0 +1,25 @@ +export function counterIter(start = 0, end = Infinity) { + let i = start + let ended = false + + const iter: IterableIterator = { + [Symbol.iterator]: () => iter, + next() { + if (ended) { + return { value: undefined, done: true } + } + + if (i > end) { + return { value: undefined, done: true } + } + + return { value: i++, done: false } + }, + } + return { + iter, + end: () => { + ended = true + }, + } +}