-
Notifications
You must be signed in to change notification settings - Fork 36
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
Fix for .vue files to inject header comment in script tag. #32
base: main
Are you sure you want to change the base?
Conversation
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 |
No problem at all. Will try to update today. |
Hi @Stuk , I have done the following:
Please let me know if you need anything else from me. Thanks! |
Any idea when this will get merged in? Is there anything I'm missing from getting this merged? |
This change essentially scans for a
<script>
tag as the first element in a.vue
file 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
.vue
support). Hopefully other developers in the community are able to fix the above caveats for their needs.Thanks!
Screenshots
Before lint
After lint