AngeloC
AngeloC

Reputation: 3533

how to tell FlowType to ignore some json requires?

I have this kind of code in a ./src folder:

var fs = require('fs')
var config = require("../config.json")

when run flow, it has this error:

var config = require("../config.json")
                        ^^^^^^^^^^^^^^^^^^ ../config.json. Required module not found

to me, that's a valid statement because the final version will be in a folder with that config.json, is there a way to instruct flowtype not checking this type of error?

Thanks

Upvotes: 1

Views: 292

Answers (2)

kalley
kalley

Reputation: 18472

If you want the json file to be checked as well, you could use module.name_mapper to map to the location of your json file. Flow automatically checks required json files.

It would looks something like:

module.name_mapper='^\(.*\)\.json$' -> '<PROJECT_ROOT>/path/to/json/files'

Upvotes: 0

Philipp
Philipp

Reputation: 731

You could make flow ignore all json files by adding the following to your .flowconfig:

[ignore]
.*\.json

Upvotes: 0

Related Questions