voorhoede/riotjs-style-guide

Add '.eslintrc' ?

jpsc opened this issue · 11 comments

jpsc commented

A nice add to the repo would be a .eslintrc config file that complements the style guide.

combine with #23? or add a section "configure your linters"?

@jpsc what works better in your experience? https://www.npmjs.com/package/eslint-plugin-html or https://www.npmjs.com/package/eslint-plugin-riot or ...? I suppose the html plugin works for both ES5 and ES6 code.

jpsc commented

@phortuin has been using the first one with success.

I would leave it at recommendations for setting up a lint file. There's too many dependencies to make this a one-size-fits-all (ex: for use with Sublime, you need to globally install npm packages, SublimeLinter and the SL Riot package)

But we can provide a .eslintrc example file right? What plugin you use to interpret that file, is up to the developer, but we can provide the configuration?

@petergoes To me this project aims to be a set of guidelines rather than a boilerplate. Therefore I would refrain from any example files. Rather, like I think @phortuin as saying as well, suggest which plugins to use and how to configure them to understand Riot.

For example: use eslint-plugin-html and add the following to your .eslintrc file:

{
    "plugins": [
        "html"
    ],
    "globals": {
        "opts": true,
        "riot": true
    }
}

@jpsc or @phortuin want to start a PR for this?

I think it should be simpler still; just mention that people should use a linter, that we prefer eslint, and then add opts & riot to the globals, and probably use a plugin to properly lint script tags in html files. We should put a comment with it stating that setting up eslint/packages/... etc is not within the scope of this style guide but that we can surely help people via DM or email. If we even mention eslint-plugin-html and it breaks, we need to update our guide, or suggest alternative, etc. The style guide should be rock solid and environment/preference free and future proof

If the project is just a set of guidelines, then I would leave out the whole linter thing altogether. Maybe mention that you should lint your code, but leave it like that. Like @phortuin said, when stuff breaks in eslint land, we need to take action.

jpsc commented

I'm pretty sure the PR was to reference those things on the doc, not actually adding the .estlintrc file.

Closed: please create new issue and/or PR for guideline; the original issue was adding an .eslintrc file, which we agreed to not do.