2
votes

I have set up my project to build via Travis.CI. Travis automatically sets the CI (environment) variable to true thus causing warnings to be treated as errors during build.

One of my dependencies (react-mapbox-gl) is forcing me to violate an ESLint rule, "style prop must be an object (react/style-prop-object).

I do not want to disable warnings as errors, but I would like to temporarily disable this one particular rule.

I know that in a regular JavaScript node application ESLint rules may be configured in .eslintrc or package.json. In create-react-app powered projects however, none of those files seems to have any effect on the build process?

Is there a way to configure ESLint rules in create-react-app without ejecting my create-react-app?

1

1 Answers

1
votes

It is possible to disable an ESLint rule just for one particular line using a comment:

<Map
  // eslint-disable-next-line react/style-prop-object
  style='mapbox://styles/user/hash'
  ...

This also works fine for create-react-app builds.

For more information see: http://eslint.org/docs/user-guide/configuring.html#configuring-rules