eslint에 typescript + react 설정을 해놨을 때 import React from 'react' 이 부분에 오류가 나옵니다

@typescript-eslint 쓸 때 발생하는건데, 해결방법만 짧게 설명하면 .eslintrc에 아래 내용을 추가해주면 됩니다

"rules": {
  // note you must disable the base rule as it can report incorrect errors
  "no-use-before-define": "off",
  "@typescript-eslint/no-use-before-define": ["error"]
}

자세한 백그라운드를 원하시면 아래 링크들을 확인하세요

 

반응형