ESlint的使用
官方网站
eslint 官网 eslint-plugin-prettier 官网 lint-staged 官网 prettier 官网
安装
npm install eslint --save-dev
配合 prettier 安装
npm install eslint eslint-config-prettier eslint-plugin-prettier prettier --save-dev
初始化配置
./node_modules/.bin/eslint --init
或者
npx eslint --init
根据提示进行配置
$ npx eslint --init
You can also run this command directly using 'npm init @eslint/config'.
√ How would you like to use ESLint? · style
√ What type of modules does your project use? · none
√ Which framework does your project use? · none
√ Does your project use TypeScript? · No / Yes
√ Where does your code run? · browser
√ How would you like to define a style for your project? · prompt
√ What format do you want your config file to be in? · JavaScript
√ What style of indentation do you use? · tab
√ What quotes do you use for strings? · double
√ What line endings do you use? · unix
√ Do you require semicolons? · No / Yes
A config file was generated, but the config file itself may not follow your linting rules.
Successfully created .eslintrc.js file in C:\ls-project03\miniprogr