Skip to content
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 doubling of new lines and adding indent ignore feature #33

Merged
merged 3 commits into from
Jul 31, 2023

Conversation

npdev453
Copy link
Contributor

@npdev453 npdev453 commented Jul 28, 2023

9da5b34 Fixes: #10
(because now it cause linting loop)

ignoreBaseIndent makes this plugin usable with unicorn/template-indent (or with striptIndent template lit itself)
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/template-indent.md (because now it cause linting loop)
that in some mind can close #31

@npdev453
Copy link
Contributor Author

@gajus please take a look, minimal unbreaking changes.

@gajus gajus merged commit a312e95 into gajus:main Jul 31, 2023
@gajus
Copy link
Owner

gajus commented Jul 31, 2023

Thank you

@github-actions
Copy link

🎉 This PR is included in version 2.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@npdev453
Copy link
Contributor Author

npdev453 commented Aug 1, 2023

Usage exmaple:

        {
            plugins: ["sql", "unicorn"],
            rules: {
                'unicorn/template-indent': [
                    'warn', {
                        indent: 4,
                        tags: ['sql']
                    }
                ],
                "sql/format": [
                    'warn',
                    {
                        ignoreBaseIndent: true,
                        ignoreExpressions: false,
                        ignoreInline: false,
                        ignoreTagless: true
                    }, {
                        commaBreak: true
                    }
                ]
            }
        }

@karlhorky
Copy link

@npdev453 can you take a video or 2 to show what it looks like in the editor using ESLint automatic fixing?

Wonder if there's a way to apply auto-fix only for singular rules (there are other rules where I don't want it to automatically fix, but rather warn as a prompt for me to come up with my own solution)

@npdev453
Copy link
Contributor Author

npdev453 commented Aug 5, 2023

@npdev453 can you take a video or 2 to show what it looks like in the editor using ESLint automatic fixing?

Wonder if there's a way to apply auto-fix only for singular rules (there are other rules where I don't want it to automatically fix, but rather warn as a prompt for me to come up with my own solution)

@karlhorky Done! https://youtu.be/9bZgvHfSnrQ
@gajus take a look, heh.

IYouTube

About second question, maybe something like that
https://github.com/chiefmikey/eslint-plugin-disable-autofix

@karlhorky
Copy link

karlhorky commented Oct 26, 2023

For anyone finding this and looking for another alternative for formatting SQL in embedded sql tagged template literals:

Prettier can be used with the combination of the prettier-plugin-embed and prettier-plugin-sql plugins:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Format: Empty second line in query template string marked as error but not autofixed
3 participants