FormidableLabs / builder-victory-component

Builder archetype for Victory components
MIT License
1 stars 6 forks source link

No .eslintrc #17

Open philholden opened 8 years ago

philholden commented 8 years ago

package.json contains .eslint as a dev dependency but there is no .eslintrc in the generated project. I am really liking rackt presets:

  "eslint-config-rackt": "^1.1.1",
  "eslint-plugin-react": "^3.8.0",

My .eslintrc looks like this:

{
  "extends": "rackt",
  "env": {
    "mocha": true
  },
  "rules": {
    "react/jsx-uses-react": 1,
    "react/jsx-no-undef": 2,
    "react/wrap-multilines": 2
  },
  "plugins": [
    "react"
  ]
}

Redux now uses rackt for linting as does react-router. It has no semicolons which was a little scary at first but because we are always transpiling we never need to worry about old browser issues that prevented us doing this in the past. You can basically just leave out semi-colons and everything works.

ryan-roemer commented 8 years ago

@philholden -- The builder-victory-component archetype contains the eslint configurations at: https://github.com/FormidableLabs/builder-victory-component/tree/master/config/eslint

Although a controversial topic for sure, we don't rely on ASI here or at Walmart, where we helped develop and maintain the https://github.com/walmartlabs/eslint-config-defaults/ project and the Walmart presets at https://github.com/walmartlabs/eslint-config-defaults/tree/master/configurations/walmart Although generally speaking "You can basically just leave out semi-colons and everything works." is correct, there is no correctness disadvantage to adhering to the actual EMCAScript spec.

And put another way -- there are passionate advocates of both double quotes and single quotes for project within Formidable. For our archetype here it does not really matter which we go with, just that we go with a single choice.

That said, as with all things builder, folks can easily override tasks in their ROOT/package.json as follows:

  1. Either override the three indvidual tasks that comprise lint: https://github.com/FormidableLabs/builder-victory-component/blob/master/package.json#L40-L42

    "lint-server": "eslint --color -c .eslintrc-server *.js",
    "lint-client": "eslint --color --ext .js,.jsx -c .eslintrc-client src demo/*.jsx",
    "lint-client-test": "eslint --color --ext .js,.jsx -c .eslintrc-client-test src test/client",

    where you have the new files .eslintrc-server, .eslintrc-client and .eslintrc-client-test in the root of your project; OR,

  2. Override all of the lint task with a unified .eslintrc in the root of your project.

    "lint": "eslint --color --ext .js,.jsx -c .eslintrc *.js src demo/*.jsx test/client",
philholden commented 8 years ago

@philholden -- The builder-victory-component archetype contains the eslint configurations at: https://github.com/FormidableLabs/builder-victory-component/tree/master/config/eslint

Hi Ryan, I guess what I am saying is it would be nice to have somehow have .eslintrc top level along with .editorconfig as this is where editor linting plugins look for it.

ryan-roemer commented 8 years ago

@philholden -- Do you mean in the generator / boilerplate to create ROOT/.eslintrc or do you mean in https://github.com/FormidableLabs/builder-victory-component/tree/master/config/eslint ?