inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

React 기반 Gatsby로 기술 블로그 개발하기

TypeScript 개발 환경 구성하기

Parsing error: Cannot Read File tsconfig.json

2618

유진리

작성한 질문수 2

1

 
// tsconfig.json
{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "allowJs": true,
    "jsx": "preserve",
    "strict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "baseUrl": "./src",
    "paths": {
      "components/*": ["./components/*"],
      "utils/*": ["./utils/*"],
      "hooks/*": ["./hooks/*"]
    },
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "resolveJsonModule": true
  },
  "include": ["src/**/*.tsx"],
  "exclude": ["node_modules"]
}
// eslintrc.json
{
  "env": {
    "browser": true,
    "es2021": true
  },
  "extends": [
    "eslint:recommended",
    "plugin:@typescript-eslint/eslint-recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:@typescript-eslint/recommended-requiring-type-checking",
    "plugin:prettier/recommended"
  ],
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    },
    "ecmaVersion": 12,
    "sourceType": "module",
    "project": "./tsconfig.json"
  },
  "plugins": ["react", "@typescript-eslint"],
  "ignorePatterns": ["dist/", "node_modules/"],
  "rules": {}
}
// eslintignore
gatsby-browser.js
gatsby-config.js
gatsby-node.js
gatsby-ssr.js

 

eslintrc, eslintignore, tsconfig 모두 같은 폴더내부에 위치해있는데 왜 gatsby-browser.js 같은 설정 파일에서 parsing 에러가 날까요 ? ㅜㅜ

Gatsby blog

답변 2

2

유진리

{
  "env": {
    "browser": true,
    "es2021": true
  },
  "extends": [
    "eslint:recommended",
    "@typescript-eslint/parser",
    "plugin:@typescript-eslint/eslint-recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:@typescript-eslint/recommended-requiring-type-checking",
    "plugin:prettier/recommended"
  ],
  "parser": "@typescript-eslint/parser",
  "parserOptions": {
    "ecmaFeatures": {
      "jsx": true
    },
    "ecmaVersion": 12,
    "sourceType": "module",
    "project": "tsconfig.json"
  },
  "plugins": ["react", "@typescript-eslint"],
  "ignorePatterns": ["dist/", "node_modules/"],
  "rules": {}
}

 

extends에 @typescript-eslint/parser를 넣어서 해결했습니다!

0

주현도

안녕하세요, 곽성준님!

질문을 너무 늦게 확인했네요 죄송합니다 ㅠㅠ

스스로 해결 방안을 찾으셔서 정말 다행이네요!

쿼리오류 Field "thumbnail" must not have a selection...

1

872

1

타입스크립트를 설정할 때 jsxPragma 옵션을 뺀 이유는 무엇인가요?

1

605

1

마지막 배포 부분 질문드립니다!

1

623

1

'[username]/[username].github.io' -> 'username/reponame'

0

344

0

IntersectionObserver deploy( gatsby build) 시 오류(자답)

1

399

1

PostHead.tsx BackgroundImage 동작오류(자답)

1

296

0

19강 인피니티 스크롤 IntersectionObserver 코드 위치 수정이 필요합니다.

1

411

1

썸네일 이미지 제작 및 학습 방법 관련 문의

1

447

1

배포 후 포스트 업로드 방법

1

387

1

배포 질문이요!

1

528

1

gatsby develop 오류

1

940

1

깃허브 레퍼지토리 질문드려요

1

344

1

특정 게시글을 클릭하여 상세 페이지로 넘어가는 과정과 SPA에 관한 질문

1

285

1

Unhandled Runtime Error 가 뜹니다

0

506

2

sign in with GitHub 클릭 시

1

394

3

동작 반복 시 오류

1

351

2

const BackgroundImage 질문

1

212

1

오타 문의

1

305

2

Props로 받아 포스트 데이터 출력하기가 안됩니다.

1

203

1

index.tsx allMarkdownRemark 에러..

0

595

2

스네이크 케이스로 변수명을 짓는 이유

1

251

1

'Tagged Template Literal 방식을 통해 정의한 CSS 적용 방법'에서 발생하는 문제

3

353

2

상단 이미지를 썸네일 사용하지않고 다른 이미지를 쓰고싶습니다

1

284

1

여기까지 했는데 runtime 에러가 발생합니다

2

286

1