Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vscode AutoSave With Prettier #64

Open
hsipeng opened this issue Aug 23, 2018 · 0 comments
Open

vscode AutoSave With Prettier #64

hsipeng opened this issue Aug 23, 2018 · 0 comments

Comments

@hsipeng
Copy link
Owner

hsipeng commented Aug 23, 2018

安装

eslint 和 prettier vscode 插件

环境安装

# 基础依赖
yarn add eslint babel-core babel-eslint eslint-config-airbnb eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-vue eslint-plugin-html eslint-config-prettier eslint-plugin-prettier prettier -D
 
# fbjs eslint 配置
yarn add eslint-config-fbjs -D
# fbjs plugin 依赖
yarn add eslint-plugin-babel eslint-plugin-flowtype eslint-plugin-relay babel-eslint -D

ps 依赖安装时如果全局依赖安装,那就统一全局依赖安装,如果workspace 安装,那就-D,npm 安装自行转换

.eslintrc.js

module.exports = {
  "extends": [
    "fbjs"
  ],
  "plugins": [
    "prettier",
    "react"
  ],
  "parser": "babel-eslint",
  "rules": {
    "relay/graphql-naming": 0,
    "max-len": 1,
    "singleQuote": true,
    "trailingComma": "all",
  },
  "env": {
    "node": true,
    "browser": true
  }
}

.prettierrc.js

{
  "bracketSpacing": false,
  "jsxBracketSameLine": true,
  "parser": "flow",
  "printWidth": 60,
  "singleQuote": true,
  "trailingComma": "es5"
  }

vscode 配置

    "prettier.eslintIntegration": true,
    "eslint.autoFixOnSave": true,
// 关闭系统自带的format
    "editor.formatOnSave": false,
    "javascript.format.enable": false,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant