G
G
gracer2020-02-06 15:39:47
JavaScript
gracer, 2020-02-06 15:39:47

How to make destructuring assignment and eslint friends?

Good afternoon. I'm trying to figure out with eslint for the first time. I use VS Code, put everything I need for lint on tutorials, generated the config using eslint --init.

module.exports = {
    "env": {
        "browser": true,
        "es6": true
    },
    "extends": [
        "airbnb-base"
    ],
    "globals": {
        "Atomics": "readonly",
        "SharedArrayBuffer": "readonly"
    },
    "parserOptions": {
        "ecmaVersion": 2018
    },
    "rules": {
    }
};


I started correcting errors in the galp config and did not understand why the linter swears at
const { parallel, src, dest, watch } = require('gulp');

Expected a line break after this opening brace.eslint(object-curly-newline)

because it is not an object. Tell me how and whether it is worth making friends destructuring assignment with eslint and what to do in such situations when the linter swears at a seemingly normal situation.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Leonid Knyazev, 2020-02-06
@gracer

The documentation says:

This rule enforces consistent line breaks inside braces of object literals or destructuring assignments.

So in your case you need to write:
const {
  parallel, src, dest, watch
} = require('gulp');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question