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
  • Issues
  • #7546
Something went wrong while setting issue due date.
Closed
Open
Issue created 5 years ago by Administrator@rootContributor
  • New related issue

  • Report abuse to administrator

  • New related issue

  • Report abuse to administrator

Detect .flowconfig and automatically enable ESLint rule to enforce Flow headers

Closed

Detect .flowconfig and automatically enable ESLint rule to enforce Flow headers

Created by: FezVrasta

Is your proposal related to a problem?

Right now I need to use customize-cra just to extend the react-app ESLint preset with the following rule:

rules: {
  'flowtype/require-valid-file-annotation': [
    'warn',
    'always',
  ],
},

which, basically, forces every file to have a // @flow (or // @noflow) comment on top of them.

Describe the solution you'd like

CRA should check for the presence of the .flowconfig file and automatically enable the Flow-related ESLint rule.

Describe alternatives you've considered

Alternatively, following the --typescript flag approach, provide a --flow flag that can be used to initialize the project with the above Flow-related rule enabled.

Additional context

I'm willing to work on a PR to introduce this if you are interested. Actually, I just prepared it since it was quick to do: https://github.com/facebook/create-react-app/pull/7547

  1. Oh no!

    You are trying to upload something other than an image. Please upload a .png, .jpg, .jpeg, .gif, .bmp, .tiff or .ico.

    Incoming!

    Drop your designs to start your upload.
Tasks
0
server returned results with length 1, expected length of 9

Linked items
0

Link issues together to show that they're related. Learn more.

Activity


  • Administrator
    Administrator @root · 5 years ago
    Author Contributor

    Created by: bugzpodder

    flow is meant to be adoptable file by file, I don't think we should enforce flow on every file.

  • Administrator
    Administrator @root · 5 years ago
    Author Contributor

    Created by: FezVrasta

    @bugzpodder why you say so? Flow gives the best when the whole project is using it.

    If you have some specific files that don't need it you can use the // @noflow comment.

  • Administrator
    Administrator @root · 5 years ago
    Author Contributor

    Created by: bugzpodder

    Yes, I think forcing people adding // @noflow on their entire project before trying it out is unreasonable and will turn off any potential adoptees.

  • Administrator
    Administrator @root · 5 years ago
    Author Contributor

    Created by: FezVrasta

    How's that different from the TypeScript implementation? What can I do to reach parity?

  • Administrator
    Administrator @root · 5 years ago
    Author Contributor

    Created by: nmain

    The typescript setup in create-react-app allows fully incremental usage. ts(x) and js files are both allowed, and can import from each other and the whole thing works together. So this flow behavior is like the TypeScript behavior.

  • Administrator
    Administrator @root · 5 years ago
    Author Contributor

    Created by: bugzpodder

    Yes, flow by default allows incremental usage as above. However I don't want new users to change their entire codebase with //@flow just to get started using flow, thanks.

  • Administrator
    Administrator @root · 5 years ago
    Author Contributor

    Created by: FezVrasta

    So what's the proposed way to make sure people don't forget to enable Flow on the project files?

    My team constantly forgets about it. I doubt I'm the only one.

  • Administrator
    Administrator @root · 5 years ago
    Author Contributor

    Created by: bugzpodder

    create-react-app 3.1 allows you to extend eslint configs. It is still experimental but going forward this is the proper way to do so.

  • Administrator
    Administrator @root · 5 years ago
    Author Contributor

    Created by: FezVrasta

    Ok, it makes sense. Thanks

Please register or sign in to reply
0 Assignees
None
Assign to
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
Due date
None
None
None
Time tracking
No estimate or time spent
Confidentiality
Not confidential
Not confidential

You are going to turn on confidentiality. Only project members with at least the Reporter role, the author, and assignees can view or be notified about this issue.

Lock issue
Unlocked
0
0 participants
Reference: