Skip to content
This repository has been archived by the owner on Mar 9, 2019. It is now read-only.

Linting for ES6 + JSCS rules #1

Open
NickGlenn opened this issue Jun 16, 2015 · 5 comments
Open

Linting for ES6 + JSCS rules #1

NickGlenn opened this issue Jun 16, 2015 · 5 comments
Labels

Comments

@NickGlenn
Copy link
Contributor

Linting support for ES6 and rule set up for Javascript Code Style.

@NickGlenn NickGlenn added the task label Jun 16, 2015
@NickGlenn NickGlenn added this to the Initial Set Up milestone Jun 16, 2015
@brunnerjosh brunnerjosh removed this from the Initial Set Up milestone Jun 16, 2015
@NickGlenn
Copy link
Contributor Author

ESLint offers linting for ES5 - ES7 and code style enforcement. This may be the better option over jshint and jscs.

@brunnerjosh
Copy link
Contributor

I need this rule to be added in so that I can define styles below my React class definition.
"no-use-before-define" : 0

@MarkTA
Copy link

MarkTA commented Jul 12, 2016

A few suggestions:

  1. no-console & no-alert should be disabled. Some designs call for alert and confirm boxes, and console.logs are necessary for errors.
  2. prefer-template "Unexpected string concatenation" should be disabled. This throws an error when string concatenation happens in an object value, which is sometimes called for and would be superfluous to concat in a variable before hand.
    eg:

const style = { width : 118 + 'px', height : 118 + 'px', lineHeight : 120 + 'px', };

  1. no-underscore-dangle should be removed. Throws an error when identifiers begin with underscores. I do not name variables or functions myself beginning with an underscore, but it is popular to do so in a lot of npm packages.
    eg:
    this.props._onClick()
  2. vars-on-top should be removed. Throws an error when vars are not defined at the top of a function. Sometimes the code is easier to read when vars are declared directly above where you need them. For example, if you have a long function with an if statement and a for loop, it would be nice to define a variable used only in the for loop right before it rather than declaring it way out of sight.

@NickGlenn
Copy link
Contributor Author

The idea behind no-console and no-alert is that you don't use these outside of development, or rather, prevent them from being committed so deployments to production environments aren't littered with these methods. I agree that no-alert should be disabled, but I think no-console could be good for habit building as console logs in production is a pet-peeve of mine.

I agree with prefer-template and no-underscore-dangle as well. I use preceding underscores frequently to denote "private" or "hidden" variables. However, vars-on-top is often considered a good practice and I would like to see that utilized.

@brunnerjosh
Copy link
Contributor

I would like to also add this rule because there are many instances while using a switch statement that do not need a default. "default-case" : 0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants