Skip to content

chore(typescript-estree): clarify default file extensions #963

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 5 commits into from
Jan 5, 2020

Conversation

dimitropoulos
Copy link
Contributor

@dimitropoulos dimitropoulos commented Sep 9, 2019

I was doing a few things wrong that encouraged me, whilst debugging an issue with the parser, to make these changes.

I was using "extraFileExtensions": ["tsx"] in my code. For one thing, tsx is already scanned. For another thing, the format of this (which mirrors path.extname) is such that the . is required to work properly.

Once I read the source code and better understood how it really works, I decided that a simple mention of the defaults, as well as an explicit example, could have prevented me from going astray.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @dimitropoulos!

typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community.

The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately.

Thanks again!


🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint

Copy link
Member

@JamesHenry JamesHenry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs are great, but code would be even better! :)

Please could we add actual validation and feedback to the code that handles this? e.g. if a user gives values which are already handled by default, we tell them. If they give values which don't start with a . we tell them etc

Thanks again for contributing! This kind of feedback that comes from real world experience is invaluable

@dimitropoulos
Copy link
Contributor Author

@JamesHenry ok. I added something, but I have to say I'm not up to speed on this project so I:

  • haven't/can't run the project to ensure my code works (I just did it "by eye")
  • didn't include tests (I would like to, but I don't think I'll have time)
  • don't know what the performance implications are (note a nested loop in the check for a file included that is already a default).
  • don't know if the top of getASTFromProject is the best place to add this kind of code, which, seems like it should be a single responsibility of a different function.

Hopefully that's at least a start? Sorry I can't do more right now (I need to focus on a separate problem I'm experiencing with the parser that's holding up my team).

@bradzacher bradzacher added the documentation Documentation ("docs") that needs adding/updating label Sep 9, 2019
@bradzacher bradzacher changed the title clarify default file extensions and expected format docs(typescript-estree): clarify default file extensions and expected format Sep 9, 2019
@bradzacher
Copy link
Member

you will have to modify the unit tests in typescript-estree/tests/parse.ts appropriately.

you can add tests for your new code in there as well.

@dimitropoulos
Copy link
Contributor Author

@bradzacher I'm sorry, I won't be able to do more with this out of lack of time. If you would like me to remove the code and just update the documentation please let me know and I will happy do so.

@bradzacher bradzacher added the awaiting response Issues waiting for a reply from the OP or another party label Sep 10, 2019
@armano2 armano2 added the help wanted Extra attention is needed label Jan 5, 2020
@armano2 armano2 removed the help wanted Extra attention is needed label Jan 5, 2020
@armano2 armano2 requested a review from JamesHenry January 5, 2020 00:55
Copy link
Member

@bradzacher bradzacher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks for picking this up @armano2

@bradzacher bradzacher removed the awaiting response Issues waiting for a reply from the OP or another party label Jan 5, 2020
@bradzacher bradzacher changed the title docs(typescript-estree): clarify default file extensions and expected format chore(typescript-estree): clarify default file extensions Jan 5, 2020
@bradzacher bradzacher merged commit 3f2f3e8 into typescript-eslint:master Jan 5, 2020
@armano2
Copy link
Collaborator

armano2 commented Jan 5, 2020

we should add test cases for this

@dimitropoulos dimitropoulos deleted the fileExtensions branch January 5, 2020 22:17
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Documentation ("docs") that needs adding/updating
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants