-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
feat: add svelte/component-tags-order
rule
#498
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 5ac917d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
.npmrc | ||
tests/fixtures/rules/component-tags-order |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can I disable prettier for specific file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I often use <!-- prettier-ignore -->
, but it is OK to use a .prettierignore
file.
eslint-plugin-svelte/tests/fixtures/rules/indent/invalid/4-indent/test01-input.svelte
Line 1 in e386e34
<!-- prettier-ignore --> |
"error", | ||
{ | ||
"order": [ | ||
"SvelteScriptElement([context=module])", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I don't think it's a good idea to use a format specifically for this rule.
For example, using the CSS selector format most users already know the format. (However, users may be a little surprised because the colon must be escaped. e.g. svelte\:options
)
Is the format currently used by the rule inspired by something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied most parts from https://eslint.vuejs.org/rules/component-tags-order.html
And while implementing the rule, I felt that we need to support and
condition, but I couldn't find the way to use and
condition in the ESLint selector.
https://eslint.org/docs/latest/extend/selectors
And I think that the ESLint selector is complicated for most users because they need to understand Svelte ESLint AST.
That's why I go to use a special format.
(But yeah, I didn't support escaping things...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And while implementing the rule, I felt that we need to support
and
condition, but I couldn't find the way to useand
condition in the ESLint selector.
Are you saying we can't use and
in CSS selectors?
I think that the and condition in the CSS selector just connects without using spaces. e.g. script[context=module][lang=ts]
And in modern CSS selectors the or
condition uses :is()
. e.g. :is(script, style)
I agree that esquery is difficult for users to understand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, eslint-plugin-vue implements a function that converts CSS selectors to matchers in order to use CSS selectors in defining vue/component-tags-order
rule option.
Hi, |
The repository has been migrated to a monorepo. |
close: #493