Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: @typescript-eslint/naming-convention 이 실제로 잘 동작하도록 eslintrc.js의 설정을 변경합니다. #111

Merged
merged 3 commits into from
Jun 5, 2024

Conversation

juno7803
Copy link
Member

@juno7803 juno7803 commented Jun 1, 2024

Overview

docs아래 경로에서 yarn lint를 돌려보았을 때, 아래와 같이 경고메시지가 나타나고 있어 해당 문제를 수정한 PR이에요.

image
  • naming-convention룰은 typescript의 도움을 받아야 정상적으로 동작할 수 있는 룰이라고 문서에 설명되어 있어, 이에 맞게 eslintrc.js를 수정했어요. (requires type information to run)
  • project: true 옵션을 주게 되면, eslint가 동작하는 각 파일이 위치하는 곳의 가장 가까운 곳의 tsconfig.json을 매칭시켜 적용하게 돼요. (문서)
항목 AS-IS TO-BE
스샷 image image
설명 parserOptions.parser를 설정하지 않은 경우, naming-convention에 맞지 않는 snake_case의 variable이 통과함 parserOptions.parser를 true로 설정한 경우, naming-convention에 맞지 않는 snake_case의 variable에 에러를 띄워줌

PR Checklist

  • I read and included theses actions below
  1. I have read the Contributing Guide
  2. I have written documents and tests, if needed.

@juno7803 juno7803 self-assigned this Jun 1, 2024
Copy link

vercel bot commented Jun 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
es-hangul ❌ Failed (Inspect) Jun 5, 2024 6:31am

Copy link

changeset-bot bot commented Jun 1, 2024

⚠️ No Changeset found

Latest commit: 7852550

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@juno7803 juno7803 marked this pull request as draft June 1, 2024 03:26
@juno7803 juno7803 marked this pull request as ready for review June 1, 2024 03:33
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.51%. Comparing base (0cd45e4) to head (8f9aec6).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #111   +/-   ##
=======================================
  Coverage   99.51%   99.51%           
=======================================
  Files          13       13           
  Lines         206      206           
  Branches       46       46           
=======================================
  Hits          205      205           
  Misses          1        1           

@@ -8,5 +8,5 @@
"strict": true,
"skipLibCheck": true
},
"include": ["src"]
"include": ["src", ".eslintrc.js"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요 변경사항은 어떠한 이유인가용? 🙋

Copy link
Member Author

@juno7803 juno7803 Jun 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@okinawaa 요건 저도 987d0fd 를 푸시해보고 ci에서 뱉은 에러를 보고 알게되어 추가하게 되었어요!

image

.eslintrc.jsparserOptions.project: true 옵션을 추가하면서 ts의 도움을 받게 되었는데요, 이때 eslint에 의해 .eslintrc.js도 린팅 대상에 포함되었으나 설정에 추가되어 있지 않아 발생하는 에러라고 해요.

그래서 해당 파일도 린팅할지 말지 여부에 따라 설정을 변경하여 해당 에러를 해결할 수 있는데용,

  1. 린팅에 포함시키지 않으려면 .eslintignore.eslintrc.js를 포함시키는 방법
  2. 포함시키려면 아래의 방법들이 있는데요,
    • tsconfig.jsonincludes에 포함시키는 방법 (2-1)
    • tsconfig.jsonextendstsconfig.eslint.json을 만들고, .eslintrc.js를 포함시키는 방법 (2-2)

이 중에서 변경도 최소화 하면서, 설정 파일도 같이 린팅에 포함되도록 2-1 방법으로 처리해 주었습니다 🙇 (참고한 스택오버플로우, 공식문서)

Copy link
Member Author

@juno7803 juno7803 Jun 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@okinawaa 혹시 요거 머지해도 괜찮을까요~?! 🙏

Copy link
Member

@manudeli manudeli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@juno7803 juno7803 requested a review from okinawaa June 2, 2024 06:05
Copy link
Member

@okinawaa okinawaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

감사합니다!

@okinawaa okinawaa merged commit d1e39df into main Jun 5, 2024
2 of 10 checks passed
@juno7803 juno7803 deleted the fix/eslint-naming-convention branch June 5, 2024 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants