Skip to content
This repository has been archived by the owner on Jan 19, 2019. It is now read-only.

[FEAT] [no-unnecessary-type-assertion] Add rule #269

Closed

Conversation

uniqueiniquity
Copy link

  • I’ve filled out the documentation, including all relevant sections and a link to the equivalent TSLint rule if available.
  • I’ve filled out the rule’s category
  • I’ve added documentation for the equivalent TSLint rule (in extraDescription)
  • I’ve added the rule documentation link via the helper from ../utils.
  • I’ve added the rule to the roadmap
  • I’ve added tests for my changes

Adding equivalent of TSLint's no-unnecessary-type-assertion. Depends on eslint/typescript-eslint-parser#568 for type information.

@uniqueiniquity
Copy link
Author

@j-f1 you may have opinions here and on #250 about adding TS as a peer dependency. I can match whatever makes sense for #265.

@armano2
Copy link
Contributor

armano2 commented Dec 27, 2018

@uniqueiniquity do you mind adding helper function to utils?
with better message xd

 /**
  * Try to retrieve typescript parser service from context
  * @param {RuleContext} context Rule context
  * @returns {object} parserServices
  */
 exports.getParserServices = context => {
     if (
         !context.parserServices ||
         !context.parserServices.program ||
         !context.parserServices.esTreeNodeToTSNodeMap
     ) {
         throw new Error(
             "This rule requires you to use `typescript-eslint-parser`."
         );
     }
     return context.parserServices;
 };

@bradzacher bradzacher added the WIP PRs that are work in progress label Dec 28, 2018
@bradzacher
Copy link
Owner

@armano2 added as a separate PR #270, so that other PR's aren't dependent on this PR.

@bradzacher bradzacher changed the title Add 'no-unnecessary-type-assertion' rule [FEAT] [no-unnecessary-type-assertion] Add rule Jan 8, 2019
@bradzacher bradzacher closed this Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs type info WIP PRs that are work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants