A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/antfu/eslint-config/issues/185 below:

How to use this configuration to format JSX.Element · Issue #185 · antfu/eslint-config · GitHub

ignoredNodes: ['TemplateLiteral *', 'JSXElement', 'JSXElement > *', 'JSXAttribute', 'JSXIdentifier', 'JSXNamespacedName', 'JSXMemberExpression', 'JSXSpreadAttribute', 'JSXExpressionContainer', 'JSXOpeningElement', 'JSXClosingElement', 'JSXFragment', 'JSXOpeningFragment', 'JSXClosingFragment', 'JSXText', 'JSXEmptyExpression', 'JSXSpreadChild'],

I want to autofix indent in the JSX Element of the tsx file, but it doesn't work. and then i saw that the configuration ignored the indent rules related to JSX Element

I would like to ask why this configuration is necessary

When I configure it this way, my jsx element indent will work normally

{
  "extends": [
    "@antfu",
    "@unocss"
  ],
  "rules": {
    "indent": [
      "error",
      2,
      {
        "SwitchCase": 1,
        "VariableDeclarator": 1,
        "outerIIFEBody": 1,
        "MemberExpression": 1,
        "FunctionDeclaration": { "parameters": 1, "body": 1 },
        "FunctionExpression": { "parameters": 1, "body": 1 },
        "CallExpression": { "arguments": 1 },
        "ArrayExpression": 1,
        "ObjectExpression": 1,
        "ImportDeclaration": 1,
        "flatTernaryExpressions": false,
        "ignoreComments": false,
        "ignoredNodes": [
          // "TemplateLiteral *",
          // "JSXElement",
          // "JSXElement > *",
          // "JSXAttribute",
          // "JSXIdentifier",
          // "JSXNamespacedName",
          // "JSXMemberExpression",
          // "JSXSpreadAttribute",
          // "JSXExpressionContainer",
          // "JSXOpeningElement",
          // "JSXClosingElement",
          // "JSXFragment",
          // "JSXOpeningFragment",
          // "JSXClosingFragment",
          // "JSXText",
          // "JSXEmptyExpression",
          // "JSXSpreadChild",
          "TSTypeParameterInstantiation",
          "FunctionExpression > .params[decorators.length > 0]",
          "FunctionExpression > .params > :matches(Decorator, :not(:first-child))",
          "ClassBody.body > PropertyDefinition[decorators.length > 0] > .key"
        ],
        "offsetTernaryExpressions": true
      }
    ]
  }
}


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4