【发布时间】:2021-08-01 16:39:30
【问题描述】:
例如,我的 printWidth 值是 200 之类的,每次都会中断。
<Form.Item label="xxx"><Input /></Form.Item>
<Form.Item label="yyy"><Select /></Form.Item>
<Form.Item label="zzzz"><Input /></Form.Item>
当我在这个代码块中运行时,eslint 结果是
<Form.Item label="xxx">
<Input />
</Form.Item>
<Form.Item label="yyy">
<Select />
</Form.Item>
<Form.Item label="zzzz">
<Input />
</Form.Item>
如果 printWidth 不是最大值,我不想换行。怎么屏蔽?
Eslint 规则。
module.exports = {
extends: ['airbnb-typescript-prettier'],
parser: '@typescript-eslint/parser',
"ignorePatterns": ["**/components/global/context_menu/*"],
rules: {
"radix": 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'react/button-has-type': 'off',
'no-use-before-define': 'off',
'react/jsx-filename-extension': 'off',
'react/prop-types': 'off',
'jsx-a11y/alt-text': 'off',
'react/jsx-props-no-spreading': 'off',
'comma-dangle': 'off',
'consistent-this': [0, 'component'],
'@typescript-eslint/no-this-alias': 'off',
'react/forbid-prop-types': 'off',
'no-self-compare': 'off',
'react/require-default-props': 'off',
'no-return-assign': 'off',
'react/destructuring-assignment': 'off',
camelcase: 'off',
"jsx-a11y/label-has-associated-control":"off",
'prefer-destructuring': 'off',
'react-hooks/exhaustive-deps':'off',
'jsx-a11y/click-events-have-key-events':'off',
'jsx-a11y/no-static-element-interactions':'off',
'no-throw-literal': 'off',
'no-mixed-spaces-and-tabs': 'off',
'no-tabs': 'off',
'react/no-unescaped-entities': 'off',
'no-underscore-dangle': 'off',
'import/no-cycle': 'off',
'max-len': [2, 150, 2],
},
};
更漂亮的规则。
module.exports = {
singleQuote: true,
trailingComma: 'all',
printWidth: 200,
arrowParens:"always"
};
【问题讨论】:
标签: reactjs typescript jsx eslint prettier