/// 生成一个空的package.json
npm init -y
///安装 eslint
npm install --save-dev eslint
node_modules\.bin\eslint --init
/// prettier
npm install --save-dev prettier
新建一个 .prettierrc 的文件
npm install --save-dev eslint-plugin-prettier eslint-config-prettier
在 .eslint.json 文件中的extends 添加 "plugin:prettier/recommended"
.eslintrc
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
["prettier"],
["plugin:prettier/recommended"]
],
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "error",
"arrow-body-style": "off",
"prefer-arrow-callback": "off"
}
}
.gitignore
.DS_Store
Thumbs.db
db.json
*.log
node_modules/
dist
.deploy*/
/node_modules
yarn.lock
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
.vscode/*
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
testem.log
/typings
/e2e/src/*.js
/e2e/src/*.map
/cypress/screenshots
.prettierrc
{
"tabWidth": 2,
"printWidth": 80,
"singleQuote": false,
"semi": true,
"arrowParens": "always"
}