javascript - Flow: turn off "Unused suppression" error for supress_comment -


the production build of app produces file development build not. handle difference in code (simplified example)

const manifest = (process.env.node_env === 'production')   ? require(./production-app-manifest.json')   : { version: 'dummy development manifest' } 

flow therefore (correctly) fails on second line 'required module not found' when in development.

as docs suggest here, suppressed error so

const manifest = (process.env.node_env === 'production')   // $flowfixme: file not present in development   ? require(./production-app-manifest.json')   : { version: 'dummy development manifest' } 

this solves problem in development.

however, after production build, unused suppression error because file is present.

this quite frustrating. want tell flow ignore line, regardless of if file present or not. can configure flow turn off unused suppression error?

probably easiest way make line has error time. turn require line this:

require(('./production-app-manifest.json': string))

now, flow complains string passed require not literal string, it's suppressable error whether or not file exists.


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -