sh 更漂亮,Esling,Airbnb设置

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 更漂亮,Esling,Airbnb设置相关的知识,希望对你有一定的参考价值。

{
  "engines": {
    "node": ">=4"
  },
  "devDependencies": {
    "eslint": "^4.11.0",
    "eslint-config-airbnb-base": "^12.1.0",
    "eslint-config-prettier": "^2.7.0",
    "eslint-plugin-import": "^2.8.0",
    "eslint-plugin-prettier": "^2.3.1",
    "eslint-watch": "^3.1.3",
    "husky": "^0.14.3",
    "lint-staged": "^5.0.0",
    "prettier": "^1.8.2"
  },
  "scripts": {
    "lint": "esw *.js src test",
    "lint:fix": "esw --fix *.js src test",
    "lint:watch": "esw --watch *.js src test",
    "lint:staged": "lint-staged",
    "precommit": "lint-staged"
  },
  "lint-staged": {
    "*.js": "esw"
  },
  "eslintConfig": {
    "extends": [
      "airbnb-base",
      "prettier",
    ],
    "plugins": [
      "prettier"
    ],
    "parserOptions": {
      "sourceType": "module",
      "ecmaFeatures": {
        "jsx": true
      }
    },
    "env": {
      "es6": true,
      "node": true,
      "browser": true,
      "jest": true,
    },
    "rules": {
      "prettier/prettier": [
        "error", 
        { 
          "semi": false,
          "singleQuote": true,
          "trailingComma": "all"
        }
      ]
    }
  }
}
# !/bin/bash

# eslint
yarn add eslint--dev
./node_modules/.bin/eslint --init
rm .eslintrc #or whatever

# prettier
yarn add prettier eslint-plugin-prettier eslint-config-prettier --dev

# eslint watch
yarn add eslint-watch --dev

# husky, lint-staged
yarn add husky lint-staged --dev

以上是关于sh 更漂亮,Esling,Airbnb设置的主要内容,如果未能解决你的问题,请参考以下文章

Atom 与 prettier、eslint 和 airbnb 风格的 React 开发指南

更漂亮 + eslint 换行符

创建 react app eslint 更漂亮的配置

如何让 VueJS + ESLint (Airbnb) + Prettier 一起工作? (VS代码)

使用 eslint-config-airbnb 后“./reducer”错误缺少文件扩展名“tsx”

vscode 更漂亮的设置