0

How can I configure eslint or prettier to stop break useState and object lines? It is ok if it will break the line when the line is too long, but it keeps doing it event if there is a short useState or a small object as you can see at my examples.

from this

 const {
    movie: { backToListLabel },
  } = dictionary

to this

 const { movie: { backToListLabel }} = dictionary

eslintrc.json

{
  "env": {
    "browser": true,
    "es2021": true,
    "jest": true
  },
  "extends": [
    "plugin:react/recommended",
    "standard-with-typescript",
    "plugin:prettier/recommended"
  ],
  "overrides": [],
  "parserOptions": {
    "ecmaVersion": "latest",
    "sourceType": "module",
    "project": "./tsconfig.json"
  },
  "plugins": ["react", "@typescript-eslint", "prettier"],
  "rules": {
    "prettier/prettier": "error",
    "react/react-in-jsx-scope": "off",
    "@typescript-eslint/explicit-function-return-type": "off",
    "@typescript-eslint/triple-slash-reference": "off",
    "@typescript-eslint/strict-boolean-expressions": "off",
    "@typescript-eslint/no-floating-promises": "off",
    "@typescript-eslint/no-unused-vars": "warn"
  },
  "settings": {
    "react": {
      "version": "detect"
    }
  }
}

.prettierrc file

{
  "semi": false,
  "singleQuote": true,
  "trailingComma": "es5",
  "singleAttributePerLine": true
}
MishaOk
  • 1
  • 5
  • If you are using vs code and there is something not correctly formatted, it appears with yellow underline. When you hover over it, it tells you what is wrong and the rule name that tracks that format. Then you can search about the rule. – Oktay Yuzcan May 16 '23 at 15:01

0 Answers0