jednano / eclint

Validate or fix code that doesn't adhere to EditorConfig settings or infer settings from existing code.
MIT License
305 stars 28 forks source link

feature_request(fix): remove leading spaces #155

Open Kristinita opened 5 years ago

Kristinita commented 5 years ago

1. Summary

It would be nice, if eclint fix will remove leading spaces for tabs users.

2. Argumentation

Some tools automatically generate files with leading spaces. eclint fix doesn't fix it and eclint check makes my builds failed.

3. MCVE

[*]
indent_style = tab
indent_size = 4
/*
 * Kira Stylus comment
 */
/*! modernizr 3.6.0 (Custom Build) | MIT *
 * https://modernizr.com/download/?-webp-addtest-fnbind-printshiv-testprop !*/

Leading spaces in KiraECLint.styl and KiraECLint.js.

4. Steps to reproduce

eclint check
eclint fix
eclint check

5. Expected behavior

Remove leading spaces after fix, successful check.

6. Actual behavior

D:\SashaDebugging\Eclint>eclint check
KiraECLint.js
    02:01 ❌️ invalid indent style: space, expected: tab
                                                        (EditorConfig indent_style https://goo.gl/8Qkrbr)
KiraECLint.styl
    02:01 ❌️ invalid indent style: space, expected: tab
                                                        (EditorConfig indent_style https://goo.gl/8Qkrbr)
    03:01 ❌️ invalid indent style: space, expected: tab
                                                        (EditorConfig indent_style https://goo.gl/8Qkrbr)

D:\SashaDebugging\Eclint>eclint fix

D:\SashaDebugging\Eclint>eclint check
KiraECLint.js
    02:01 ❌️ invalid indent style: space, expected: tab
                                                        (EditorConfig indent_style https://goo.gl/8Qkrbr)
KiraECLint.styl
    02:01 ❌️ invalid indent style: space, expected: tab
                                                        (EditorConfig indent_style https://goo.gl/8Qkrbr)
    03:01 ❌️ invalid indent style: space, expected: tab
                                                        (EditorConfig indent_style https://goo.gl/8Qkrbr)

Thanks.

nschonni commented 5 years ago

Think you need to set the block_comment option https://github.com/jedmao/eclint#block_comment

gucong3000 commented 5 years ago

https://github.com/jedmao/eclint#support-for-doc-comments

Kristinita commented 5 years ago

@nschonni, @gucong3000, Status: partially fixed

+ — eclint check doesn't show errors

- — eclint fix doesn't remove leading spaces in comments

Is it possible remove leading spaces? They are not needed.

Thanks.

nschonni commented 5 years ago

My comment was about comment blocks (😉 ) that were being flagged in your example. There are 3 editorconfig settings that deal specifically with comment blocks, that are separate from the indent settings.