Skip to content

Instantly share code, notes, and snippets.

@colinsullivan
Last active April 17, 2020 18:44
Show Gist options
  • Save colinsullivan/27bb7be5e1ad9f8dc693b28cafbbd5ac to your computer and use it in GitHub Desktop.
Save colinsullivan/27bb7be5e1ad9f8dc693b28cafbbd5ac to your computer and use it in GitHub Desktop.
Fix Create React App warnings when using Mapbox react wrapper
# This causes the CRA builder to honor the local `eslintConfig` in the project's `package.json`
# https://create-react-app.dev/docs/setting-up-your-editor/#experimental-extending-the-eslint-config
EXTEND_ESLINT=true
{
"eslintConfig": {
"extends": "react-app",
"rules": {
"react/style-prop-object": ["warn", {
"allow": ["Mapbox"]
}]
}
}
}
return <Mapbox
style="mapbox://styles/mymaps/asdfsadfdsafsdfafe"
//...etc.
/>
@colinsullivan
Copy link
Author

The Mapbox component accepts a style attribute that is a string. Ordinarily this triggers a warning in the default eslint config provided by CRA:

./src/SomeReactComponent.js
    Line 344:7:  Style prop value must be an object  react/style-prop-object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment