Skip to content

Ignore Eslint errors in src/**/node_modules (allows package development inside /src without breaking ESLint and babel-loader) - #6056

Closed
alex-pex wants to merge 1 commit into
react:masterfrom
alex-pex:exclude-src-node-modules
Closed

alex-pex wants to merge 1 commit into
react:masterfrom
alex-pex:exclude-src-node-modules

Conversation

@alex-pex

@alex-pex alex-pex commented Dec 17, 2018 •

Copy link
Copy Markdown

Exclude node_modules from source compilation (babel + advanced feature).

This is a small change which allows package development without the whole lerna + babel toolkit : It's workspace package INSIDE src folder. Apart from the lint issue, everything else is working out-of-the-box!


image

DevServer shows warnings
image

Warnings disappear with my changes

@alex-pex

alex-pex commented Dec 17, 2018 •

Copy link
Copy Markdown
Author

The root package JSON looks like this (I split the main app from sub-packages)

{
  "name": "root",
  "version": "0.1.0",
  "private": true,
  "workspaces": [
    "src/app",
    "src/packages/*"
  ],

My folder structure looks like this
image

And importing globally accessible code is easy
image

I can even split dependencies as my app-ui-components and app-redux-store don't share the same requirements

{
  "name": "@app/store",
  "version": "0.1.0",
  "dependencies": {
    "@app/endpoints": "^0.1.0",
    "@app/state-machine": "^0.1.0",
    "deepmerge": "^2.2.1",
    "jwt-decode": "^2.2.0",
    "micromatch": "^3.1.10",
    "normalizr": "^3.3.0",
    "react-router": "^4.3.1",
    "redux-starter-kit": "^0.2.0",
    "xstate": "^4.2.1"
  },
  "peerDependencies": {
    "react": "16.*",
    "react-dom": "16.*"
  }
}

  • Styleguidist works fine
  • HMR too
  • No babel watcher needed
  • Lerna can be used to compile and publish packages but needs more tooling (I use it in another repository to publish UI components)

It's an easy workaround monorepo support drop
https://gist.github.com/gaearon/8650d1c70e436e5eff01f396dffc4114#monorepo-support-from-2x-alphas-was-removed-in-final-20

Feel free to discuss the pro and cons of my approach 🙂


Related issues :

@alex-pex alex-pex changed the title Allow packages development inside /src without breaking ESLint and babel-loader Ignore Eslint errors in src/**/node_modules (allows package development inside /src without breaking ESLint and babel-loader) Jan 10, 2019
@stale

stale Bot commented Feb 9, 2019

Copy link
Copy Markdown

This pull request 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 Feb 9, 2019
@alex-pex

Copy link
Copy Markdown
Author

This issue is not stale! And I found a similar issue with typescript detection occuring in src/**/node_modules. I don't have time yet to fix this issue as well

@stale stale Bot removed the stale label Feb 11, 2019
@stale

stale Bot commented Mar 13, 2019

Copy link
Copy Markdown

This pull request 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 Mar 13, 2019
@stale

stale Bot commented Mar 18, 2019

Copy link
Copy Markdown

This pull request has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue. Thank you for your contribution!

@stale stale Bot closed this Mar 18, 2019
@iansu iansu removed the stale label Mar 19, 2019
@iansu iansu reopened this Mar 19, 2019
@alex-pex

Copy link
Copy Markdown
Author

Thanks @iansu! Should I keep updating my PR to handle Typescript detection problem ?

Is it worth it ? I don't want to keep developing fixes if it ends up being ignored 😕

@stale

stale Bot commented Apr 23, 2019

Copy link
Copy Markdown

This pull request 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 Apr 23, 2019
@facebook-github-bot
facebook-github-bot deleted the branch react:master July 7, 2021 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants