Don't report user-defined createApp function in vue/one-component-per-file#2203
Draft
candy-Tong wants to merge 6 commits intovuejs:masterfrom
Draft
Don't report user-defined createApp function in vue/one-component-per-file#2203candy-Tong wants to merge 6 commits intovuejs:masterfrom
createApp function in vue/one-component-per-file#2203candy-Tong wants to merge 6 commits intovuejs:masterfrom
Conversation
ed050e9 to
257c814
Compare
2 tasks
FloEdelmann
requested changes
Jun 5, 2023
Member
FloEdelmann
left a comment
There was a problem hiding this comment.
Thanks for implementing a fix! I have one comment, see below :)
createApp function in vue/one-component-per-file
FloEdelmann
approved these changes
Jun 21, 2023
Member
FloEdelmann
left a comment
There was a problem hiding this comment.
Looks good to me now, thanks :)
ota-meshi
requested changes
Jul 2, 2023
| // for Vue.js 3.x | ||
| // createApp({}) | ||
|
|
||
| const variable = findVariable(context.getScope(), callee) |
Member
There was a problem hiding this comment.
Sorry for the late reply. I am busy with office work.
I think it can be written more simply using tracker.iterateEsmReferences.
https://eslint-community.github.io/eslint-utils/api/scope-utils.html#tracker-iterateesmreferences
e.g.
const tracker = new ReferenceTracker(context.getSourceCode().scopeManager.globalScope)
const traceMap = utils.createCompositionApiTraceMap({
[ReferenceTracker.ESM]: true,
createApp: {
[ReferenceTracker.CALL]: true
}
})
if ([...tracker.iterateEsmReferences(traceMap)].every(({ node }) => node !== callee)) {
return null;
}
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.
No description provided.