0.0.3 • Published 9 months ago

@swanide/eslint-plugin-swan v0.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

@swanide/eslint-plugin-swan

eslint plugin for swan program.

support codes:

  • swan Baidu smart program tpl language
  • sjs JavasSript code

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install @swanide/eslint-plugin-swan:

$ npm install @swanide/eslint-plugin-swan --save-dev

Bin

Install @swanide/eslint-plugin-swan global.

$ npm install eslint @swanide/eslint-plugin-swan -g

Use swan-lint to lint mini program project.

$ swan-lint .

Use different lint level.

$ SWAN_LINT_CONFIG=[base|recommended|strict] swan-lint .
  • base basic lint rules, must be fixed
  • recommended recommended lint rules
  • strict strict lint rules

Usage

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

{
    "plugins": [
        "@swanide/swan"
    ]
}

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

{
    "rules": {
        "@swanide/swan/valid-bind": 2
    }
}

Supported Rules