Node: tools: question about some ESLint config options

Created on 21 Apr 2017  路  6Comments  路  Source: nodejs/node

  • 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鈥檚 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

question tools

Most helpful comment

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.

All 6 comments

2. makes sense to me.

@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.

  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.

@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?

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

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danielstaleiny picture danielstaleiny  路  3Comments

loretoparisi picture loretoparisi  路  3Comments

stevenvachon picture stevenvachon  路  3Comments

filipesilvaa picture filipesilvaa  路  3Comments

srl295 picture srl295  路  3Comments