[英]How can I disable break line prettier
例如,我的 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 不是最大值,我不想換行。 我怎樣才能阻止它?
埃斯林特規則。
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"
};
如果您不希望更漂亮的人為您的代碼的一部分設置樣式,您只需要這樣做:(更漂亮的忽略注釋)
{/* prettier-ignore */}
<Form.Item label="xxx"><Input /></Form.Item>
這是基於文檔: https://prettier.io/docs/en/ignore.html
希望這可以幫助
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.