Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upSpecify eslint-env globally? #122
Comments
This comment has been minimized.
This comment has been minimized.
rlidwka
commented
Apr 22, 2015
|
Put it into |
This comment has been minimized.
This comment has been minimized.
|
@rlidwka, odd, that didn't seem to work: $ standard --version # 3.7.0
$ cat tests/.eslintrc
env:
mocha: true
amd: true
$ standard tests
$ standard tests --verbose
$ cd tests
$ standard
standard: Use JavaScript Standard Style (https://github.com/feross/standard)
./app/tests/lib/blanket_lcov.js:9:0: Unexpected space between function name and paren.
./app/tests/lib/helpers.js:7:0: 'define' is not defined.
./app/tests/mocks/canvas.js:7:0: 'define' is not defined.
./app/tests/mocks/crosstab.js:7:0: 'define' is not defined.
./app/tests/mocks/crosstab.js:13:37: Extra semicolon.
./app/tests/mocks/dom-event.js:7:0: 'define' is not defined.
./app/tests/mocks/file-reader.js:7:0: 'define' is not defined.
./app/tests/mocks/fxa-client.js:7:0: 'define' is not defined.
./app/tests/mocks/history.js:6:0: 'define' is not defined.
./app/tests/mocks/oauth_servers.js:5:0: 'define' is not defined.
./app/tests/mocks/profile.js:7:0: 'define' is not defined.
./app/tests/mocks/router.js:7:0: 'define' is not defined.
./app/tests/mocks/window.js:7:0: 'define' is not defined.
./app/tests/mocks/window.js:59:34: There should be no spaces inside this paren.
...
$ standard | wc -l
standard: Use JavaScript Standard Style (https://github.com/feross/standard)
1554 |
This comment has been minimized.
This comment has been minimized.
|
Just add a Update: See #122 (comment) for a better solution! |
feross
closed this
Apr 22, 2015
This comment has been minimized.
This comment has been minimized.
|
FWIW, we have about 108 .js files in our /app/tests/* directory. |
This comment has been minimized.
This comment has been minimized.
|
What I like about embedding the globals in the comments is that a JavaScript file then becomes standard "certified" in a sense. External configs remove this. @pdehaan I know it's painful as I've done it with a couple of projects now. To ease the pain, what if you whipped up a quick script (using recast or just prepend text) to insert the global comments in every file? |
This comment has been minimized.
This comment has been minimized.
|
@jprichardson Yeah, it's not difficult/impossible to do, but gets exponentially worse if we change our tests to some other library that uses different globals or syntax. I'd either have to go through and search/replace all these crazy But I totally agree with the I disagree with rule X, can you change it docs in the README. Plus the Can you make rule X configurable? docs clearly say:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
matthewadams
commented
Apr 27, 2016
|
So I'm a little confused here. I'm see the same behavior as @pdehaan. However, http://eslint.org/docs/user-guide/configuring#specifying-environments says that the environment In my project, I've simply done Is this expected behavior from
should do the trick. I'd appreciate clarification by a knowledgeable somebody. :) |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
ImanMh
commented
Apr 14, 2018
|
I have |
This comment has been minimized.
This comment has been minimized.
|
@ImanMh Your comment has nothing to do with this issue. Please open a new issue and explain your problem thoroughly. Thanks. |
pdehaan commentedApr 22, 2015
Is there a way to set ESLint environments globally (via config or setting) without having to specify ESLint
eslint-envflags in each file? (ie:/*eslint-env and, mocha */)When I run
$ standardin one of our project's directories, I get a bunch of these warnings in dozens of files: