Skip to content

Speed up build by disabling lint #7078

Closed
@tomasbruckner

Description

@tomasbruckner

My setup is CRA 3 with react-app, airbnb and prettier eslint config.

What I have is pipeline with stages that installs dependencies, build, lint, snapshot test and e2e cypress test (and deploy).

But right now, I do linting twice, because npm build only use react-app lint rules so I have to separate stage for linting.

From the discussion here I have a feeling that there is no planned support for custom eslint rules, so would it be possible to at least have option to disable linting during build?

Building takes almost 4 minutes on CI in our project so it would be nice if there were some ways to speed it up.

Activity

eladmotola

eladmotola commented on May 17, 2019

@eladmotola

Have you tried to set CI=false?
As a command - CI=false npm run build

alex-lechner

alex-lechner commented on May 21, 2019

@alex-lechner

+1
Why is linting in the production build even enabled? When I create a production build I get the error

Creating an optimized production build...
Failed to compile.

./src/index.js
Error: Failed to load plugin react: Cannot find module 'eslint-plugin-react'
Referenced from:
    at Array.forEach (<anonymous>)
    at Array.reduceRight (<anonymous>)

One suggestion is to move eslint-plugin-react to production deps which I will definitely not do!
If anyone ecounters the same error with "eslint-plugin-react": "^7.13.0": downgrade it to "eslint-plugin-react": "^7.11.0" and the build process works again!

heyimalex

heyimalex commented on May 22, 2019

@heyimalex
Contributor

Why is linting in the production build even enabled?

I think our eslint config is pretty minimal, no style lints all code quality, almost always a good idea to enforce. When you don't want them to fire on specific sections of code you can opt out. That's the reasoning at least.

You shouldn't need to install eslint-plugin-react at all because it's a dependency of react-scripts, so I'm not sure how you're getting that error.

alex-lechner

alex-lechner commented on May 23, 2019

@alex-lechner

I have eslint-plugin-react in the devDependencies because if I remove it I get a warning by vscode:

Failed to load plugin react: Cannot find module 'eslint-plugin-react' Referenced from: C:\projects\may-app\.eslintrc.json

Here's the config of my .eslintrc.json:

{
  "extends": ["react-app", "plugin:prettier/recommended"],
  "env": {
    "browser": true,
    "jest": true
  }
}

Do you think I can ignore this warning? I have configured vscode to automatically lint and format the code when saving.

stale

stale commented on Jun 22, 2019

@stale

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

stale

stale commented on Jun 27, 2019

@stale

This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.

locked and limited conversation to collaborators on Jul 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @heyimalex@tomasbruckner@alex-lechner@eladmotola

        Issue actions

          Speed up build by disabling lint · Issue #7078 · facebook/create-react-app