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

[BUG] [Formatter] #865

Open
3 tasks done
marcodicro-dp opened this issue Jul 16, 2024 · 0 comments
Open
3 tasks done

[BUG] [Formatter] #865

marcodicro-dp opened this issue Jul 16, 2024 · 0 comments
Labels
🦠 bug Something isn't working 🧽 formatter

Comments

@marcodicro-dp
Copy link

System Info

  • OS: Apple M1 Pro. macOS 14.5 (23F79)
  • Python Version (python --version): Python 3.9.18
  • djLint Version (djlint --version): djlint, version 1.34.1
  • template language: django

Issue

The formatter is adding an extra space inside a literal inside a js script, even if format_js is false.

How To Reproduce

Configuration

{
  "profile": "django",
  "max_blank_lines": 2,
  "max_line_length": 100,
  "indent": 2,
  "close_void_tags": true,
  "format_attribute_template_tags": false,
  "format_css": false,
  "format_js": false
}

File original contents (summarized)

{% block body %}
  <script>

    function fillValue(bulk_updatable_values, field, csvFileData) {
      if (bulk_updatable_values[field]) {
        csvFileData.push(`\<values:${bulk_updatable_values[field].join(",")}\>`);
      } else {
        csvFileData.push(`\<fill_value\>`);
      }
    }

  </script>

{% endblock %}

Reformatted file

{% block body %}
  <script>

    function fillValue(bulk_updatable_values, field, csvFileData) {
      if (bulk_updatable_values[field]) {
        csvFileData.push(`\<values:${bulk_updatable_values[field].join(",")}\>`);
      } else {
        csvFileData.push(`\<fill_value \>`);
      }
    }

  </script>

{% endblock %}

Notice the extra space after fill_value inside the else statement

I expected the formatter to leave that js untouched. I also tested setting close_void_tags to true does not change the behavior.

@marcodicro-dp marcodicro-dp added 🦠 bug Something isn't working 🧽 formatter labels Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🦠 bug Something isn't working 🧽 formatter
Projects
None yet
Development

No branches or pull requests

1 participant