Skip to content

Speed up build by disabling lint #7078

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tomasbruckner opened this issue May 17, 2019 · 6 comments
Closed

Speed up build by disabling lint #7078

tomasbruckner opened this issue May 17, 2019 · 6 comments
Labels

Comments

@tomasbruckner
Copy link

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.

@eladmotola
Copy link

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

@alex-lechner
Copy link

+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
Copy link
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
Copy link

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
Copy link

stale bot commented Jun 22, 2019

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 bot added the stale label Jun 22, 2019
@stale
Copy link

stale bot commented Jun 27, 2019

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.

@stale stale bot closed this as completed Jun 27, 2019
@lock lock bot locked and limited conversation to collaborators Jul 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants