4.2.2 • Published 20 days ago

eslint-plugin-local v4.2.2

Weekly downloads
26,167
License
MIT
Repository
github
Last release
20 days ago

This ESLint plugin allows you to implement a custom ESLint plugin including custom rules in your repository without installing them as a dependency.

Originally inspired by cletusw/eslint-plugin-local-rules.

Installation

npm install --save-dev eslint-plugin-local

Usage

The JavaScript file named .eslint-plugin-local.js or .eslint-plugin-local/index.js or use .cjs file extension must be created at the root of your repository, which the file has the content of an ESLint plugin. For example:

module.exports = {
  rules: {
    sample: {
      // Optional
      meta: {
        // See https://eslint.org/docs/latest/extend/custom-rules#rule-structure
      },

      // Mandatory
      create: function (context) {
        // Implementation goes here
        // See https://eslint.org/docs/latest/extend/custom-rules
      },

      // Optional
      // Unit test can be triggered by `eslint-plugin-local test` command
      // See https://eslint.org/docs/latest/integrate/nodejs-api#ruletester
      tests: {
        valid: [...],
        invalid: [...],
      }
    }
  }
}

Then apply the plugin to your .eslintrc file:

plugins:
  - local
rules:
  - local/sample: error

Additionally, this package provides eslint-plugin-local test command out of the box, which it scans for tests: { valid: [], invalid: [] } field in each rule and runs RuleTester internally.

4.2.2

20 days ago

4.2.1

3 months ago

4.2.0

3 months ago

4.1.0

3 months ago

4.1.1

3 months ago

4.0.0

3 months ago

3.2.1

3 months ago

3.1.3

3 months ago

3.1.2

3 months ago

3.2.0

3 months ago

3.1.6

3 months ago

3.1.5

3 months ago

3.1.4

3 months ago

3.1.1

3 months ago

3.1.0

4 months ago

3.0.1

4 months ago

3.0.0

4 months ago

2.0.0

4 months ago

1.0.0

7 years ago