question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

update eslint:recommended and eslint-config-eslint.

See original GitHub issue

The version of ESLint you are using. latest

The problem you want to solve. update eslint:recommended and eslint-config-eslint.

Your take on the correct solution to problem.

  • y: enable
  • n: not enable
  • ?: not sure
Name Added in eslint version eslint:recommended eslint-config-eslint Description
default-case-last 7.0.0-alpha.0 ? y enforce default clauses in switch statements to be last
default-param-last 6.4.0 ? y enforce default parameters to be last
function-call-argument-newline 6.2.0 n y(‘consistent’) enforce line breaks between arguments of a function call
grouped-accessor-pairs 6.7.0 n y require grouped accessor pairs in object literals and classes
id-denylist 7.4.0 n n disallow specified identifiers
no-constructor-return 6.7.0 y y disallow returning value from constructor
*no-dupe-else-if 6.7.0 y y disallow duplicate conditions in if-else-if chains
*no-import-assign 6.4.0 y y disallow assigning to imported bindings
no-loss-of-precision 7.1.0 y y disallow literal numbers that lose precision
no-nonoctal-decimal-escape 7.14.0 y y disallow \8 and \9 escape sequences in string literals
no-promise-executor-return 7.3.0 y y disallow returning values from Promise executor functions
no-restricted-exports 7.0.0-alpha.0 n n disallow specified names in exports
*no-setter-return 6.7.0 y y disallow returning values from setters
no-unreachable-loop 7.3.0 y y disallow loops with a body that allows only one iteration
no-unsafe-optional-chaining 7.15.0 y y disallow use of optional chaining in contexts where the undefined value is not allowed
no-useless-backreference 7.0.0-alpha.0 y y disallow useless backreferences in regular expressions
prefer-exponentiation-operator 6.7.0 n y disallow the use of Math.pow in favor of the ** operator
prefer-regex-literals 6.4.0 n y disallow use of the RegExp constructor in favor of regular expression literals

is it too late to consider adding this to eslint v8.0.0? 😦

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
aladdin-addcommented, Jun 10, 2021

sounds good!

I can make 2 PRs: one for the eslint:recommended; one for eslint-config-eslint (if no objections). cc @btmills @snitin315

1reaction
mdjermanoviccommented, Jun 9, 2021

I vote for these four:

  • no-loss-of-precision
  • no-unsafe-optional-chaining
  • no-useless-backreference
  • no-nonoctal-decimal-escape

The first three flag errors in the code, and I can’t think of any reason to not enable each.

no-nonoctal-decimal-escape flags the use of a legacy syntax that can be easily avoided.


no-unreachable-loop

This can be problematic because by default it flags a pattern that checks if an object has enumerable properties:

for (const key in obj) {
  has = true;
  break;
}

And a pattern to check if there’s anything in a sequence:

for (const value of iterable) {
  has = true;
  break;
}

no-promise-executor-return

There are some patterns that would be reported by this rule:


Rest of the rules marked as “?” or “y”:

  • default-case-last: while very uncommon, the code it flags is valid.
  • default-param-last: this is only a best practice, the code it flags is valid.
  • no-constructor-return: I believe most codebases should enable this rule to catch errors in the code, but there are valid patterns where constructor returns a value.
  • no-dupe-else-if: this rule is already in eslint:recommended
  • no-import-assign: this rule is already in eslint:recommended
  • no-setter-return: this rule is already in eslint:recommended
Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrating to v8.0.0 - ESLint - Pluggable JavaScript Linter
eslint :recommended has been updated. Four new rules have been enabled in the eslint:recommended preset. no-loss-of-precision ...
Read more >
Getting Started with ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Configuration Files - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Configuring ESLint - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Migrating to v7.0.0 - ESLint - Pluggable JavaScript Linter
eslint :recommended has been updated ... Three new rules have been enabled in the eslint:recommended preset. ... To address: Fix errors or disable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found