防止在打字稿项目中询问 "Missing JSDoc comment" 标准反应方法
prevent asking "Missing JSDoc comment" for standard react methods in typescript project
我们有使用 Typescript 的 React 项目。
我们使用 TSDoc 来标准化 TypeScript 代码中使用的文档注释
我们的eslint.trc文件如下:
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"plugin:react/recommended",
"google",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"react",
"@typescript-eslint/eslint-plugin",
"eslint-plugin-tsdoc"
],
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
"tsdoc/syntax": "warn",
"valid-jsdoc" : 0,
"@typescript-eslint/explicit-module-boundary-types": "off"
}
}
如何配置此配置文件,因为不向 ESLINT 询问有关记录标准反应方法的信息,例如 constructor(),static getDerivedStateFromProps(),render(),componentDidMount() and etc.
我们可以切换"require-jsdoc":"off"
,但它也不会询问class中用户定义的方法。
我已经用这个插件解决了这个问题
https://www.npmjs.com/package/eslint-plugin-require-jsdoc-except?activeTab=readme
您可以在忽略处添加您的函数名称:
"ignore":[
"constructor", "render","componentDidUpdate","getDerivedStateFromProps","componentDidMount"
]
我们有使用 Typescript 的 React 项目。 我们使用 TSDoc 来标准化 TypeScript 代码中使用的文档注释
我们的eslint.trc文件如下:
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"plugin:react/recommended",
"google",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"react",
"@typescript-eslint/eslint-plugin",
"eslint-plugin-tsdoc"
],
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
"tsdoc/syntax": "warn",
"valid-jsdoc" : 0,
"@typescript-eslint/explicit-module-boundary-types": "off"
}
}
如何配置此配置文件,因为不向 ESLINT 询问有关记录标准反应方法的信息,例如 constructor(),static getDerivedStateFromProps(),render(),componentDidMount() and etc.
我们可以切换"require-jsdoc":"off"
,但它也不会询问class中用户定义的方法。
我已经用这个插件解决了这个问题 https://www.npmjs.com/package/eslint-plugin-require-jsdoc-except?activeTab=readme
您可以在忽略处添加您的函数名称:
"ignore":[
"constructor", "render","componentDidUpdate","getDerivedStateFromProps","componentDidMount"
]