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

reconsider the defaults of eslint config #14588

Closed
aladdin-add opened this issue May 14, 2021 · 6 comments
Closed

reconsider the defaults of eslint config #14588

aladdin-add opened this issue May 14, 2021 · 6 comments
Assignees
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion breaking This change is backwards-incompatible core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion Stale
Projects

Comments

@aladdin-add
Copy link
Member

aladdin-add commented May 14, 2021

things has changed since eslint was created in 2013. It is time to reconsider the defaults of eslint config.
I would suggest the changes:

  1. sourceType: "script" => "module"
  • native esm has been supported by latest modern browsers and node.js
  • a large number of devs are writing esm, and using something like babel/ts to support older browser/node.js versions.
  1. ecmaVersion: 5 => "latest"
    we have often got issues like "unexpected token...." just because not config ecmaVersion. e.g. False positive: Unexpected token , #11643
    the change should be good for users & maintainers.

  2. --ext: ".js" => ".js,.mjs,.cjs"

it is a breaking change, but it's very easy to restore the old behaviour

{
  "parserOptions": {"ecmaVersion": 5, "sourceType": "script",}
}

if we agreed to the change, document & eslint --init should be updated to reflect the change, too.

@aladdin-add aladdin-add added enhancement This change enhances an existing feature of ESLint triage An ESLint team member will look at this issue soon core Relates to ESLint's core APIs and features labels May 14, 2021
@eslint-github-bot eslint-github-bot bot added this to Needs Triage in Triage May 14, 2021
@aladdin-add aladdin-add added evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion breaking This change is backwards-incompatible and removed triage An ESLint team member will look at this issue soon labels May 14, 2021
@aladdin-add aladdin-add moved this from Needs Triage to Ready for Dev Team in Triage May 14, 2021
@nzakas
Copy link
Member

nzakas commented May 22, 2021

We can consider this when we move to flat config. Changing this for eslintrc is likely to break a lot of existing users’ configurations.

@nzakas nzakas moved this from Ready for Dev Team to Feedback Needed in Triage May 22, 2021
@btmills
Copy link
Member

btmills commented May 29, 2021

I like @nzakas' idea. Flat config gives us a chance to update defaults in a way that likely reduces migration difficulty.

@aladdin-add
Copy link
Member Author

agreed. I will update the OP later.

@github-actions
Copy link

Oops! It looks like we lost track of this issue. @eslint/eslint-tsc what do we want to do here? This issue will auto-close in 7 days without an update.

@github-actions github-actions bot added the Stale label Oct 15, 2021
@nzakas nzakas self-assigned this Oct 16, 2021
@nzakas
Copy link
Member

nzakas commented Oct 16, 2021

I’ll handle this as I’m working on the new config.

mdjermanovic added a commit that referenced this issue Dec 4, 2021
* Update: Flat config support in Linter (refs #13481)

* Update lib/linter/linter.js

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>

* Update lib/linter/linter.js

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>

* Clean up FlatConfigArray detection

* Add back FlatConfigArray import

* More flat config tests passing; originals failing

* Finish languageOptions features

* Make sure to recognize RuleTester-wrapped Espree

* Move globals into local file

* Normalize ecmaVersion to year on context.languageOptions

* Clean up ecmaVersion normalization

* Revert parserOptions.ecmaVersion behavior to original

* Add more tests

* Update defaults for flat config (refs #14588)

* More tests passing

* Fix wrong ecmaVersion conversion

* Duplicated all tests for FlatConfig

* Finish languageOptions tests

* Settings tests working

* Rule context tests working

* Options tests working

* Directives tests working

* reportUnusedDisableDirectives tests working

* All original tests passing

* Add test to verify lazy loading of rules (fixes #14862)

* Fix failing tests

* Fix failing browser test

* Fix ecmaVersion edge cases

* Switch globalReturn to false if sourceType is module

* Update Espree and eslint-scope to support sourceType:commonjs

* Update lib/linter/linter.js

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>

* Update lib/linter/linter.js

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>

* Fix processors functionality

* Update lib/shared/types.js

Co-authored-by: Brandon Mills <btmills@users.noreply.github.com>

* Update tests/lib/linter/linter.js

Co-authored-by: Brandon Mills <btmills@users.noreply.github.com>

* Update tests/lib/linter/linter.js

Co-authored-by: Brandon Mills <btmills@users.noreply.github.com>

* Update lib/linter/linter.js

Co-authored-by: Brandon Mills <btmills@users.noreply.github.com>

Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
Co-authored-by: Brandon Mills <btmills@users.noreply.github.com>
@nzakas
Copy link
Member

nzakas commented Jan 12, 2022

Fixed in #15185

@nzakas nzakas closed this as completed Jan 12, 2022
Triage automation moved this from Feedback Needed to Complete Jan 12, 2022
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Jul 12, 2022
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Jul 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion breaking This change is backwards-incompatible core Relates to ESLint's core APIs and features enhancement This change enhances an existing feature of ESLint evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion Stale
Projects
Archived in project
Triage
Complete
Development

No branches or pull requests

3 participants