英文:
How do I get type hints for ESLint's new config file (eslint.config.js)?
问题
/** @type {???} */
export default [
{
rules: {...}
}
]
英文:
In an eslint.config.js
file, how can I get TypeScript type hints for the new config object?
/** @type {???} */
export default [
{
rules: {...}
}
]
答案1
得分: 9
/** @type { import("eslint").Linter.FlatConfig[] } */
export default [
// get hints here
];
英文:
You import declarations, including library types, to JSDoc using import types. For your specific case the relevant type is FlatConfig
, so:
/** @type { import("eslint").Linter.FlatConfig[] } */
export default [
// get hints here
];
Note you will need to install @types/eslint
for FlatConfig
to appear on Linter
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论