Skip to content

Prettier should not be included by default in eslint-config #556

@arthurgeron-work

Description

@arthurgeron-work

Introduction

Prettier is know to cause many ESLint issues & conflicts as well as being slow to run since it has to "boot up" prettier executable each time it parses a file, hence it should not be included by default on @react-native-community/eslint-config, I believe it's better to leave it to developers to decide wether to include it or not.

Details

ESLint on a relatively small file with prettier:

Rule                                 | Time (ms) | Relative
:------------------------------------|----------:|--------:
prettier/prettier                    |   442.890 |    85.4%
react/no-multi-comp                  |    10.953 |     2.1%
jest/no-identical-title              |     8.454 |     1.6%
no-cond-assign                       |     7.448 |     1.4%
react/no-unstable-nested-components  |     5.258 |     1.0%
jest/no-disabled-tests               |     3.456 |     0.7%
no-restricted-imports                |     3.415 |     0.7%
react-hooks/rules-of-hooks           |     3.233 |     0.6%
@typescript-eslint/naming-convention |     2.943 |     0.6%
no-new-func                          |     2.362 |     0.5%

ESLint on a relatively small file without prettier:

Rule                                 | Time (ms) | Relative
:------------------------------------|----------:|--------:
react/no-multi-comp                  |     8.143 |    13.8%
indent                               |     6.473 |    11.0%
jest/no-identical-title              |     4.776 |     8.1%
@typescript-eslint/indent            |     4.146 |     7.0%
jest/no-disabled-tests               |     3.971 |     6.7%
@typescript-eslint/naming-convention |     2.659 |     4.5%
react/no-unstable-nested-components  |     2.505 |     4.2%
react-hooks/exhaustive-deps          |     1.536 |     2.6%
react/require-render-return          |     1.039 |     1.8%
import-helpers/order-imports         |     1.006 |     1.7%

As it can be seen prettier itself is ~55x slower than the heaviest of our rules, that delay scales up the more files we get and slows ESLint job in general.

Discussion points

  • Remove prettier/prettier from "extends" in eslint-config

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions