-
[error] trailing spaces not allowed.eslintno-trailing-spaces, Delete `⏎`eslintprettier/prettierReact-Native 2024. 4. 25. 13:28728x90반응형
자꾸 엔터만 치면 위와 같은 에러가 아주 친절하게 같이 나왔다
솔직히 개발하는데는 큰 문제는 없는 에러고 그냥 무시해도 되지만...
빨간줄이 거슬려서 설정을 아래와 같이 변경해서 해결했다
1. trailing spaces not allowed.eslintno-trailing-spaces
(vscode)
settings -> trim tailing spaces 검색 -> Trim Trailing Whitespace 체크
2. Delete `⏎`eslintprettier/prettier
.eslintrc.js (해당 프로젝트의 eslint 관련 설정파일에 들어가면 될듯) -> 아래와 같이 수정
// 기존 코드
module.exports = { root: true, extends: '@react-native', };
// 수정 후 코드
module.exports = { root: true, extends: ['@react-native', 'prettier'], Plugin: ['prettier'], rules: { 'prettier/prettier': [ 'error', { endOfLine: 'auto', }, ], }, };
extends에 prettier를 추가해 prettier에 지정한 포맷팅 규칙을 확장해서 사용할 수 있도록 했다
플러그인에 prettier를 추가해서 prettier의 코드 포맷팅 규칙을 eslint 규칙으로도 적용할 수 있게한다
rules는 규칙을 커스터마이징 할 수 있는 부분이라고 한다
error라는 규칙을 만들어서 코드 포맷팅할 때 줄바꿈 관련 문제를 자동으로 해결하도록 설정한다
참고 :
https://velog.io/@realsong/VS-Delete-prettierprettier-%ED%95%B4%EA%B2%B0-%EB%B0%A9%EB%B2%95반응형'React-Native' 카테고리의 다른 글
[RN] gif 적용하기 (2) 2024.07.10 [React-Native] 폰트 적용하기 (0) 2024.04.26 [React-Native] 셋팅(Mac, android) (0) 2024.04.24 [React-Native] React-Native CLI로 프로젝트 시작, 셋팅(Mac,IOS) (0) 2024.04.24 [React-Native] Android Studio AVD 스킨 추가하기 (0) 2024.04.23