Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

also add a coding style standard? #43

Open
smeijer opened this issue Jan 26, 2016 · 6 comments
Open

also add a coding style standard? #43

smeijer opened this issue Jan 26, 2016 · 6 comments

Comments

@smeijer
Copy link

smeijer commented Jan 26, 2016

Besides a directory layout and such things, I think it's also pretty convinient to have some linter configurations inside this repo?

Something like a .jscsrc, .jshintrc, .eslintrc ? I think we can use the file in the sample-blog-app to get started: https://github.com/mantrajs/mantra-sample-blog-app/blob/master/.eslintrc

@arunoda
Copy link
Collaborator

arunoda commented Jan 26, 2016

That's the file we use and it's good. Yeah. It's better to put it in this repo. If possible send me a PR and add a section on the spec too.

@mquandalle
Copy link

Instead of opt-in for each rule one by one, I would rather base the linter configuration on some popular configuration like https://github.com/airbnb/javascript and then tweak it a bit if that’s needed.

@zimt28
Copy link

zimt28 commented Feb 28, 2016

+1 for a style guide. Alternatives to Airbnb's guide would be the JavaScript Standard Style and idiomatic.js

@arunoda
Copy link
Collaborator

arunoda commented Feb 29, 2016

Yeah. We can go with Airbnb style guide with some minor changes. I'll add what we can add and remove. Then we can discuss here properly.

@smeijer
Copy link
Author

smeijer commented Mar 25, 2016

It appears there is an eslint config in the official guide. Will the mantra code style be compatible with that, or is the idea to extend it with custom rules / create our own style?

copied from: http://guide.meteor.com/v1.3/code-style.html#eslint

install:

npm install --save-dev eslint eslint-plugin-react eslint-plugin-meteor eslint-config-airbnb

.eslintrc

{
    "plugins": [
      "meteor"
    ],
    "extends": [
      "airbnb/base",
      "plugin:meteor/guide"
    ],
    "rules": {}
  }

note:

Use "airbnb/base" for a normal ecmascript-based config and "airbnb" in a React project.

@arunoda
Copy link
Collaborator

arunoda commented Mar 25, 2016

It's unclear we need meteor plugin since it has a lot of blaze stuff and simply we don't need them. (But I get it for the server side, we need some of them)

We were started to use this:

{
  "extends": "airbnb",
  "rules": {
    "react/jsx-no-bind": 0,
    "react/jsx-uses-react": 1,
    "arrow-body-style": 0,
    "prefer-arrow-callback": 0,
    "func-names": 0
  },
  "parserOptions": {
    "ecmaVersion": 6,
    "ecmaFeatures": {
      "experimentalObjectRestSpread": true
    }
  }
}

This works pretty well for us. I'm starting to move this in.
I didn't play with meteor/guide eslint version. Need to try that.

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

No branches or pull requests

4 participants