airbnb/javascript

No more env: browser?

tleunen opened this issue · 5 comments

Did something change recently in the env configuration?

I just updated to the latest version in one project and I'm getting a lot of error 'document' is not defined no-undef.

This is resolved when I manually set the "browser" env in my config but I wonder why it's not done automatically here instead, like it used to be.

Which package - eslint-config-airbnb, or eslint-config-airbnb-base?

It looks like v3 of eslint-config-airbnb-base did supply the env via "legacy" (https://npmcdn.com/eslint-config-airbnb-base@3.0.1/index.js) but v4 of that package no longer did so (https://npmcdn.com/eslint-config-airbnb-base@4.0.2/index.js).

That seems like a reasonable thing to reintroduce to the base config, which would eventually make its way back to the main config.

However, it's also true that all top-level apps should be defining their own "env" values anyways, so perhaps its best to keep them unspecified?

So I'm updating from v9.0.1 to v10.0.0 on the main config.
9.0.1 uses the base v3. And 10.0.0 uses base v5.

I can understand why this disappeared from the base configuration (often used for Node application), but React runs in the browser in the end, so maybe it would be a good thing to reintroduce it in the main config only?

Also, why a top level app should define their own env? I used to only use what your config provides and overrides the "mocha" value in my tests only. But if you decide to not add it back to the config, I can specify them myself. No worries :)

Our React runs in both the browser and node, and our app sets both envs to true in its top-level config.

The top-level app is the only thing that truly knows its own environment - node, browser, tests, amd, etc.

I'm not opposed to adding it back, but the more I think about it, the more I think it's not a shareable config's job to set them.

Agreed. Thanks :)