eslint-plugin-hsl

自定义的一套 ESlint 规则,包括 Vue, React, TypeScript


Keywords
eslint, eslintconfig, config, prettier, airbnb, javascript, styleguide, es2015, es2016, es2017, es2018
License
MIT
Install
npm install eslint-plugin-hsl@1.0.4

Documentation

ESLint-plugin-Hsl

Maintenance Status NPM version Build Status Dependency Status Coverage Status Code Climate Tidelift

自定义的一套 ESlint 规则,包括 Vue, React,TypeScript,完善中...

🔨 Installation

Install ESLint either locally or globally. (Note that locally, per project, is strongly preferred)

$ npm install eslint --save-dev

If you installed ESLint globally, you have to install React plugin globally too. Otherwise, install it locally.

$ npm install eslint-plugin-hsl --save-dev

⚙️ Configuration

Configure in the Vue project:

  "extends": [
    "eslint:recommended",
    "plugin:hsl/vue"
  ]

Configure in the React project:

  "extends": [
    "eslint:recommended",
    "plugin:hsl/react"
  ]

Configure in the TypeScript project:

  "extends": [
    "eslint:recommended",
    "plugin:hsl/typescript"
  ]

If you do not use a preset you will need to specify individual rules and add extra configuration.

Add "hsl" to the plugins section.

{
  "plugins": [
    "hsl"
  ]
}

FAQ

What is the "Use the latest vue-eslint-parser" error?

The most rules of eslint-plugin-vue require vue-eslint-parser to check <template> ASTs.

Make sure you have one of the following settings in your .eslintrc:

  • "extends": ["plugin:vue/recommended"]
  • "extends": ["plugin:vue/base"]

If you already use other parser (e.g. "parser": "babel-eslint"), please move it into parserOptions, so it doesn't collide with the vue-eslint-parser used by this plugin's configuration:

- "parser": "babel-eslint",
  "parserOptions": {
+     "parser": "babel-eslint",
      "ecmaVersion": 2017,
      "sourceType": "module"
  }

🔑 License

ESLint-plugin-Hsl is licensed under the MIT License.