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

tools: question about some ESLint config options #12566

Closed
vsemozhetbyt opened this issue Apr 21, 2017 · 6 comments
Closed

tools: question about some ESLint config options #12566

vsemozhetbyt opened this issue Apr 21, 2017 · 6 comments
Labels
question Issues that look for answers. tools Issues and PRs related to the tools directory.

Comments

@vsemozhetbyt
Copy link
Contributor

vsemozhetbyt commented Apr 21, 2017

  • Subsystem: tools
  1. Is it worth to set the option parserOptions.sourceType as module in the lib/.eslintrc.yaml? What are pros / cons / breaking changes?

  2. Why don't we use the option root as true in the main .eslintrc.yaml ?

    By default, ESLint will look for configuration files in all parent folders up to the root directory. This can be useful if you want all of your projects to follow a certain convention, but can sometimes lead to unexpected results. To limit ESLint to a specific project, place "root": true inside the eslintConfig field of the package.json file or in the .eslintrc.* file at your project’s root level. ESLint will stop looking in parent folders once it finds a configuration with "root": true.

    Would it spare the linter some fs churn / time?

cc @not-an-aardvark, @silverwind, @Trott

@vsemozhetbyt vsemozhetbyt added question Issues that look for answers. tools Issues and PRs related to the tools directory. labels Apr 21, 2017
@gibfahn
Copy link
Member

gibfahn commented Apr 21, 2017

2. makes sense to me.

@vsemozhetbyt
Copy link
Contributor Author

@gibfahn I think it can even prevent some murky bugs: if somebody forgetfully leaves some .eslintrc config in a parent directory above node repo directory, some node rules can be overwritten.

@silverwind
Copy link
Contributor

  1. there's two issues that come with that option:
  • eslint complains about unneccessary 'use strict'; statements
  • eslint also complains about return in the top scope

why do you want to enable it? We don't have any module files yet, do we?

  1. sounds like a good addition.

@vsemozhetbyt
Copy link
Contributor Author

@silverwind

  1. Oh, it seems I've misunderstood the option. It means ES6 modules, right?
  2. should it be:
root: true

at the top of the main .eslintrc.yaml?

@silverwind
Copy link
Contributor

  1. yes, it means import/export syntax
  2. yeah

@Fishrock123
Copy link
Contributor

Is it worth to set the option parserOptions.sourceType as module in the lib/.eslintrc.yaml?

No. That would be incorrect as those rules are for ES Modules, e.g. no top-level return as silverwind mentioned.

evanlucas pushed a commit that referenced this issue Apr 25, 2017
This option prevents ESlint from unnecessary searching
in parent folders. It also protects ESlint rules
from accidental rewriting by a config in a parent folder.

PR-URL: #12570
Fixes: #12566
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
evanlucas pushed a commit that referenced this issue May 1, 2017
This option prevents ESlint from unnecessary searching
in parent folders. It also protects ESlint rules
from accidental rewriting by a config in a parent folder.

PR-URL: #12570
Fixes: #12566
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
evanlucas pushed a commit that referenced this issue May 2, 2017
This option prevents ESlint from unnecessary searching
in parent folders. It also protects ESlint rules
from accidental rewriting by a config in a parent folder.

PR-URL: #12570
Fixes: #12566
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
gibfahn pushed a commit that referenced this issue May 16, 2017
This option prevents ESlint from unnecessary searching
in parent folders. It also protects ESlint rules
from accidental rewriting by a config in a parent folder.

PR-URL: #12570
Fixes: #12566
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
MylesBorins pushed a commit that referenced this issue May 18, 2017
This option prevents ESlint from unnecessary searching
in parent folders. It also protects ESlint rules
from accidental rewriting by a config in a parent folder.

PR-URL: #12570
Fixes: #12566
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
andrew749 pushed a commit to michielbaird/node that referenced this issue Jul 19, 2017
This option prevents ESlint from unnecessary searching
in parent folders. It also protects ESlint rules
from accidental rewriting by a config in a parent folder.

PR-URL: nodejs/node#12570
Fixes: nodejs/node#12566
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Issues that look for answers. tools Issues and PRs related to the tools directory.
Projects
None yet
Development

No branches or pull requests

4 participants