简体   繁体   English

ESLint:括号内的间距与反应

[英]ESLint: spacing inside parenthesis with react

Does anyone know which ESLint configuration rule is causing my jsx inside parenthesis to be 4 more spaces on the left then I expect?有谁知道哪个 ESLint 配置规则导致我的括号内的jsx比我期望的左侧多 4 个空格?

import React from 'react';

import './styles.scss';

const TableWrapper = ({
    children,
}) => (
        <div className="table-wrapper">
            {children}
        </div>
    );

export default TableWrapper;

Using eslint:recommended , plugin:react/recommended , and eslint-config-prettier使用eslint:recommendedplugin:react/recommendedeslint-config-prettier

It has nothing to do with the eslint.它与 eslint 无关。 Spaces between and so on, is your prettier.等等之间的空格,是你的漂亮。 I would suggest you create a .prettierrc file in the root folder and play with the settings.我建议您在根文件夹中创建一个.prettierrc文件并使用设置。 Here is a basic example of what you can copy paste into the file这是您可以复制粘贴到文件中的内容的基本示例

{
 "endOfLine": "lf",
 "semi": true,
 "singleQuote": true,
 "tabWidth": 2,
 "trailingComma": "es5",
}

In your case, the tabWidth will affect how much spaces there is between your parentheses在您的情况下, tabWidth 将影响括号之间的空格数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM