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

eclint only indents comments #160

Open stillwondering opened 5 years ago

stillwondering commented 5 years ago

Description

eclint only indents comments in a JS file, everything else is kept as it is.

How to reproduce

Example JS file:

/*
 * Some comment on the module.
 */
var driver = (function() {

  /*
   * This is some property.
   */
  var property = null;

  /*
   * Get the property.
   */
  var getProperty = function() {
    return property;
  };

  return {
    getProperty: getProperty
  };
})();

.editorconfig in use:

root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
$ eclint fix app.js

The result of this command is:

/*
 * Some comment on the module.
 */
var driver = (function() {

  /*
    * This is some property.
    */
  var property = null;

  /*
    * Get the property.
    */
  var getProperty = function() {
    return property;
  };

  return {
    getProperty: getProperty
  };
})();

As we see, the only thing that's changed are the comments inside of the closure (which are not properly indented, either). The property and the method are not changed. I'd expect the file to be indented using four spaces.

Version

$ eclint --version
2.8.1
jednano commented 5 years ago

Have you considered using Prettier? It's what I use nowadays.