Enhancement: [ban-types] Rule does not trigger with comments inside type object #8735
Closed
4 tasks done
Labels
enhancement: plugin rule option
New rule option for an existing eslint-plugin rule
locked due to age
Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
working as intended
Issues that are closed as they are working as intended
Before You File a Proposal Please Confirm You Have Done The Following...
My proposal is suitable for this project
Link to the rule's documentation
https://typescript-eslint.io/rules/ban-types/
Description
https://typescript-eslint.io/play/#ts=5.4.2&fileType=.ts&code=C4TwDgpgBANg9gdwgJwPICMBWUC8UDeAUFFAPSlQAWcA5hIQL4DchhoksiKGmATLgWaEgA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6AIwEMnajTUMkRNGgB7aJHBgAviGlA&tsconfig=&tokens=false
I believe this behavior might be unintended, as the presence of comments should ideally not affect the linting rules for identifying empty object types. It would be beneficial for code quality and consistency if the ban-types rule could be enhanced to trigger an error regardless of the presence of comments within the type object.
I propose an enhancement to the ban-types rule to ensure it consistently identifies and flags empty object types, even when comments are present inside the type declaration. This change would help developers maintain higher code standards and avoid potential issues related to the use of empty object types in TypeScript.
Thank you for considering this enhancement to the ban-types rule. I believe it will make a valuable contribution to the robustness and consistency of TypeScript linting with ESLint.
Fail
Pass
Additional Info
No response
The text was updated successfully, but these errors were encountered: