Skip to content

preferredTypes #247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2019
Merged

preferredTypes #247

merged 1 commit into from
May 21, 2019

Conversation

brettz9
Copy link
Collaborator

@brettz9 brettz9 commented May 21, 2019

  • Change: check-types will now include the preferred type in its report message
  • Change: no-undefined-types now automatically allows NaN and Infinity types
  • Enhancement: check-types and no-undefined-types: utilize settings.jsdoc.preferredTypes map
  • Enhancement: check-types: Add option object with noDefaults
  • Enhancement: no-undefined-types: Add option object with preferredTypesAreDefined and definedTypes
  • Docs: no-undefined-types: Mention role of globals

Closes #107, Closes #164, Closes #166, Closes #215 .

Also unblocks the one item I think is remaining for #1 , namely to correlate our new preferredTypes to eslint's deprecated valid-jsdoc.

Regarding #164, @gajus, I wonder if you want to also make a breaking change to the default behavior and require object instead of Object, given that valid-jsdoc did so and TypeScript recommends so. I think the rationale for this is that Object.create(null) will create an object whose typeof is object but which is not instanceof Object. While this PR allows overriding the default behavior, I think this makes sense as a new default as well, especially considering the Object.create(null) aspect.

There is also one issue in this PR I have not been able to figure out, and wonder if it is an issue with eslint itself. Though I changed this to get the test to passed, what I would expect in line 477 at https://github.com/brettz9/eslint-plugin-jsdoc/blob/a571c68bb988732b45308f3f6ae0353ce71678b3/test/rules/assertions/checkTypes.js#L477 really would instead be "number" lower-cased, as I'd think that both reported errors for this test would be fixed, but only one is. This seems not to be tied to this specific problem but it appears to me only one fix can get made. Any idea why that is?

@brettz9 brettz9 force-pushed the check-types-prefer-types branch from a571c68 to 48b26d8 Compare May 21, 2019 08:14
@brettz9 brettz9 requested a review from gajus May 21, 2019 08:20
…port message

- Change: `no-undefined-types` now automatically allows `NaN` and `Infinity` types
- Enhancement: `check-types` and `no-undefined-types`: utilize `settings.jsdoc.preferredTypes` map
- Enhancement: `check-types`: Add option object with `noDefaults`
- Enhancement: `no-undefined-types`: Add option object with `preferredTypesAreDefined` and `definedTypes`
- Docs: `no-undefined-types`: Mention role of globals
@brettz9 brettz9 force-pushed the check-types-prefer-types branch from 48b26d8 to d8c3e6e Compare May 21, 2019 08:25
@brettz9 brettz9 merged commit c46ca2c into gajus:master May 21, 2019
@brettz9
Copy link
Collaborator Author

brettz9 commented May 21, 2019

Thanks for the reviews! Just wondering though about changing that default--are you inclined to keep it as it is or change it for object?

@brettz9 brettz9 deleted the check-types-prefer-types branch May 21, 2019 14:15
@gajus
Copy link
Owner

gajus commented May 21, 2019

🎉 This PR is included in version 6.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gajus gajus added the released label May 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants