Fix for .vue files to inject header comment in script tag.#32
Open
just-at-uber wants to merge 13 commits intoStuk:mainfrom
Open
Fix for .vue files to inject header comment in script tag.#32just-at-uber wants to merge 13 commits intoStuk:mainfrom
just-at-uber wants to merge 13 commits intoStuk:mainfrom
Conversation
Open
Owner
|
Thanks for the PR! Would you be able to add some tests please? And also, would you update the Readme with an example for a |
Author
|
No problem at all. Will try to update today. |
Author
|
Hi @Stuk , I have done the following:
Please let me know if you need anything else from me. Thanks! |
Author
|
Any idea when this will get merged in? Is there anything I'm missing from getting this merged? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change essentially scans for a
<script>tag as the first element in a.vuefile and checks for any comments within the script block. If it doesn't find a comment, it will inject as expected on auto-fix.There are caveats to be aware of:
<script>tag must be defined within a .vue file, otherwise the linter will crash.<script>tag must be defined at the top of a .vue file, otherwise the linter won't realize the comment is in the file and will inject it multiple times.<script>tag must contain at leastexport default { name: 'component-name' }otherwise the linter won't realize the comment is in the file and will inject it multiple times.Thanks for maintaining this project as this suits exactly my projects needs (apart from no
.vuesupport). Hopefully other developers in the community are able to fix the above caveats for their needs.Thanks!
Screenshots
Before lint

After lint
