vkadam / grunt-jsbeautifier

Beautify js, css, html and json files using Grunt and https://github.com/einars/js-beautify
MIT License
119 stars 28 forks source link

bug(options): wrapLineLength: 0 not by default #64

Open Kristinita opened 6 years ago

Kristinita commented 6 years ago

1. Summary

Default options documentation.

But wrapLineLength: 0 not default as it is written in documentation.

2. Environment

3. Configuration

See example configuration in SashaJsBeautifyTabs branch of my demo repository:

.travis.yml:

language: node_js

node_js:
- node

install:
- npm install -g eclint grunt-cli
- npm install

script:
- grunt jsbeautifier
- eclint check SashaJsBeautifyTabs.html

SashaJsBeautifyTabs.html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
But <a href="https://productforums.google.com/d/msg/docs/YJ09uwy-pWU/g_1AJTXZN6QJ" target="_blank">notifications are only sent to the email address associated with your Google account</a>. <a href="https://support.google.com/mail/answer/10957?hl=en" target="_blank">mail forwarding</a>
</body>
</html>

.editorconfig:

[*]
indent_style = tab
insert_final_newline = true

4. Steps to reproduce

grunt jsbeautifier

eclint check SashaJsBeautifyTabs.html

5. Expected behavior

If Gruntfile.coffee:

module.exports = (grunt) ->

    grunt.loadNpmTasks('grunt-jsbeautifier')
    grunt.initConfig
        jsbeautifier:
            options:
                html:
                    indentWithTabs: true
                    endWithNewline: true
                    wrapLineLength: 0
            files: ['SashaJsBeautifyTabs.html']

or:

js-beautify -rn SashaJsBeautify.html

Modified SashaJsBeautifyTabs.html:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>

<body>
    But <a href="https://productforums.google.com/d/msg/docs/YJ09uwy-pWU/g_1AJTXZN6QJ" target="_blank">notifications are only sent to the email address associated with your Google account</a>. <a href="https://support.google.com/mail/answer/10957?hl=en" target="_blank">mail forwarding</a>
</body>

</html>

See Travis CI build.

6. Actual behavior

Else Gruntfile.coffee:

module.exports = (grunt) ->

    grunt.loadNpmTasks('grunt-jsbeautifier')
    grunt.initConfig
        jsbeautifier:
            options:
                html:
                    indentWithTabs: true
                    endWithNewline: true
            files: ['SashaJsBeautifyTabs.html']

Modified SashaJsBeautifyTabs.html:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>

<body>
    But <a href="https://productforums.google.com/d/msg/docs/YJ09uwy-pWU/g_1AJTXZN6QJ" target="_blank">notifications are only sent to the email address associated with your Google account</a>. <a href="https://support.google.com/mail/answer/10957?hl=en"
        target="_blank">mail forwarding</a>
</body>

</html>

Spaces before target="_blank", despite the fact that indentWithTabs: true:

See Travis CI build.

Thanks.

Kristinita commented 6 years ago

Status: :x: Still doesn't work for me

If configuration as in this answer.

Thanks.