npm

Need private packages and team management tools?Check out npm Orgs. »

eslint-config-egg

7.4.1 • Public • Published

eslint-config-egg

Node Style Guide for Egg.

Install

npm i eslint eslint-config-egg --save-dev

Usage

  • package.json
{
  "devDependencies": {
    "eslint-config-egg": "7",
    "eslint": "4"
  }
}
  • .eslintrc.js
module.exports = {
  extends: 'eslint-config-egg',
};

Use with Experimental Features

If you want to use eslint-config-egg with experimental features such as async function, you should use babel-eslint parser:

  • package.json
{
  "devDependencies": {
    "eslint-config-egg": "7",
    "eslint": "4",
    "babel-eslint": "8"
  }
}
  • .eslintrc.js
module.exports = {
  extends: 'eslint-config-egg',
  // for experimental features support
  parser: 'babel-eslint',
  rules: {
    // see https://github.com/eslint/eslint/issues/6274
    'generator-star-spacing': 'off',
    'babel/generator-star-spacing': 'off',
  }
};

Use with React in Front-End

If you want to use eslint-config-egg with react, jsx and es6 modules:

  • package.json
{
  "devDependencies": {
    "eslint-config-egg": "7",
    "eslint": "4",
    "babel-eslint": "8",
    "eslint-plugin-react": "7"
  }
}
  • .eslintrc.js
module.exports = {
  extends: 'eslint-config-egg',
  // for experimental features support
  parser: 'babel-eslint',
  parserOptions: {
    // for es6 module
    sourceType: 'module',
  },
  plugins: [
    'react',
  ],
  rules: {
    // for variables in jsx
    'react/jsx-uses-vars': 'error',
    // see https://github.com/eslint/eslint/issues/6274
    'generator-star-spacing': 'off',
    'babel/generator-star-spacing': 'off',
  },
};

License

MIT

Contributors


popomore


fengmk2


atian25


benjycui


geekdada


dead-horse


bowei-jbw


aladdin-add


hotoo

This project follows the git-contributor spec, auto updated at Mon Mar 11 2019 15:51:28 GMT+0800.

Keywords

none

install

npm i eslint-config-egg

Downloadsweekly downloads

13,201

version

7.4.1

license

none

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
Report a vulnerability