Cov txheej txheem:

Kuv yuav siv ESLint code hauv Visual Studio li cas?
Kuv yuav siv ESLint code hauv Visual Studio li cas?

Video: Kuv yuav siv ESLint code hauv Visual Studio li cas?

Video: Kuv yuav siv ESLint code hauv Visual Studio li cas?
Video: Siv Yis Neeb Leej Cawm Seej Music Video Short 2024, Kaum ib hlis
Anonim

command + shift + p thiab nws yuav qhib ib yam dab tsi zoo li no. Tam sim no, ntaus lub ESLint hauv lub thawv tshawb nrhiav, thiab koj yuav pom qee yam zoo li no, thiab koj yuav tsum xaiv qhov ESLint : Tsim ESLint configuration kev xaiv, thiab tom qab ntawd koj yuav pom cov davhlau ya nyob twg hauv Visual Studio Code yuav qhib nrog qee qhov kev xaiv.

Kuj paub, Eslint Vscode yog dab tsi?

ESLint yog lub cuab yeej rau "linting" koj cov cai. Nws tuaj yeem txheeb xyuas koj cov cai thiab ceeb toom koj ntawm qhov yuam kev. Txhawm rau kom nws ua haujlwm, koj yuav tsum teeb tsa nws nrog cov cai tshwj xeeb. Luckily, Standard muab ib qho ESLint configuration uas leej twg yuav siv tau. VS Code yog ib tug nrov code editor tsim los ntawm Microsoft.

Ib yam li ntawd, kuv yuav siv li cas zoo nkauj code hauv Visual Studio? Teeb nrog Visual Studio Code

  1. Nruab Prettier VS Code plugin. Qhib Command Palette (hauv qab saib submenu, lossis siv Cmd + Shift + P ntawm Mac thiab Ctrl + Ua haujlwm + P ntawm Windows).
  2. Khiav Prettier ntawm ib daim ntawv.
  3. Yeej khiav Prettier thaum txuag cov ntaub ntawv.

Raws li txoj cai, kuv yuav teeb tsa Eslint li cas?

cov kauj ruam:

  1. tsim ib qhov project javascript.
  2. nruab eslint ua qhov txuas ntxiv hauv koj VS Code Editor.
  3. Nruab eslint ua pob thoob ntiaj teb siv npm.
  4. pib eslint hauv koj qhov project javascript.
  5. hloov kho koj cov ntaub ntawv eslint configuration hauv koj qhov project.

Hom ntawv twg koj xav kom koj cov ntaub ntawv config nyob hauv Eslint?

ESLint txhawb cov ntaub ntawv teeb tsa hauv ntau hom:

  1. JavaScript - siv. eslintrc. js thiab export ib yam khoom uas muaj koj configuration.
  2. YAML - siv. eslintrc.
  3. JSON - siv. eslintrc.
  4. Deprecated - siv. eslintrc, uas tuaj yeem yog JSON lossis YAML.
  5. pob. json - tsim cov cuab yeej eslintConfig hauv koj pob.

Pom zoo: