1. 문제 상황

Screenshot 2024-02-05 at 9.41.00 PM.png

저장을 했을 때, import 정렬이 되지 않는다.

Screenshot 2024-02-05 at 9.41.20 PM.png

prettier는 분명히 정상적으로 동작하고 있다.

다른 간격이라던가 tab같은 prettier 설정은 잘 동작하고 있다.

2. 해결 과정

팀원은 잘 되고 있을까?

eslint 설정의 문제일까?

  1. 에러를 출력하는 eslint 설정

    // .eslintrc.json
    {
      // ..
    	"import/order": [
        "error",
        {
          "groups": [
            ["builtin", "external"],
            ["internal", "parent", "sibling", "index"],
            ["object"],
            ["type"]
          ],
          "newlines-between": "always",
          "alphabetize": {
            "order": "asc",
            "caseInsensitive": true
          }
        }
      ]
    }
    
    
  2. 정렬을 하는 eslint 설정

    "sort-imports": [
      "error",
      {
        "ignoreDeclarationSort": true,
        "ignoreMemberSort": false
      }
    ],
    

정상적으로 설정이 되어있다.

vscode 설정의 문제일까?

// settings.json
"editor.codeActionsOnSave": {
  "source.fixAll.eslint": "always"
},
// settings.json
"eslint.codeActionsOnSave.rules": [
  "source.fixAll.eslint"
],

위 설 정을정거거하니해결이 되었다. 위 설정을 삭제하면, eslintrc 파일의 규칙대로 fix가 된다.