1. eslint-plugin-local
This ESLint plugin allows you to implement a custom ESLint plugin including custom rules in your repository without installing them as a dependency.
eslint-plugin-local
Package: eslint-plugin-local
Created by: taskworld
Last modified: Fri, 19 Apr 2024 07:50:50 GMT
Version: 4.2.2
License: MIT
Downloads: 413,071
Repository: https://github.com/taskworld/eslint-plugin-local

Install

npm install eslint-plugin-local
yarn add eslint-plugin-local

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.

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code