-
-
Notifications
You must be signed in to change notification settings - Fork 169
Description
Motivation
TypeScript Do's and Dont's (https://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html#general-types) says to never use Object (capital O). So when in typescript mode, only ever object should be allowed as default, and not Object.
The reason is that a ton of users in our project always incorrectly uses Object in JSDoc, when it pretty much always should be object since we use typescript mode, which causes a lot of unnecessary code review comments.
This was fixed in #800.
However, since jsdoc-type-pratt-parser/jsdoc-type-pratt-parser#101 has been fixed, object<>, object.<>, Object<> and Object.<> should be disallowed as well.
One can use {[key: string]: string} instead when in typescript mode. This should thus be the default.
Current behavior
When eslint-plugin-jsdoc is set to "mode": "typescript", then both object<>, object.<>, Object<> and Object.<> is allowed.
Desired behavior
When "mode": "typescript" is set, only {[key: string]: string} should be allowed by default.
Alternatives considered
I could define this setting:
"settings": {
"jsdoc": {
"mode": "typescript",
"preferredTypes": {
"Object": "object",
"Object<>": false,
"Object.<>": false,
"object<>": false,
"object.<>": false
}
}
}But the problem with that is that pretty much anyone using typescript mode would have to use that setting. It'd be much better to change the default, as that is an absolute "do and don't" to follow.
Those who want to allow object<>, object.<>, Object<> and Object.<> etc. can already do that via preferredTypes.