0
votes

So I am new to ESLint, and want to disable a specific rule I don't like, but I don't know which is it and how to.

So my .eslintrc.js looks like this:

module.exports = {
    root: true,
    env: {
        node: true,
        es2021: true,
    },
    extends: ['eslint:recommended', 'prettier'],
    parserOptions: {
        ecmaVersion: 12,
        sourceType: 'module',
    },
    plugins: ['prettier'],
    rules: {
        'prettier/prettier': [
            1,
            {
                trailingComma: 'es5',
                singleQuote: true,
                semi: true,
                tabWidth: 4,
                printWidth: 120,
            },
        ],
        ...require('eslint-config-prettier').rules,
        'no-unused-vars': 'off',
    },
};

And in routes, for each route I have an async wrapper function called "aW". Because of this, eslint is warning me and trying to break the lines, and I don't really like that. So it looks like this:

enter image description here

and I want to keep it like that.

But when I format that file, it turns to this:

enter image description here

which I really don't like...

How can I disable that rule (maybe with pattern if line contains "aW"), but without commenting each line with "// eslint-ignore"

1

1 Answers

0
votes

Even though Prettier is configured in your ESLint configuration file as an ESLint rule via an integration plugin (prettier-eslint-plugin), it's a separate project from ESLint. The point of Prettier is to cede control over such details of formatting to focus on more important things. If you still want that control, like where lines should break and so on, Prettier probably isn't for you as you can't customize these things using it and it's intentionally been made that way. Just remove all the mentions of Prettier from the ESLint config.