๋น์ ์ ๋ฌด์์ ์ฑ์ทจํ๋ ค๊ณ ํฉ๋๊น?
TSLint๊ฐ ๋ ์ด์ ์ฌ์ฉ๋์ง ์๊ณ Eslint๊ฐ ์ด์ Typescript / TSX ํ์ผ์ ๋ฆฐํธํ๋ ๋ฐ ๊ถ์ฅ๋๋ ๋ฐฉ๋ฒ์ด๋ฏ๋ก Eslint๋ฅผ ์ฌ์ฉํ์ฌ Typescript ํ์ผ์ ๋ฆฐํธํ๊ณ ์ถ์ต๋๋ค.
linting์ Tide ์ฌ์ฉ์ ๋ฐฉ์งํ๊ณ .js ํ์ผ๊ณผ ๊ฐ์ด Eslint๋ฅผ ๊ธฐ๋ณธ๊ฐ์ผ๋ก ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ์ ๋ํด ์ฝ๊ฐ์ ์์ค์ด ์์ต๋๋ค.
๋น์ ์ ๋ฌด์์ ์๋ ํ์ต๋๊น?
typescript-eslint
ํจํค์ง ๋ฅผ ์ค์นํ์ฌ Typescript๋ฅผ ์ฌ๋ฐ๋ฅด๊ฒ ์ฒ๋ฆฌํ๋๋ก .eslintrc
ํ์ผ์ ๊ตฌ์ฑํ์ต๋๋ค.
์์คํ
์ ๋ณด
((emacs
(๋ฒ์ . "26.3")
(๊ธฐ๋ฅ. "NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS THREADS")
(๋น๋. "2019 ๋
12 ์ 28 ์ผ")
(buildopts "--enable-locallisppath = / usr / local / share / emacs / site-lisp --infodir = / usr / local / Cellar / emacs-mac / emacs-26.3-z-mac-7.8 / share / info / emacs --prefix = / usr / local / Cellar / emacs-mac / emacs-26.3-z-mac-7.8 --with-mac --enable-mac-app = / usr / local / Cellar / emacs-mac / emacs -26.3-z-mac-7.8 --gnutls ํฌํจ ")
(windowsys. ๋ฐฐ์น)
(daemonp. ์๋ฒ ์คํ))
(์ด๋ช
(๋ฒ์ . "2.0.9")
(๋น๋. "HEAD-> 453e20534 ๊ฐ๋ฐ 2020-01-15 11:19:32 -0500")
(dir. "~ / work / dotfiles / emacs / .doom.d /"))
(์ฒด๊ณ
(์ ํ. darwin)
(๊ตฌ์ฑ. "x86_64-apple-darwin18.7.0")
(์. "/ usr / local / bin / fish")
(uname. "Darwin 18.7.0 Darwin Kernel ๋ฒ์ 18.7.0 : Tue Aug 20 16:57:14 PDT 2019; root : xnu-4903.271.2 ~ 2 / RELEASE_X86_64 x86_64")
(๊ฒฝ๋ก "~ / .nvm / versions / node / v12.13.0 / bin" "~ / go / bin" "~ / .bin" "~ / .yarn / bin" "~ / .config / yarn / global / node_modules /.bin ""~ / .rbenv / bin ""~ / .rbenv / shims ""/ usr / local / bin ""/ usr / bin ""/ bin ""/ usr / sbin ""/ sbin ""/ usr / local / go / bin ""/ usr / local / MacGPG2 / bin ""/Library/Frameworks/Mono.framework/Versions/Current/Commands ""/ Library / TeX / texbin ""~ / go / bin "" ~ / .bin ""~ / .yarn / bin ""~ / .config / yarn / global / node_modules / .bin ""~ / .rbenv / bin ""~ / .rbenv / shims ""~ / .rbenv / versions / 2.6.3 / bin ""/usr/local/Cellar/rbenv/1.1.2/libexec ""/usr/local/Cellar/emacs-mac/emacs-26.3-z-mac-7.8/libexec/emacs/ 26.3 / x86_64-apple-darwin18.7.0 "))
(๊ตฌ์ฑ
(envfile. envvar-file)
(elc-files. 0)
(๋ชจ๋ : ์์ฑ ํ์ฌ ivy : ui doom doom-dashboard doom-quit hl-todo modeline nav-flash ophints (popup + all + defaults) treemacs unicode vc-gutter vi-tilde-fringe window-select workspaces : editor (evil + everywhere ) ํ์ผ ํ
ํ๋ฆฟ ์ ๊ธฐ ๋ค์ค ์ปค์ ํ์ ํ
์คํธ ์ค ๋ํซ : emacs (dired + icons) electric vc : term vterm : tools editorconfig eval : checkers ๊ตฌ๋ฌธ : tools (lookup + docsets) macos magit pdf : lang common-lisp data emacs-lisp go javascript latex ledger markdown (org + dragndrop + ipython + pandoc + present) plantuml python ruby โโrust sh web : config literate (default + bindings + smartparens))
(ํจํค์ง "ํด๋น ์์")
(elpa "ox-hugo")))
๋ด ์ง๋ฌธ์ ๋ฐ๋ผ javascript-eslint
์์ typescript-mode
javascript-eslint
์คํํ๋ ๋ฐฉ๋ฒ์ ์์ ๋์ต๋๋ค.
(defun typescript-mode-setup ()
"Custom setup for Typescript mode"
(setq flycheck-checker 'javascript-eslint)
)
(add-hook 'typescript-mode-hook 'typescript-mode-setup)
๊ทธ๋ฌ๋ฉด .tsx
ํ์ผ์ด typescript-mode
(์ด ๋ชจ๋๋ JSX / TSX๋ฅผ ์ง์ํ์ง ์์)์์ ์ด๋ฆฌ์ง ์๊ณ web-mode
์์ ์ด๋ฆฌ๊ฒ๋๋ฉฐ javascript-eslint
์ web-mode
๋ํ ์ ํจํ Flycheck ๊ฒ์ฌ๊ธฐ๊ฐ ์๋๋๋ค.
๋ฐ๋ผ์ TSX ํ์ผ์ ๋ํด typescript-mode
๋ฅผ ์ฌ์ฉํ๊ณ JSX ๋ถ๋ถ์ ๋ํ ๊ตฌ๋ฌธ ๊ฐ์กฐ ๋ฐ ๋ค์ฌ ์ฐ๊ธฐ์ ์ฅ์ ์ ์๊ฑฐ๋ Eslint ์ฌ์ฉ์ ํฌ๊ธฐํด์ผํฉ๋๋ค.
์ด๋ค ํต์ฐฐ๋ ฅ์ด๋ผ๋ ๋๋จํ ๊ฐ์ฌํ๊ฒ ์ต๋๋ค ๐
@gueorgui ๋ฉ์ง๊ฒ ์๋ํ๋ ค๋ฉด vue
๊ณผ ๋น์ทํ ์์
์ ์ํํด์ผํ์ผ๋ฉฐ ๋ค์๊ณผ ๊ฐ์ด ๋๋ฌ์ต๋๋ค.
(define-derived-mode vue-mode web-mode "Vue mode")
(add-to-list 'auto-mode-alist '("\\.vue\\'" . vue-mode))
(after! flycheck
(flycheck-add-mode 'javascript-eslint 'vue-mode)
(flycheck-add-mode 'css-stylelint 'vue-mode)
(add-hook 'vue-mode-hook (lambda () (flycheck-add-next-checker 'lsp-ui 'javascript-eslint)))
(add-hook 'vue-mode-hook (lambda () (flycheck-add-next-checker 'javascript-eslint 'css-stylelint))))
๋น์ ์ ์ธ์คํด์ค ๋์ฒด ํ ์ vue
์ tsx
ํ๊ณ ์ ๊ฑฐ stylelint
๋ฟ๋ง ์๋๋ผ ์ง์. ๋ํ lsp
๋ฅผ ์ฌ์ฉํ๋ฏ๋ก ์ด์ ๋ง๊ฒ ์กฐ์ ํด์ผ ํ ์๋ ์์ต๋๋ค.
@afontaine ์ด๊ฒ์ ๋ํด ๋๋จํ ๊ฐ์ฌํฉ๋๋ค!
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
@gueorgui ๋ฉ์ง๊ฒ ์๋ํ๋ ค๋ฉด
vue
๊ณผ ๋น์ทํ ์์ ์ ์ํํด์ผํ์ผ๋ฉฐ ๋ค์๊ณผ ๊ฐ์ด ๋๋ฌ์ต๋๋ค.๋น์ ์ ์ธ์คํด์ค ๋์ฒด ํ ์
vue
์tsx
ํ๊ณ ์ ๊ฑฐstylelint
๋ฟ๋ง ์๋๋ผ ์ง์. ๋ํlsp
๋ฅผ ์ฌ์ฉํ๋ฏ๋ก ์ด์ ๋ง๊ฒ ์กฐ์ ํด์ผ ํ ์๋ ์์ต๋๋ค.