我有一个 ComponentA 并且要求默认将值设置为 0.00。但是,更漂亮的 eslint 在格式化这个组件文件时会将其从 0.00 转换为 0.0。我们如何防止这种情况发生?
export const ComponentA = ({ validate, isRequired }) => (
<ComponentB
validate={validate}
required={isRequired}
value={0.00}
/>
);
以下是 .eslintrc 文件中的设置
"plugins": ["react", "react-hooks", "prettier", "jsx-a11y", "import"],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:jsx-a11y/recommended",
"plugin:prettier/recommended"
],
"prettier/prettier": [
"error",
{
"endOfLine": "auto"
}
],