Skip to content

Latest commit

 

History

History
 
 

eslint-plugin

Logo

An ESLint plugin which provides JavaScript rules of the ecoCode project.

👉 See ecoCode-linter README to have more information.

⚠️ This plugin is in a very early stage and need improvements. Any contribution will be appreciated.

🚀 Getting started

Installation

You'll need to install ESLint (v7 or newer) and this plugin:

# yarn
yarn add -D eslint @ecocode/eslint-plugin
# npm
npm install -D eslint @ecocode/eslint-plugin

Enable whole plugin

Add @ecocode recommended configuration to extends section of your .eslintrc:

{
  "extends": ["plugin:@ecocode/recommended"]
}

Enable only some rules

Add @ecocode to the plugins section of your .eslintrc, followed by rules configuration:

{
  "plugins": ["@ecocode"],
  "rules": {
    "@ecocode/no-multiple-access-dom-element": "error"
  }
}

🌿 Use with our SonarQube plugin

If you are already using ESLint results for your SonarQube analysis, there are no additional steps! Otherwise:

  • Use "-f json" option of ESLint to export results in a JSON format.
    example in a script: eslint . -f json -o report.json
  • Add the path of the generated report to SonarQube property "sonar.eslint.reportPaths".
    example in sonar-project.properties: sonar.eslint.reportPaths=report.json

Check SonarQube documentation to have more information about the integration.

🔨 Rules

⚠️ Configurations set to warn in.
✅ Set in the recommended configuration.

Name Description ⚠️
no-multiple-access-dom-element Disallow multiple access of same DOM element.

🛒 Distribution

You can follow changelog on GitHub Releases page.