Skip to content

Commit

Permalink
chore: Re-enable linting with type information
Browse files Browse the repository at this point in the history
  • Loading branch information
eemeli committed Sep 3, 2024
1 parent adef9c5 commit 4c30eb6
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
15 changes: 12 additions & 3 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default [
]
},
eslint.configs.recommended,
...typescript.configs.recommended,
...typescript.configs.recommendedTypeChecked,
prettierConfig,
{
languageOptions: {
Expand All @@ -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: '^_' }
Expand All @@ -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'
}
},

Expand All @@ -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'
}
}
]
1 change: 1 addition & 0 deletions src/doc/applyReviver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions src/doc/createNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down
2 changes: 2 additions & 0 deletions src/nodes/toJS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions tests/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const skip = Number(major) < 20
}
},
args
)
).catch(done)
})
}

Expand All @@ -67,7 +67,7 @@ const skip = Number(major) < 20
}
},
args
)
).catch(done)
})
}

Expand Down

0 comments on commit 4c30eb6

Please sign in to comment.