ITADN

unfunctional jsx-components include

#143ClosedArthurLCW 创建于 2025-03-31
A
ArthurLCWcommented
Hi there, Thanks for your wonderful package! I met some problems when using the 'include' of 'jsx-components'. From my perspective, the keyword 'include' implies what kind of strings should be validated. However, the 'include' in jsx-components doesn't work like this. This is my code in .eslintrc.js: `const i18nextLinterConfig = { mode: 'all', 'should-validate-template': true, 'jsx-components': { include: ['TestJSX'], exclude: [], }, 'jsx-attributes': { include: ['styleName'], exclude: [ 'className', 'type', 'key', 'id', 'width', 'height', 'dfsdd' ], }, } module.exports = { extends: [..., "plugin:i18next/recommended"], rules: { ..., 'i18next/no-literal-string': ['error', i18nextLinterConfig], }, globals: { JSX: true, ClientRect: true, Spread: true, }, } ` The 'TestJSX' does NOT display any warning when translation is missing. The other jsx also stop displaying warning. ![Image](https://github.com/user-attachments/assets/61fd1fd5-3765-41a0-ab08-13458a6117e0) Based on my testing, the include for jsx-attributes works just fine. Is this a bug? Also, could you please add some examples in readme to illustrate how the linter works when both include and exclude are configured?
关闭于 2025-03-31 0 条评论