8월 3일 Eslint 및 Prettier 설정 - POB-Coconut/Assignment-3 GitHub Wiki

참고

Prettier 는 제가 평소에 쓰는 사항들 가져왔습니다.

eslint-airbnb 는 일단 Error가 나오는 부분들을 warn 으로 수정했습니다.

eslint configuring rules eslint 환경설정

  • 0 - turn the rule off 미적용
  • 1 - turn the rule on as a warning (doesn't affect exit code) 경고
  • 2 - turn the rule on as an error (exit code is 1 when triggered) 에러

 

변경하고 싶은 사항있으시면 왜 변경 했으면 좋겠는지 간단한 이유와 함께 부탁드립니다!

 

Prettier

{
  "printWidth": 100, // 한줄에 글자 수
  "tabWidth": 2, // 탭 간격
  "singleQuote": true, // '' 작은 따옴표 사용
  "jsxSingleQuote": true, // '' jsx에 작은 따옴표 사용
  "trailingComma": "all", // , 자동으로 붙이기
  "semi": true,
  "useTabs": false,
  "arrowParens": "always", // 1. (x) => x,  2. x => x  1번처럼 괄호 유지
  "endOfLine": "auto",
  "bracketSpacing": true, // 대괄호 {} 사이 공백
  "jsxBracketSameLine": true // JSX 요소 > 줄바꿈
}

 

eslint

"rules": {
    "react-hooks/rules-of-hooks": "error",
    "no-debugger": 0,
    "no-alert": 0,
    "no-unused-vars": 1,
    "prefer-const": [
      "error",
      {
        "destructuring": "all"
      }
    ],
    "arrow-body-style": [1, "as-needed"],
    "no-unused-expressions": [
      2,
      {
        "allowTaggedTemplates": true
      }
    ],
    "no-param-reassign": [
      2,
      {
        "props": false
      }
    ],
    "no-console": 1,
    "import/prefer-default-export": 1,
    "import": 0,
    "func-names": 0,
    "space-before-function-paren": 0,
    "comma-dangle": 0,
    "max-len": 0,
    "import/extensions": 0,
    "no-underscore-dangle": 0,
    "consistent-return": 0,
    "react/display-name": 1,
    "react/no-array-index-key": 0,
    "react/react-in-jsx-scope": 0,
    "react/prefer-stateless-function": 0,
    "react/forbid-prop-types": 0,
    "react/jsx-props-no-spreading": 0,
    "react/no-unescaped-entities": 0,
    "jsx-a11y/accessible-emoji": 0,
    "react/require-default-props": 0,
    "react/jsx-filename-extension": [
      1,
      {
        "extensions": [".js", ".jsx"]
      }
    ],
    "radix": 0,
    "no-shadow": "off",
    "quotes": [
      1,
      "single",
      {
        "avoidEscape": true,
        "allowTemplateLiterals": true
      }
    ],
    "prettier/prettier": [
      "warn",
      {
        "printWidth": 100,
        "tabWidth": 2,
        "useTabs": false,
        "singleQuote": true,
        "jsxSingleQuote": true,
        "trailingComma": "all",
        "semi": true,
        "arrowParens": "always",
        "endOfLine": "auto",
        "bracketSpacing": true,
        "jsxBracketSameLine": true
      }
    ],
    "jsx-a11y/href-no-hash": "off",
    "jsx-a11y/anchor-is-valid": [
      "warn",
      {
        "aspects": ["invalidHref"]
      }
    ]
  },