Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,24 @@

```

- Remove all trailing whitespace

```javascript
// bad
function() {∙∙
var name;
∙∙
// ... stuff ...
}

// good
function() {
var name;

// ... stuff ...
}
```

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good call. It would be the most excellent if we could also include guides on how to set up automatic trailing space removal in various IDEs/text editors.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need go fmt for JS

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tools exist although they're not as comprehensive:

https://github.com/jshint/fixmyjs
https://github.com/millermedeiros/esformatter

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sublime Text has the trim_trailing_white_space_on_save setting for this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah sublime is
Preferences / Settings - User" to add the following:
{ "trim_trailing_white_space_on_save": true }

IntelliJ under preferences, editor
https://i.imgur.com/JDKfldN.png

JSCS has autofix (jscs src --fix) as of 1.12 and working on applying it to all rules.

- Use indentation when making long method chains.

```javascript
Expand Down
Loading