-
-
Notifications
You must be signed in to change notification settings - Fork 16
feat: new command keep-aligned
#32
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
Conversation
✅ Deploy Preview for resonant-bonbon-a310e6 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
eslint.config.js
Outdated
'style/max-statements-per-line': 'off', | ||
'style/no-multi-spaces': 'off', | ||
'style/comma-spacing': 'off', | ||
'antfu/consistent-list-newline': 'off', |
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.
We shouldn't disable them globally to support this optional command.
Instead, we could document and tell users to disable these rules with inline comments.
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.
This was the only way I was able to get past the linter hooks, I tried disabling the specific markdown file but it didn't seem to work, not sure why exactly. I definitely agree it should be mentioned in the docs, I will make an update on this.
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 added the docs and edited the ESLint file removing the global rules. I ended up having to ignore the markdown file entirely because even if you disable the right rules, the example I provided at the end to demonstrate the ESlint ignore usage will complain about unused eslint-disable directive, which I have not idea how to suppress...
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.
Just found out about eslint-skip 😂. It should work now without ignoring the file or disabling global eslint rules.
Description
This PR implements the
keep-aligned
command, it accepts a list of symbols to align and an optional*
at the end to indicate a repeating patternExample
Linked Issues
closes #31
Caveats and Possible Enhancements
This rule does NOT work well with other spacing rules, namely
style/no-multi-spaces, style/comma-spacing, antfu/consistent-list-newline
were disabled for the example in the markdown file to work. I don't know if it's possible for this rule to disable related spacing rules on-demand, but currently, the best solution is to disable specific eslint rules for the range/line affected by this command.Currently which symbols to align by must be declared for this command to function. It might be possible to infer the alignment symbols based on the current alignment.