eslint-config-egg
Node Style Guide for Egg.
Last updated 4 years ago by popomore .
Repository · Bugs · Original npm · Tarball · package.json
$ npm install eslint-config-egg 
SYNC missed versions from official npm registry.

eslint-config-egg

NPM version build status Test coverage Known Vulnerabilities npm download

Node.js Style Guide for Eggjs and Node.js

Install

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

Usage

Use with JavaScript project

  • package.json
{
  "devDependencies": {
    "eslint-config-egg": "13",
    "eslint": "8"
  }
}
  • .eslintrc
{
  "extends": [
    "eslint-config-egg",
    "eslint-config-egg/lib/rules/enforce-node-prefix"
  ]
}

Use with TypeScript project

  • package.json
{
  "devDependencies": {
    "eslint-config-egg": "13",
    "typescript": "^4.5.2"
  }
}
  • .eslintrc
{
  "extends": [
    "eslint-config-egg/typescript",
    "eslint-config-egg/lib/rules/enforce-node-prefix"
  ]
}
  • scripts
{
  "lint": "eslint . --ext .ts"
}
  • settings.json in vscode
{
  "eslint.validate": [
    "javascript",
    "javascriptreact",
    {
      "language": "typescript",
      "autoFix": true
    },
  ]
}

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 parser:

  • package.json
{
  "devDependencies": {
    "eslint-config-egg": "13",
    "eslint": "8",
    "@babel/core": "7",
    "@babel/eslint-parser": "7"
  }
}
  • .eslintrc.js
module.exports = {
  extends: 'eslint-config-egg',
  // for experimental features support
  parser: '@babel/eslint-parser',
  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": "13",
    "eslint": "8",
    "@babel/core": "7",
    "@babel/eslint-parser": "7",
    "eslint-plugin-react": "7"
  }
}
  • .eslintrc.js
module.exports = {
  extends: 'eslint-config-egg',
  // for experimental features support
  parser: '@babel/eslint-parser',
  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


whxaxes


atian25


benjycui


geekdada


dead-horse


sang4lv


nightink


missjing


ShadyZOZ


zhaoxingyue


bowei-jbw


aladdin-add


hotoo

This project follows the git-contributor spec, auto updated at Thu Jun 02 2022 15:10:46 GMT+0800.

Current Tags

  • 14.0.0                                ...           latest (5 months ago)
  • 12.3.1                                ...           release-12.x (a year ago)
  • 13.1.0                                ...           release-13.x (a year ago)

47 Versions

  • 14.0.0                                ...           5 months ago
  • 13.1.0                                ...           a year ago
  • 13.0.0                                ...           a year ago
  • 12.3.1                                ...           a year ago
  • 12.3.0                                ...           a year ago
  • 12.2.1                                ...           2 years ago
  • 12.2.0                                ...           2 years ago
  • 12.1.0                                ...           2 years ago
  • 12.0.0                                ...           2 years ago
  • 11.1.0                                ...           3 years ago
  • 11.0.1                                ...           3 years ago
  • 11.0.0                                ...           3 years ago
  • 10.0.0                                ...           3 years ago
  • 9.0.0                                ...           4 years ago
  • 8.1.2                                ...           4 years ago
  • 8.1.1                                ...           4 years ago
  • 8.1.0                                ...           4 years ago
  • 8.0.1                                ...           5 years ago
  • 8.0.0                                ...           5 years ago
  • 7.5.1                                ...           5 years ago
  • 7.5.0                                ...           5 years ago
  • 7.4.1                                ...           6 years ago
  • 7.4.0                                ...           6 years ago
  • 7.3.1                                ...           6 years ago
  • 7.3.0                                ...           6 years ago
  • 7.2.0                                ...           6 years ago
  • 7.1.0                                ...           6 years ago
  • 7.0.0                                ...           7 years ago
  • 6.0.0                                ...           7 years ago
  • 5.1.1                                ...           7 years ago
  • 5.1.0                                ...           7 years ago
  • 5.0.0                                ...           7 years ago
  • 4.2.1                                ...           7 years ago
  • 4.2.0                                ...           7 years ago
  • 4.1.0                                ...           8 years ago
  • 4.0.0                                ...           8 years ago
  • 3.2.0                                ...           8 years ago
  • 3.1.0                                ...           8 years ago
  • 3.0.3                                ...           8 years ago
  • 3.0.2                                ...           8 years ago
  • 3.0.1                                ...           8 years ago
  • 3.0.0                                ...           8 years ago
  • 2.0.0                                ...           9 years ago
  • 1.0.3                                ...           9 years ago
  • 1.0.2                                ...           9 years ago
  • 1.0.1                                ...           9 years ago
  • 1.0.0                                ...           9 years ago
Downloads
Total 1
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dev Dependencies (7)

© 2010 - cnpmjs.org x YWFE | Home | YWFE