Highlights
There are several breaking changes in 7.0.0. We’ve created a migration guide to explain the breaking changes and describe how to upgrade.
Dropping support for Node.js v8
Node.js 8 reached EOL in December 2019, and we are officially dropping support for it in this release.
Core rule changes
- The ten Node.js/CommonJS rules in core have been deprecated and moved to the eslint-plugin-node plugin.
- Several rules have been updated to recognize bigint literals and warn on more cases by default.
eslint:recommended
has been updated with a few new rules:no-dupe-else-if
,no-import-assign
, andno-setter-return
.
Improved developer experience
- The default ignore patterns have been updated. ESLint will no longer ignore
.eslintrc.js
andbower_components/*
by default. Additionally, it will now ignore nestednode_modules
directories by default. - ESLint will now lint files with extensions other than
.js
if they are explicitly defined inoverrides[].files
- no need to use the--ext
flag! - ESLint now supports descriptions in directive comments, so things like disable comments can now be clearly documented!
- Additional validation has been added to the
RuleTester
class to improve testing custom rules in plugins. - ESLint will now resolve plugins relative to the entry configuration file. This means that shared configuration files that are located outside the project can now be colocated with the plugins they require.
- Starting in ESLint v7, configuration files and ignore files passed to ESLint using the --config path/to/a-config and --ignore-path path/to/a-ignore CLI flags, respectively, will resolve from the current working directory rather than the file location. This allows for users to utilize shared plugins without having to install them directly in their project.
New ESLint
class
- The
CLIEngine
class provides a synchronous API that is blocking the implementation of features such as parallel linting, supporting ES modules in shareable configs/parsers/plugins/formatters, and adding the ability to visually display the progress of linting runs. The newESLint
class provides an asynchronous API that ESLint core will now using going forward.CLIEngine
will remain in core for the foreseeable future but may be removed in a future major version.
Breaking Changes
4ef6158
Breaking: espree@7.0.0 (#13270) (Kai Cataldo)78c8cda
Breaking: RuleTester Improvements (refs eslint/rfcs#25) (#12955) (Milos Djermanovic)185982d
Breaking: improve plugin resolving (refs eslint/rfcs#47) (#12922) (Toru Nagashima)48b122f
Breaking: change relative paths with --config (refs eslint/rfcs#37) (#12887) (Toru Nagashima)4af06fc
Breaking: Test with an unknown error property should fail in RuleTester (#12096) (Milos Djermanovic)afa9aac
Breaking: class defaulttrue
computed-property-spacing (fixes #12812) (#12915) (Milos Djermanovic)7d52151
Breaking: classes defaulttrue
in accessor-pairs (fixes #12811) (#12919) (Milos Djermanovic)78182e4
Breaking: Add new rules to eslint:recommended (fixes #12911) (#12920) (Milos Djermanovic)6423e11
Breaking: check unnamed default export in func-names (fixes #12194) (#12195) (Chiawen Chen)4293229
Breaking: use-isnan enforceForSwitchCase defaulttrue
(fixes #12810) (#12913) (Milos Djermanovic)cf38d0d
Breaking: change default ignore pattern (refs eslint/rfcs#51) (#12888) (Toru Nagashima)bfe1dc4
Breaking: no-dupe-class-members checks some computed keys (fixes #12808) (#12837) (Milos Djermanovic)c2217c0
Breaking: makeradix
rule stricter (#12608) (fisker Cheung)1aa021d
Breaking: lintoverrides
files (fixes #10828, refs eslint/rfcs#20) (#12677) (Toru Nagashima)b50179d
Breaking: Check assignment targets in no-extra-parens (#12490) (Milos Djermanovic)d86a5bb
Breaking: Check flatMap in array-callback-return (fixes #12235) (#12765) (Milos Djermanovic)cf46df7
Breaking: description in directive comments (refs eslint/rfcs#33) (#12699) (Toru Nagashima)7350589
Breaking: some rules recognize bigint literals (fixes #11803) (#12701) (Toru Nagashima)1118fce
Breaking: runtime-deprecation on ‘~/.eslintrc’ (refs eslint/rfcs#32) (#12678) (Toru Nagashima)2c28fbb
Breaking: drop Node.js 8 support (refs eslint/rfcs#44) (#12700) (Toru Nagashima)
Features
f9774ec
New: Add default-case-last rule (fixes #12665) (#12668) (Milos Djermanovic)a1d999c
New: Add no-useless-backreference rule (fixes #12673) (#12690) (Milos Djermanovic)985dac3
New: Add no-restricted-exports rule (fixes #10428) (#12546) (Milos Djermanovic)
Enhancements
0b1d65a
Update: Improve report location for array-callback-return (refs #12334) (#13109) (Milos Djermanovic)d3aac53
Update: report backtick loc in no-unexpected-multiline (refs #12334) (#13142) (Milos Djermanovic)bcafd0f
Update: Add ESLint API (refs eslint/rfcs#40) (#12939) (Kai Cataldo)5c1bdeb
Update: Improve report location for getter-return (refs #12334) (#13164) (Milos Djermanovic)e7c1d4b
Update: deprecate Node.js & CommonJS rules (#12898) (Kai Cataldo)af4472f
Update: Improve report location for new-cap (refs #12334) (#13136) (Milos Djermanovic)a784dac
Update: Improve report location newline-per-chained-call (refs #12334) (#13116) (Milos Djermanovic)5e07574
Update: Improve report location for space-before-function-paren (#13128) (Chiawen Chen)17e2fe4
Update: Improve error message for fatal fixer errors (#13120) (Brad Zacher)438dcbb
Update: Improve report location for comma-style (refs #12334) (#13111) (Chiawen Chen)85b7254
Update: no-inner-declarations false negative in non-block (fixes #12222) (#13062) (Anix)6631ef1
Update: Improve report location for no-empty-function (refs #12334) (#13121) (Milos Djermanovic)e0f1b6c
Update: stricter array index check in no-magic-numbers (fixes #12845) (#12851) (Milos Djermanovic)362713c
Update: Improve report location for template-curly-spacing (#12813) (Milos Djermanovic)105384c
Update: report operator location in operator-linebreak (refs #12334) (#13102) (Milos Djermanovic)081e240
Update: support globalThis in no-implied-eval (fixes #12670) (#13105) (YeonJuan)a1370ab
Update: Report constructor calls in no-obj-calls (#12909) (Milos Djermanovic)085979f
Update: consider env in no-implied-eval (fixes #12733) (#12757) (YeonJuan)e90b29b
Update: Allow testing Suggestions with data in RuleTester (fixes #12606) (#12635) (Milos Djermanovic)183e300
Update: support globalThis (refs #12670) (#12774) (YeonJuan)1299705
Update: acorn version (#13016) (Idan Avrahami)a5b41a7
Update: no-restricted-modules handle TemplateLiteral (fixes #12926) (#12927) (Michal Piechowiak)051567a
Update: check identifier in array pattern in id-length (fixes #12832) (#12839) (YeonJuan)9038a29
Update: func-namesas-needed
false negative with AssignmentPattern (#12932) (Milos Djermanovic)7747177
Update: report rename id destructuring in id-blacklist (fixes #12807) (#12923) (YeonJuan)77df505
Update: check renaming identifier in object destructuring (fixes 12827) (#12881) (YeonJuan)41de9df
Update: enforceForLogicalOperands no-extra-boolean-cast (fixes #12137) (#12734) (jmoore914)1ee6b63
Update: check template literal in yoda (fixes #12863) (#12876) (YeonJuan)439c833
Update: array-callback-return checks Array.forEach (fixes #12551) (#12646) (Gabriel R Sezefredo)03a69db
Update: check template literal in no-proto, no-iterator (fixes #12801) (#12806) (YeonJuan)562e784
Update: fix no-magic-numbers false negative with ignoreArrayIndexes (#12805) (Milos Djermanovic)0460748
Update: check template literal in no-constant-condition (fixes #12815) (#12816) (YeonJuan)e59d775
Update: Separate pattern/expression options for array-element-newline (#11796) (jacobparish)f8f115a
Update: treat comment tokens in template-curly-spacing (fixes #12744) (#12775) (YeonJuan)9a93d9e
Update: fix no-restricted-imports export * false negative (fixes #12737) (#12798) (Milos Djermanovic)68becbd
Update: fix no-restricted-imports importNames reporting (fixes #12282) (#12711) (Andrey Alexandrov)ae959b6
Update: report double extra parens in no-extra-parens (fixes #12127) (#12697) (YeonJuan)b2c6209
Update: fix no-extra-parens CallExpression#callee false negatives (#12743) (Milos Djermanovic)14b42c3
Update: fix counting jsx comment len in max-len (fixes #12213) (#12661) (YeonJuan)313f70a
Update: add outerIIFEBody: “off” to indent rule (fixes #11377) (#12706) (Kai Cataldo)3fa39a6
Update: Handle locally unsupported regex in computed property keys (#12056) (Milos Djermanovic)8f1020f
Update: no-void add an option to allow void as a statement (#12613) (Brad Zacher)bb6cf50
Update: Add offsetTernaryExpressions option for indent rule (#12556) (Adam Stankiewicz)
Bug Fixes
4c0b028
Fix: remove Node.js and CommonJS category from build process (#13242) (Kai Cataldo)d85e291
Fix: yoda left string fix for exceptRange (fixes #12883) (#13052) (Anix)8e7a2d9
Fix: func-call-spacing “never” reports wrong message (fixes #13190) (#13193) (Milos Djermanovic)ebc28d7
Fix: Remove default .js from --ext CLI option (#13176) (Brandon Mills)c9a5035
Fix: newBasePath should be an absolute path (fixes #12850) (#13078) (Nick Harris)301b450
Fix: no-extra-parens export default sequence expression false positive (#13096) (Milos Djermanovic)bfa811c
Fix: init error in extending recommended config (fixes #12707) (#12738) (YeonJuan)7551f0c
Fix: no check for shadowed Object (fixes #12809) (#13115) (Anix)988d842
Fix: add end location to report in no-useless-concat (refs #12334) (#13110) (Milos Djermanovic)29f32db
Fix: Change error message logic for implicit file ignore (fixes #12873) (#12878) (Scott Hardin)eb1a43c
Fix: require-await ignore async generators (fixes #12459) (#13048) (Anix)920465b
Fix: getNameLocationInGlobalDirectiveComment end location (refs #12334) (#13086) (Milos Djermanovic)ae14a02
Fix: add end location to report in no-extra-bind (refs #12334) (#13083) (Milos Djermanovic)0c20bc0
Fix: check assignment property target in camelcase (fixes #13025) (#13027) (YeonJuan)8d50a7d
Fix: add end location to report in no-prototype-builtins (refs #12334) (#13087) (Milos Djermanovic)3e4e7f8
Fix: incorrect logic for required parens in no-extra-boolean-cast fixer (#13061) (Milos Djermanovic)aef9488
Fix: allow references to external globals in id-blacklist (fixes #12567) (#12987) (Milos Djermanovic)4955c50
Fix: remove type arguments in prefer-object-spread (fixes #13058) (#13063) (Milos Djermanovic)dbe357d
Fix: check template literal in prefer-numeric-literals (fixes #13045) (#13046) (YeonJuan)2260611
Fix: added async in allow method in no-empty-function (fixes #12768) (#13036) (Anix)7224eee
Fix: no-plusplus allow comma operands in for afterthought (fixes #13005) (#13024) (Milos Djermanovic)7598cf8
Fix: Newline before eof when creating config via --init (#12952) (Andreas Lind)0243549
Fix: camelcase false positive with computed property (fixes #13022) (#13023) (Milos Djermanovic)6cef0d5
Fix: Check division operator in astUtils.canTokensBeAdjacent (#12879) (Milos Djermanovic)afde78b
Fix: curly removes necessary braces between if and else (fixes #12928) (#12943) (Milos Djermanovic)4797fb2
Fix: arrow-body-style crash with object literal body (fixes #12884) (#12886) (Milos Djermanovic)de14d1c
Fix: wrap-iife autofix removes mandatory parentheses (#12905) (Milos Djermanovic)5775b06
Fix: Optionally allow underscores in member names (#11972) (Edgardo Avilés)0dfc3ff
Fix: add end location to report in no-eval (#12960) (Milos Djermanovic)1f1424c
Fix: fix inconsistently works option in no-extra-parens (fixes #12717) (#12843) (YeonJuan)b5adcaa
Fix: make YieldExpression throwable (fixes #12880) (#12897) (YeonJuan)95e0586
Fix: id-blacklist false positives on renamed imports (#12831) (Milos Djermanovic)dadc892
Fix: operator-assignment crash on adjacent division assignment (#12844) (Milos Djermanovic)a9d92f9
Fix: radix rule crash on disabled globals (#12824) (Milos Djermanovic)533c114
Fix: multiline-comment-style rule add extra space after * (fixes #12785) (#12823) (Karthik Priyadarshan)80309c3
Fix: no-constant-condition doesn’t introspect arrays (fixes #12225) (#12307) (Sean Gray)de4fa7c
Fix: wrong indent at tagged template in indent (fixes #12122) (#12596) (YeonJuan)16a1c1f
Fix: prefer-object-spread false positives with accessors (fixes #12086) (#12784) (Milos Djermanovic)0d8c0af
Fix: improve report location for computed-property-spacing (#12795) (Milos Djermanovic)756b95d
Fix: id-blacklist should ignore ObjectPatterns (fixes #12787) (#12792) (JP Ramassini)01ff791
Fix: Display pipe character correctly in test output (#12771) (Brad Zacher)00ddfff
Fix: Windows path parsing for JUnit (fixes #12507) (#12509) (Michael Wall)1aff21b
Fix: no-mixed-spaces-and-tabs reports multiline strings (#12566) (Milos Djermanovic)
Documentation
b5c8d73
Docs: update 7.0.0 migration guide for consistency (#13267) (Kai Cataldo)356fdb4
Docs: add migration guide (#12692) (Toru Nagashima)56d2bee
Docs: fix typos (#13204) (Nitin Kumar)516f253
Docs: Adds import example for object-curly-newline rule (refs #12018) (#13177) (Luke Lewis)b398e0b
Docs: add rule comment in prefer-rest-params doc (#13191) (YeonJuan)c41de38
Docs: fix curly multi-or-nest examples with comments (refs #12972) (#13151) (Milos Djermanovic)57221d5
Docs: fix eslint comment in no-inner-declarations examples (#13152) (Milos Djermanovic)5dfd4eb
Docs: examples with arrow functions in no-return-assign (fixes #13135) (#13138) (Anix)adc8fa8
Docs: clarify exceptions in spaced-comment (fixes #13032) (#13126) (Anix)b228f95
Docs: Update README team and sponsors (ESLint Jenkins)6c069f9
Docs: Add comments to code block in example (#13089) (Kibeom Kwon)ee1f053
Docs: Fix typo (#13092) (Max Coplan)76324ac
Docs: Add further reading to rule (#13084) (Max Coplan)3f7c9bf
Docs: clarify variables option in no-use-before-define (fixes #12986) (#13017) (Anix)9ac5b9e
Docs: Clarify node_modules is ignored by default (fixes #13006) (#13054) (Mika Kuijpers)0de91f3
Docs: removed correct code from incorrect eg (#13060) (Anix)af7af9d
Docs: Update governance (#13055) (Nicholas C. Zakas)79ac6cd
Docs: added less confusing explanation for func-style (fixes #12900) (#13004) (Anix)b8e20d3
Docs: Mention TypeScript’s compiler check (#12903) (Benny Neugebauer)e997f32
Docs: Updated arrow-parens for minor grammar issue (#12962) (Tom)cf14355
Docs: Fix links to custom parsers doc (#12965) (Brandon Mills)f479f6f
Docs: References correct config file name (#12885) (Patrick Kilgore)8d5c434
Docs: fix category descriptions for site generation (fixes #12894) (#12930) (Kai Cataldo)05380e6
Docs: Remove claim about semicolons from docs (#12944) (Luke Sikina)824d235
Docs: add errorOnUnmatchedPattern option to CLIEngine (#12834) (Arthur Denner)33efd71
Docs: Fix spelling mistakes (#12861) (Bryan Mishkin)a5b3c5f
Docs: Update README team and sponsors (ESLint Jenkins)d6c313d
Docs: add missing eslint comments in prefer-regex-literals examples (#12858) (Milos Djermanovic)aea1729
Docs: Fix anchor links in Node.js API TOC (#12821) (Matija Marohnić)02fcc05
Docs: Improve sort-keys (#12791) (Steven Vachon)25eb703
Docs: fix dead link in max-lines rule docs (#12766) (Christian Bundy)098b67d
Docs: fix minor typo in brace-style.md (#12749) (Marko Kaznovac)b23ad0d
Docs: change a broken link in working-with-rules.md (#12732) (Damien Cassou)
Dependency Upgrades
b98d8bd
Upgrade: eslint-release@2.0.0 (#13271) (Kai Cataldo)3eeae56
Upgrade: some (dev) deps (#13155) (薛定谔的猫)95e1c70
Upgrade: levn@0.4.1 (fixes #9366) (#13140) (Kai Cataldo)2111c52
Upgrade: esquery@1.2.0 (#13076) (Milos Djermanovic)95613d4
Upgrade: espree@6.2.1 (#13026) (Kai Cataldo)e632c31
Upgrade: several dependencies (#12753) (Toru Nagashima)
Build Related
8d1b4db
Build: changelog update for 7.0.0-rc.0 (ESLint Jenkins)2531b80
Build: changelog update for 7.0.0-alpha.3 (ESLint Jenkins)2e8f193
Build: changelog update for 7.0.0-alpha.2 (ESLint Jenkins)e9f1073
Build: changelog update for 7.0.0-alpha.1 (ESLint Jenkins)c8c1b2b
Build: changelog update for 7.0.0-alpha.0 (ESLint Jenkins)4e16957
Build: update browser build (#12693) (Toru Nagashima)827259e
Build: package.json update for eslint-config-eslint release (ESLint Jenkins)
Chores
401a687
Chore: fix rules list for prereleases (#13230) (Kai Cataldo)2ce6bed
Chore: added tests for nested arrays (#13145) (Anix)6b7030b
Chore: Run tests on Node.js v14 (#13210) (fisker Cheung)e13256e
Chore: use espree.latestEcmaVersion in config-initializer (#13157) (Kai Cataldo)e4f57b7
Chore: add nested array tests for array-element-newline (#13161) (Anix)bc0c02c
Chore: added lock files to gitignore (#13015) (Anix)26267ed
Chore: update GitHub Actions (#12984) (Pig Fang)472025f
Chore: update space-before-function-paren in eslint-config-eslint (#12966) (Kai Cataldo)1907e57
Chore: add Twitter and Open Collective badge (#12877) (Kai Cataldo)b7f0d20
Chore: Use consistent badge style (#12825) (fisker Cheung)3734a66
Chore: use ids for messages (#12859) (Gareth Jones)0cae920
Chore: rename shadowed global (#12862) (Tony Brix)055b80d
Chore: Fix typo in complexity.js (#12864) (Kyle Shevlin)9f39ef0
Chore: typo in PULL_REQUEST_TEMPLATE.md (#12848) (Balázs Orbán)a60d5cd
Chore: typo in no-irregular-whitespace.js (#12847) (Balázs Orbán)691d19a
Chore: add missingecmaVersion
2020/11 type value (#12833) (Piotr Błażejewicz (Peter Blazejewicz))f5b9656
Chore: add test for no-constant-condition (#12836) (Milos Djermanovic)10a79a6
Chore: Adopteslint-plugin/require-meta-docs-description
internally (#12762) (Bryan Mishkin)561b6d4
Chore: add prerequisites checklist to PR template (#12790) (Kai Cataldo)9dfc850
Chore: Refactor to use messageId in a number of rules (#12715) (Brad Zacher)b77b858
Chore: fix separateRequires tests for one-var rule (#12709) (Milos Djermanovic)e4df7df
Chore: add JSDoc types for RuleTester test cases (#12325) (Chiawen Chen)4744397
Chore: remove unused code in max-lines-per-function (#12659) (YeonJuan)39f5a45
Chore: add test cases for for-direction (#12698) (YeonJuan)b340304
Chore: Add extra test, improve docs (#12492) (Kevin Partington)