ESLint Typescript

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2021 Sep 10 5:44
Editor
Edited
Edited
2022 Jul 19 9:33
Refs
Refs
  • typescript
  • eslint
  • @typescript-eslint/parser
  • @typescript-eslint/eslint-plugin
 

import error

Moment not found in 'moment' (import/named)
CRA with typescript로 만든 프로젝트에서 eslint랑 prettier 설정을 한 상황.그런데 라이브러리에서 인터페이스를 임포트 하려는데, 그런 건 찾을 수가 없다며 eslint의 import/named 에러가 발생한다. 분명 그 위치에 인터페이스가 존재하는 것도 맞고, vscode도 그걸 인지하고 있는데 왜 eslint가 못찾겠다고 하는지 계속 헤맸다. .eslintignore에 node_modules를 추가 안해서 그런가 했는데 어차피 기본적으로 무시하게 되어 있다고 한다.
Moment not found in 'moment' (import/named)
 
TypeScript ESLint + Prettier 함께 사용하기(w/ VSCode)

variable type error

ESLint - Configuring "no-unused-vars" for TypeScript
I use ESLint in all of my TypeScript projects with the following settings: "extends": ["airbnb", "prettier", 'plugin:vue/recommended'], "plugins": ["prettier"], "parserOptions": { "parser": "@typescript-eslint/parser", "ecmaVersion": 2018, "sourceType": "module" }, a bunch of custom rules. I've also installed the following dependencies for TypeScript support: "@typescript-eslint/eslint-plugin": "^1.7.0", "@typescript-eslint/parser": "^1.7.0", However, one of ESLint's most useful rules, https://eslint.org/docs/rules/no-unused-vars, seems to be very poorly configured for TypeScript projects.
ESLint - Configuring "no-unused-vars" for TypeScript
 
 

Recommendations