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.

Incorrect no-return-assign report

See original GitHub issue

Tell us about your environment

Windows 10

Node version: v10.16.0 npm version: v6.9.0 Local ESLint version: v6.8.0 Global ESLint version: Not found

What parser (default, Babel-ESLint, etc.) are you using?


Please show your full configuration:

module.exports = {
  root: true,

  parserOptions: {
    parser: 'babel-eslint',
    sourceType: 'module'

  env: {
    browser: true

  extends: [
    // Uncomment any of the lines below to choose desired strictness,
    // but leave only one uncommented!
    // See
    'plugin:vue/essential' // Priority A: Essential (Error Prevention)
    // 'plugin:vue/strongly-recommended' // Priority B: Strongly Recommended (Improving Readability)
    // 'plugin:vue/recommended' // Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead)

  // required to lint *.vue files
  plugins: [

  globals: {
    'ga': true, // Google Analytics
    'cordova': true,
    '__statics': true,
    'process': true,
    'Capacitor': true,
    'chrome': true

  // add your custom rules here
  rules: {
    // allow async-await
    'generator-star-spacing': 'off',
    // allow paren-less arrow functions
    'arrow-parens': 'off',
    'one-var': 'off',

    'import/first': 'off',
    'import/named': 'error',
    'import/namespace': 'error',
    'import/default': 'error',
    'import/export': 'error',
    'import/extensions': 'off',
    'import/no-unresolved': 'off',
    'import/no-extraneous-dependencies': 'off',
    'prefer-promise-reject-errors': 'off',

    // allow debugger during development only
    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',

    'no-sequences': 'off',

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

I have an arrow function that returns a comma expression (i.e. sequence). After I changed the rule to allow comma operator, eslint reported “no-return-assign” error while in fact it is the comma expression that is being returned.

row.reduce((object, value, index) => (object[rs.columns[index]] = value, object), {})

Not sure. ESlint was invoked by quasar/cli

quasar dev

What did you expect to happen?

The code is NOT returning an assignment, but a comma expression where the second operand is a single object. This should be accepted by ESlint

What actually happened? Please include the actual, raw output from ESLint.

ESlint reported no-return-assign error:

error Arrow function should not return assignment no-return-assign

Are you willing to submit a pull request to fix this bug?


Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

mdjermanoviccommented, Apr 3, 2020

Just to add, correct code without linting errors would be:

/*eslint no-return-assign: "error"*/

() => ((a = b), c)

This rule by default allows parenthesized assignments (parentheses should be directly around the assignment expression).

mdjermanoviccommented, Apr 2, 2020

Hi @brianwhu, thanks for the bug report!

I can confirm this is the intended behavior of this rule (introduced in #6041, issue #5913).

On the other hand, we really don’t have any incorrect examples with a nested assignment, and there are also no examples with arrow functions, so I’m marking this as an accepted issue to improve the documentation for this rule.

Read more comments on GitHub >

github_iconTop Results From Across the Web

no-return-assign - 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 >
no-return-assign behavior changed with arrow functions #5150
Yes, I'm technically returning an assignment, but it's a common pattern that's not a mistake. If the spirit of no-return-assign is to prevent ......
Read more >
How to prevent no-return-assign error? - Stack Overflow
no -return-assign is there to prevent you from accidentally assigning in a return statement when you meant to compare (i.e. = vs ==...
Read more >
I Made a Mistake on My Taxes - Taxpayer Advocate Service
You have many options on how to fix a mistake on your tax return depending on whether you received a notice and the...
Read more >
Disputing Errors on Your Credit Reports | Consumer Advice
To correct mistakes in your report, contact the credit bureau and the business that reported the inaccurate information. Tell them you want to...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found