Skip to content
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

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

Closed
wants to merge 1 commit into from

Conversation

alex-pex
Copy link

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

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

alex-pex commented Dec 17, 2018

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

stale bot commented Feb 9, 2019

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

stale bot commented Mar 13, 2019

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

stale bot commented Mar 18, 2019

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

stale bot commented Apr 23, 2019

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 facebook: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