eclint
eclint copied to clipboard
eclint only indents 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
Have you considered using Prettier? It's what I use nowadays.