Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !3714

[react-scripts] Do not lint *.bs.js files, generated by BuckleScript

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/emmenko/react-scripts-exclude-bs-files-from-eslint into master Jan 08, 2018
  • Overview 5
  • Commits 1
  • Pipelines 0
  • Changes 2

Created by: emmenko

Summary

This PR introduces a small change in the eslint rule of webpack.config to exclude files ending with the suffix *.bs.js (which are compiled files generated by BuckleScript).

NOTE: I'm no RegEx expert, so if someone has a better suggestion about the test rule feel free to leave a comment 🙏

Background

When working on a React project which includes fully or partially ReasonML, you need BuckleScript to generate the compiled JS sources. When you have the in-source option active you will get the compiled JS sources (*.bs.js) next to the Reason source file. Those files will therefore "live" inside the src folder, causing eslint to print some warnings:

image

This is a bit annoying and can simply be "solved" by telling eslint to ignore those files.

Wait, ReasonML? What about reason-scripts?

As you might know, there is a package called reason-scripts which is basically a "clone" of react-scripts, with some things adapted to compile Reason files out of the box (e.g. entry point index.re instead of index.js).

However, as I pointed out in this issue, I don't think it's necessary to have reason-scripts in the first place. @rrdelaney also pointed out (correctly if I'm wrong) that bs-loader should not be included in the package anymore. In fact, you can run the BuckleScript compiler in watch mode as a parallel process, next to react-scripts start. This way you don't need the loader at all and you can simply use the "normal" react-scripts package.

"scripts": {
  "start": "npm-run-all --parallel start:bsb start:app",
  "start:app": "react-scripts start",
  "start:bsb": "bsb -make-world -w",
}

Anyway, this is another story...

Btw, this change will need to be made in reason-scripts as well.


Hopefully this gives you enough background/context to understand this change. I'm open to any feedback/suggestion.

Thanks 🙏

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/emmenko/react-scripts-exclude-bs-files-from-eslint