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

.eslintrc files should build on default settings #372

Closed
martinheidegger opened this issue Jun 17, 2015 · 6 comments
Assignees
Labels
Milestone

Comments

@martinheidegger
Copy link
Contributor

@martinheidegger martinheidegger commented Jun 17, 2015

So I have started a lab project and I disagree with one particular eslint setting. To change it setting-up a .eslintrc file seems to be most appropriate. However: when I add the file it replaces the .eslintrc settings of lab and falls back on all the standard eslint settings. This is not easy to follow/understand and annoying to fix.

It makes sense to me that it is done this way this because an .eslintrc file means that who-ever added this expects the standard .eslintrc behaviour. I do not see a good argument why the default of lab is not the default of eslint. There could be an option -n hapi-eslint for the convenience of hapi developers if necessary but then I would expect that hapi-eslint has a .hapieslintrc file that extends on the settings of hapi-eslint.

@AdriVanHoudt

This comment has been minimized.

Copy link
Contributor

@AdriVanHoudt AdriVanHoudt commented Jun 17, 2015

The default of Lab is the default for all hapi projects, it's this way because Lab is made for hapi primarily. And your point is that you want to run Lab with default linting rules without having to use your own config right?

@martinheidegger

This comment has been minimized.

Copy link
Contributor Author

@martinheidegger martinheidegger commented Jun 17, 2015

@AdriVanHoudt No, this is not the point of this request. It is about inconsistency of the lint settings. Lets try to explain it differently:

lab -L → Uses the hapi linting (with all the custom hapi settings)
Add .eslintrc → Suddenly uses regular eslint settings?!

What if I want to change just one setting of hapi linting?

The default for lab -n is named wrong. I propose a rename of eslinthapi-eslint and it shouldn't use the .eslintrc but .hapi-eslintrc by default and builds on the settings that lab adds by default. And also I propose adding another mode lab -n eslint that uses the .eslintrc of eslint as it is used now.

@AdriVanHoudt

This comment has been minimized.

Copy link
Contributor

@AdriVanHoudt AdriVanHoudt commented Jun 17, 2015

That's just the way eslint works. Lab just uses the code version of eslint which behaves the same as the cli. If you want to use the settings from lab as a base (like me) add "extends": "./node_modules/lab/lib/linters/eslint/.eslintrc", to your config. See http://eslint.org/docs/user-guide/configuring#extending-configuration-files. And then you can enable/disable/add rules as you please. As for having a setting for standard eslint rules you can just add your own config file which would do this as you stated, personally I don't see the extra option as to useful, does it happen a lot that people want to use the standard linting rules without any changes? Also you can use eslint --init to easily create the standard config for you (http://eslint.org/blog/2015/05/eslint-0.21.0-released/#config-initialization)

@martinheidegger

This comment has been minimized.

Copy link
Contributor Author

@martinheidegger martinheidegger commented Jun 17, 2015

Your explanation makes it easy to understand how it works but it is neither intuitive, documented, comfortable-to-use or consistent.

@AdriVanHoudt

This comment has been minimized.

Copy link
Contributor

@AdriVanHoudt AdriVanHoudt commented Jun 17, 2015

This is just how eslint work afaik you can read the whole thing here http://eslint.org/docs/user-guide/configuring
As for the docs, I had a quick look at the docs and indeed they are not clear, they don't state that the default linting is with hapi styleguide rules and don't even mention jslint or that you can override the eslint rules, a PR for this would be very welcome

@hueniverse

This comment has been minimized.

Copy link
Member

@hueniverse hueniverse commented Jun 17, 2015

The only right action here is to fix the docs, not the behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.