eslint-plugin-attributes

1.1.8 • Public • Published

eslint-plugin-attributes

html标签属性数量过多时需换行

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-attributes:

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

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-attributes globally.

Usage

Add attributes to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "attributes"
    ]
}

Use default by extends option

{
    "extends": [
        "plugin:attributes/base"
    ]
}

Or configure the rules you want to use under the rules section.

{
    "rules": {
        "attributes/rule-name": 2
    }
}

Supported Rules

Rule Default Options Description
max-attributes 2 [2, { max: 3, attrStrLimit: 50 }] html标签属性数量过多时需换行,支持自动修复。若属性过少换行也会自动修复为一行。单个属性长度超出attrStrLimit时,即使属性较少也要换行。
max-attribute-value-logical 1 [1, { max: 2 }] 属性上逻辑操作符出现的次数限制

Package Sidebar

Install

npm i eslint-plugin-attributes

Weekly Downloads

1

Version

1.1.8

License

ISC

Unpacked Size

18.8 kB

Total Files

7

Last publish

Collaborators

  • xjm1122