ESLint Config for JavaScript
Jul 18, 2018 · 1 分钟阅读

eslint-config-airbnb-base

Install

  1. List the correct versions of each package:
❯ npm info "eslint-config-airbnb-base@latest" peerDependencies
{ eslint: '^5.16.0 || ^6.1.0', 'eslint-plugin-import': '^2.18.2' }
  1. Install the package:
❯ yarn add eslint eslint-plugin-import eslint-config-airbnb-base -D

Usage

❯ npx eslint --init
// .eslintrc.js
module.exports = {
  "env": {
    "browser": true,
    "es6": true
  },
  "extends": "airbnb-base",
  "globals": {
    "Atomics": "readonly",
    "SharedArrayBuffer": "readonly"
  },
  "parserOptions": {
    "ecmaVersion": 2018,
    "sourceType": "module"
  },
  "rules": {
    "semi": ["error", "never"]
  }
};

eslint-config-standard

Install

  1. List the correct versions of each package:
❯ npm info "eslint-config-standard" peerDependencies

{
  eslint: '>=6.2.2',
  'eslint-plugin-import': '>=2.18.0',
  'eslint-plugin-node': '>=9.1.0',
  'eslint-plugin-promise': '>=4.2.1',
  'eslint-plugin-standard': '>=4.0.0'
}
  1. Install the package:
❯ yarn add eslint eslint-plugin-import eslint-plugin-node eslint-plugin-promise eslint-plugin-standard eslint-config-standard -D

Usage

❯ npx eslint --init
// .eslintrc.js
module.exports = {
  "env": {
    "browser": true,
    "es6": true
  },
  "extends": "standard",
  "globals": {
    "Atomics": "readonly",
    "SharedArrayBuffer": "readonly"
  },
  "parserOptions": {
    "ecmaVersion": 2018,
    "sourceType": "module"
  },
  "rules": {
    "comma-dangle": ["error", "always-multiline"]
  }
};

see also: configuringrules

← Previous Post Next Post →

Ryun的博客
与其感慨路难行,不如马上出发。

atom css design git html javascript jekyll laravel life mac mobile optimization sublime tool vscode vue
mac

About

你好,❤朋友

这里是 Ryun 的博客 📝

📝记录了我学习 🔎的过程

作为一名前端攻城狮 🦁

希望能和大家一起 🔎

共同进步 🏃

🦁的特长:

  • HTML5
  • CSS3
  • JavaScript
  • Vue.js
  • 微信小程序
  • 熟练配合 Node.js、PHP 和 Laravel
  • 熟练使用各种开发和设计工具

🦁喜欢 🆒🆒的东西

对提升效率和美感的事物有兴趣 😋

欢迎 👏交流


see this hugo-theme-dream-ink