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

.eslintrc.js 설정 파일 적용 불가 관련 이슈 및 제안 #31

Open
hypspace opened this issue Sep 25, 2024 · 0 comments
Open

.eslintrc.js 설정 파일 적용 불가 관련 이슈 및 제안 #31

hypspace opened this issue Sep 25, 2024 · 0 comments

Comments

@hypspace
Copy link

hypspace commented Sep 25, 2024

개요

  • TS 프로젝트 환경 구성 부분 중 4번 진행(링크)
  • .eslintrc.js 제공하신 파일 구문이 적용되지 않는 것을 발견했고 이에 옵션을 수정했습니다, 해당 코드를 공유합니다.

결과

img_01

수정한 코드 및 추가 설치 플러그인 명령어

// .eslintrc.js
module.exports = {
  root: true,
  env: {
    browser: true,
    node: true,
  },
  extends: [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:import/errors", // 추가
    "plugin:import/warnings", // 추가
    "plugin:prettier/recommended", // Prettier와 통합
  ],
  plugins: ["prettier", "@typescript-eslint"],
  rules: {
    "prettier/prettier": [
      "error",
      {
        singleQuote: false,
        semi: true,
        useTabs: false,
        tabWidth: 2,
        printWidth: 80,
        bracketSpacing: true,
        arrowParens: "avoid",
        trailingComma: "es5", // 추가
      },
    ],
    // 추가적으로 원하는 규칙을 여기에 추가할 수 있습니다.
    "no-console": "warn", // 예: console 사용 경고
    "no-explicit-any": "off", // any 사용 허용
  },
  parserOptions: {
    parser: "@typescript-eslint/parser",
    ecmaVersion: 2021, // 최신 ECMAScript 버전 사용
    sourceType: "module", // 모듈 사용
  },
  settings: {
    "import/resolver": {
      node: {
        extensions: [".js", ".jsx", ".ts", ".tsx"],
      },
    },
  },
};
npm install -D eslint-plugin-import
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

No branches or pull requests

1 participant