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

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin