eclint icon indicating copy to clipboard operation
eclint copied to clipboard

eclint only indents comments

Open stillwondering opened this issue 5 years ago • 1 comments

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

stillwondering avatar May 22 '19 08:05 stillwondering

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

jednano avatar May 22 '19 15:05 jednano