Skip to content

starlight321/eslint-config

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

使用方法

在你的项目根目录下创建 .eslintrc.js,根据不同情况,将代码复制到文件中:

prettier 配置

创建 .prettierrc 文件

{
  "singleQuote": true,
  "trailingComma": "es5",
  "printWidth": 100,
  "proseWrap": "never"
}

Javascript

npm install --save-dev eslint babel-eslint @diamondyuan/eslint-config-javascript
module.exports = {
  extends: ["@diamondyuan/javascript"]
};

prettier

npm install --save-dev eslint-config-prettier prettier eslint-plugin-prettier
yarn add --dev eslint-config-prettier prettier eslint-plugin-prettier
module.exports = {
  extends: ["@diamondyuan/react-javascript", "prettier"],
  plugins: ["prettier"],
  rules: {
    "prettier/prettier": "error"
  }
};

React

npm install --save-dev eslint babel-eslint eslint-plugin-react eslint-plugin-react-hooks @diamondyuan/eslint-config-react
module.exports = {
  extends: ["@diamondyuan/react"]
};

prettier

npm install --save-dev eslint-config-prettier prettier eslint-plugin-prettier
yarn add --dev eslint-config-prettier prettier eslint-plugin-prettier
module.exports = {
  extends: ["@diamondyuan/react", "prettier", "prettier/react"],
  plugins: ["prettier"],
  rules: {
    "prettier/prettier": "error"
  }
};

TypeScript

npm install --save-dev eslint babel-eslint typescript @typescript-eslint/parser @typescript-eslint/eslint-plugin @diamondyuan/eslint-config-typescript
module.exports = {
  extends: ["@diamondyuan/typescript"]
};

prettier

npm install --save-dev eslint-config-prettier prettier eslint-plugin-prettier
yarn add --dev eslint-config-prettier prettier eslint-plugin-prettier
module.exports = {
  extends: [
    "@diamondyuan/typescript",
    "prettier",
    "prettier/@typescript-eslint"
  ],
  plugins: ["prettier"],
  rules: {
    "prettier/prettier": "error"
  }
};

React TypeScript

npm install --save-dev eslint typescript babel-eslint eslint-plugin-react eslint-plugin-react-hooks @typescript-eslint/parser @typescript-eslint/eslint-plugin @diamondyuan/eslint-config-react-typescript
module.exports = {
  extends: ["@diamondyuan/react-typescript"]
};

prettier

npm install --save-dev eslint-config-prettier prettier eslint-plugin-prettier
yarn add --dev eslint-config-prettier prettier eslint-plugin-prettier
module.exports = {
  extends: [
    "@diamondyuan/react-typescript",
    "prettier",
    "prettier/@typescript-eslint",
    "prettier/react"
  ],
  plugins: ["prettier"],
  rules: {
    "prettier/prettier": "error"
  }
};

About

eslint-config for DiamondYuan

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%