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

quotes: add option to ignore string literals #400

Closed
4 tasks done
remcohaszing opened this issue May 18, 2024 · 2 comments · Fixed by #401 or #402
Closed
4 tasks done

quotes: add option to ignore string literals #400

remcohaszing opened this issue May 18, 2024 · 2 comments · Fixed by #401 or #402
Labels
enhancement New feature or request

Comments

@remcohaszing
Copy link
Contributor

Clear and concise description of the problem

I use Prettier for formatting. Prettier enforces a consistent quote style. However, Prettier does not enforce using string literals over template strings. To enforce this, I’m using the @stylistic/quotes rule. The downside is that:

  1. The configuration of @stylistic/quotes needs to match the Prettier configuration.
  2. Incorrectly quoted strings are reported by both @stylistic/quotes and eslint-plugin-prettier.

Suggested solution

Add an option ignoreStringLiterals. When this is used, only template literals are checked.

Alternative

Don’t do anything 🤷

Additional context

No response

Validations

Contributes

  • If this feature request is accepted, I am willing to submit a PR to fix this issue
@remcohaszing remcohaszing added the enhancement New feature or request label May 18, 2024
@antfu
Copy link
Member

antfu commented May 18, 2024

So you want ESLint to enforce the use of literal quotes whenever possible for template strings, but don't care about which quotes to use, right?

If it's a few lines of code I don't mind to have them - PR welcome :)

remcohaszing added a commit to remcohaszing/eslint-stylistic that referenced this issue May 18, 2024
When `ignoreStringLiterals` is enabled, only template literals are
reported, not string literals.

Closes eslint-stylistic#400
@remcohaszing
Copy link
Contributor Author

Exactly!

PR submitted :)

github-merge-queue bot pushed a commit that referenced this issue May 18, 2024
When `ignoreStringLiterals` is enabled, only template literals are
reported, not string literals.

Closes #400
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants