npm i typescript -D
npx tsc --init
compiler ====>Js
mkdir src, npx tsc ./src/test.ts
~concept: type with js
------------------------
安装 npm install eslint -D npx eslint --init style esm(jsmodel) react browser
.eslintrc.js: env:node:true如果有波浪线的haul
修改rules:quotes:["error","double"] alwaysrun: npx eslint ./.eslintrc.js --fix
rules:{"prettier/prettier: ["error",{singleQuote:true}]
----------------------------------------(env:whereweusecode ,extends:addtionaltype of config )
prettier
opinionated code formatter
npm remove eslint-config-airbnb eslint-plugin-jsx-ally(uninstall eslint-plugin-jsx-ally --save-dev)
yarn....
npm install --save-dev --save-exact prettier npm install --save-dev eslint-config-prettier
extends: prettier
then,
npm i prettier eslint-config-prettier eslint-plugin-prettier -D 手动加extends and plugin
---------------------------------------
source control :message“eslint init”
plugin is extra bits of package code that you can add to
What is the difference between Eslint sections extends and plugin?
Extends uses a config file which applies set of rules when you add that to the extends options. A plugin on the other hand provides you with a set of rules that you can individually apply depending on your need. Just having a plugin does not enforce any rule. You have to choose which rules you need. A plugin may provide you with zero, one, or more configuration files. If the plugin provides configuration file, then you can load that in your extends section after adding the plugin in the plugins section.
Working with Plugins
What is prettier?
Prettier.io
What is Prettier?
-
An opinionated code formatter
-
Supports many languages
-
Integrates with most editors
-
Has few options
Why?
-
You press save and code is formatted
-
No need to discuss style in code review
-
Saves you time and energy