diff --git a/eslint.config.mjs b/eslint.config.mjs index 42a4ce2b..fe2dab72 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -18,7 +18,7 @@ export default [ ] }, eslint.configs.recommended, - ...typescript.configs.recommended, + ...typescript.configs.recommendedTypeChecked, prettierConfig, { languageOptions: { @@ -43,6 +43,9 @@ export default [ 'prefer-const': ['warn', { destructuring: 'all' }], '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-namespace': 'off', + '@typescript-eslint/no-unsafe-argument': 'off', + '@typescript-eslint/no-unsafe-assignment': 'off', + '@typescript-eslint/no-unsafe-member-access': 'off', '@typescript-eslint/no-unused-vars': [ 'warn', { argsIgnorePattern: '^_' } @@ -52,7 +55,8 @@ export default [ 'warn', { ignoreMixedLogicalExpressions: true } ], - '@typescript-eslint/prefer-optional-chain': 'warn' + '@typescript-eslint/prefer-optional-chain': 'warn', + '@typescript-eslint/restrict-template-expressions': 'off' } }, @@ -63,6 +67,11 @@ export default [ { files: ['tests/**'], - rules: { camelcase: 0 } + rules: { + camelcase: 0, + '@typescript-eslint/no-unsafe-call': 'off', + '@typescript-eslint/no-unsafe-return': 'off', + '@typescript-eslint/unbound-method': 'off' + } } ] diff --git a/src/doc/applyReviver.ts b/src/doc/applyReviver.ts index b00edf3d..7aa4f46a 100644 --- a/src/doc/applyReviver.ts +++ b/src/doc/applyReviver.ts @@ -18,6 +18,7 @@ export function applyReviver( for (let i = 0, len = val.length; i < len; ++i) { const v0 = val[i] const v1 = applyReviver(reviver, val, String(i), v0) + // eslint-disable-next-line @typescript-eslint/no-array-delete if (v1 === undefined) delete val[i] else if (v1 !== v0) val[i] = v1 } diff --git a/src/doc/createNode.ts b/src/doc/createNode.ts index 9987c451..c80805d2 100644 --- a/src/doc/createNode.ts +++ b/src/doc/createNode.ts @@ -77,6 +77,7 @@ export function createNode( let tagObj = findTagObject(value, tagName, schema.tags) if (!tagObj) { if (value && typeof (value as any).toJSON === 'function') { + // eslint-disable-next-line @typescript-eslint/no-unsafe-call value = (value as any).toJSON() } if (!value || typeof value !== 'object') { diff --git a/src/nodes/toJS.ts b/src/nodes/toJS.ts index d8f2e9e4..ac7d3944 100644 --- a/src/nodes/toJS.ts +++ b/src/nodes/toJS.ts @@ -29,8 +29,10 @@ export interface ToJSContext { * stringification. */ export function toJS(value: any, arg: string | null, ctx?: ToJSContext): any { + // eslint-disable-next-line @typescript-eslint/no-unsafe-return if (Array.isArray(value)) return value.map((v, i) => toJS(v, String(i), ctx)) if (value && typeof value.toJSON === 'function') { + // eslint-disable-next-line @typescript-eslint/no-unsafe-call if (!ctx || !hasAnchor(value)) return value.toJSON(arg, ctx) const data: AnchorData = { aliasCount: 0, count: 1, res: undefined } ctx.anchors.set(value, data) diff --git a/tests/cli.ts b/tests/cli.ts index 2b835675..7a0fbda4 100644 --- a/tests/cli.ts +++ b/tests/cli.ts @@ -41,7 +41,7 @@ const skip = Number(major) < 20 } }, args - ) + ).catch(done) }) } @@ -67,7 +67,7 @@ const skip = Number(major) < 20 } }, args - ) + ).catch(done) }) }