在 create-react-app 中配置 ESLint 规则?
Configure ESLint rules in create-react-app?
我已将我的项目设置为通过 Travis.CI
构建。 Travis 自动将 CI
(环境)变量设置为 true,从而导致警告在构建期间被视为错误。
我的一个依赖项 (react-mapbox-gl
) 迫使我违反 ESLint 规则,“style prop 必须是一个对象 (react/style-prop-object
)。
我不想将警告作为错误禁用,但我想暂时禁用这一特定规则。
我知道在常规 JavaScript 节点应用程序中 ESLint
规则可以在 .eslintrc
或 package.json
中配置。然而,在 create-react-app 支持的项目中,none 这些文件似乎对构建过程有任何影响?
有没有办法在不弹出我的 create-react-app
的情况下在 create-react-app 中配置 ESLint 规则?
可以使用注释仅针对某一特定行禁用 ESLint
规则:
<Map
// eslint-disable-next-line react/style-prop-object
style='mapbox://styles/user/hash'
...
这也适用于 create-react-app
构建。
有关详细信息,请参阅:
http://eslint.org/docs/user-guide/configuring.html#configuring-rules
我已将我的项目设置为通过 Travis.CI
构建。 Travis 自动将 CI
(环境)变量设置为 true,从而导致警告在构建期间被视为错误。
我的一个依赖项 (react-mapbox-gl
) 迫使我违反 ESLint 规则,“style prop 必须是一个对象 (react/style-prop-object
)。
我不想将警告作为错误禁用,但我想暂时禁用这一特定规则。
我知道在常规 JavaScript 节点应用程序中 ESLint
规则可以在 .eslintrc
或 package.json
中配置。然而,在 create-react-app 支持的项目中,none 这些文件似乎对构建过程有任何影响?
有没有办法在不弹出我的 create-react-app
的情况下在 create-react-app 中配置 ESLint 规则?
可以使用注释仅针对某一特定行禁用 ESLint
规则:
<Map
// eslint-disable-next-line react/style-prop-object
style='mapbox://styles/user/hash'
...
这也适用于 create-react-app
构建。
有关详细信息,请参阅: http://eslint.org/docs/user-guide/configuring.html#configuring-rules