daresaydigital / code-standard

Code standards that we use for different projects
MIT License
5 stars 3 forks source link

Linting for JavaScript #2

Closed simon-johansson closed 9 years ago

simon-johansson commented 9 years ago

We probably want some linting for JavaScript as well. I think the most used linter is jshint but I prefere and use eslint, has better es6/7 & JSX support. This is a good read on the subject, especially if you are a Sublime user: https://medium.com/@dan_abramov/lint-like-it-s-2015-6987d44c5b48

What do you guys use at the moment?

kurtsson commented 9 years ago

I also prefer eslint over jshint. When on the subject, this is also a rather good linter: http://www.coffeelint.org/ @simon-johansson

kurtsson commented 9 years ago

Suggestion @simon-johansson, @josegranjo, @kimf:

{
    "rules": {
        "indent": [
            2,
            2
        ],
        "quotes": [
            2,
            "single"
        ],
        "linebreak-style": [
            2,
            "unix"
        ],
        "semi": [
            2,
            "always"
        ]
    },
    "env": {
        "es6": true,
        "node": true,
        "browser": true
    },
    "extends": "eslint:recommended",
    "ecmaFeatures": {
        "jsx": true,
        "experimentalObjectRestSpread": true
    },
    "plugins": [
        "react"
    ]
}
kurtsson commented 9 years ago

PR

josegranjo commented 9 years ago

Using jshint at the moment, but eslint looks the way-to-go. I think we have some more specific rules for the project, that are also synced with the code-analysis step in the building tools. Example: no-invalid-this http://eslint.org/docs/rules/no-invalid-this

Should those be added? Maybe they are not so important and too strict?

kurtsson commented 9 years ago

Or should we have different flavors of projects? Like web-react and web-middleman?

kimf commented 9 years ago

I usually just extend this: https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb

Maybe make our own basic version and a couple of flavours as well?

On Monday, September 21, 2015, Martin Kurtsson notifications@github.com wrote:

Or should we have different flavors of projects? Like web-react and web-middleman?

— Reply to this email directly or view it on GitHub https://github.com/screeninteraction/code-standard/issues/2#issuecomment-142011099 .

Mvh Kim Fransman

kurtsson commented 9 years ago

Can I close this? We have Eslint in the template now

kimf commented 9 years ago

I think so, But maybe we can create a new one about creating our own extendable npm module

kimf commented 9 years ago

Closed this and moved the npm module issue to #4