[환경설정] eslint 세부 설정

Arin·2021년 4월 17일
0

Daily Note

목록 보기
1/2

1. Delete eslint

Delete `␍` eslint (prettier/prettier)

이를 해결하는 방법

.eslintrc.json 파일에서 { "endOfLine": "auto"} 를 추가해 준다.

"prettier/prettier": ["error",
           { "endOfLine": "auto"}
        ],

2. Missing return type on function.

Missing return type on function. 
(eslint@typescript-eslint/explicit-function-return-type)

타입스크립트에서 함수형 컴포넌트 사용시 React.FC를 사용하지 말아야 함.
defaultProps가 잘 동작하지 않는 경우가 발생할 수 있기 때문.
그러나 return type을 설정하지 않으면 에러가 발생함....

해결하는 방법

"rules": {
        '@typescript-eslint/explicit-function-return-type': 'off',
    },
profile
2년차 프론트앤드

0개의 댓글