Socket
Socket
Sign inDemoInstall

eslint-plugin-eslint-plugin

Package Overview
Dependencies
89
Maintainers
5
Versions
73
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    eslint-plugin-eslint-plugin

An ESLint plugin for linting ESLint plugins


Version published
Weekly downloads
202K
decreased by-4.81%
Maintainers
5
Install size
565 kB
Created
Weekly downloads
 

Changelog

Source

6.1.0 (2024-04-25)

Features

  • add require-meta-docs-recommended rule (#447) (2370b46)

Readme

Source

eslint-plugin-eslint-plugin CI NPM version Conventional Commits

An ESLint plugin for linting ESLint plugins. Rules written in CJS, ESM, and TypeScript are all supported.

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-eslint-plugin:

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

Usage

Here's an example ESLint configuration that:

  • Sets sourceType to script for CJS plugins (most users) (use module for ESM/TypeScript)
  • Enables the recommended configuration
  • Enables an optional/non-recommended rule

.eslintrc.json

{
  "extends": ["plugin:eslint-plugin/recommended"],
  "rules": {
    "eslint-plugin/require-meta-docs-description": "error"
  }
}

eslint.config.js (requires eslint>=v8.23.0)

const eslintPlugin = require('eslint-plugin-eslint-plugin');
module.exports = [
  eslintPlugin.configs['flat/recommended'],
  {
    rules: {
      'eslint-plugin/require-meta-docs-description': 'error',
    },
  },
];

Rules

💼 Configurations enabled in.
✅ Set in the recommended configuration.
🔧 Automatically fixable by the --fix CLI option.
💡 Manually fixable by editor suggestions.
💭 Requires type information.

Rules

Name                         Description💼🔧💡💭
fixer-returnrequire fixer functions to return a fix
meta-property-orderingenforce the order of meta properties🔧
no-deprecated-context-methodsdisallow usage of deprecated methods on rule context objects🔧
no-deprecated-report-apidisallow the version of context.report() with multiple arguments🔧
no-missing-message-idsdisallow messageIds that are missing from meta.messages
no-missing-placeholdersdisallow missing placeholders in rule report messages
no-property-in-nodedisallow using in to narrow node types instead of looking at properties💭
no-unused-message-idsdisallow unused messageIds in meta.messages
no-unused-placeholdersdisallow unused placeholders in rule report messages
no-useless-token-rangedisallow unnecessary calls to sourceCode.getFirstToken() and sourceCode.getLastToken()🔧
prefer-message-idsrequire using messageId instead of message or desc to report rule violations
prefer-object-ruledisallow function-style rules🔧
prefer-placeholdersrequire using placeholders for dynamic report messages
prefer-replace-textrequire using replaceText() instead of replaceTextRange()
report-message-formatenforce a consistent format for rule report messages
require-meta-docs-descriptionrequire rules to implement a meta.docs.description property with the correct format
require-meta-docs-recommendedrequire rules to implement a meta.docs.recommended property
require-meta-docs-urlrequire rules to implement a meta.docs.url property🔧
require-meta-fixablerequire rules to implement a meta.fixable property
require-meta-has-suggestionsrequire suggestable rules to implement a meta.hasSuggestions property🔧
require-meta-schemarequire rules to implement a meta.schema property💡
require-meta-typerequire rules to implement a meta.type property

Tests

Name                       Description💼🔧💡💭
consistent-outputenforce consistent use of output assertions in rule tests
no-identical-testsdisallow identical tests🔧
no-only-testsdisallow the test case property only💡
prefer-output-nulldisallow invalid RuleTester test cases where the output matches the code🔧
test-case-property-orderingrequire the properties of a test case to be placed in a consistent order🔧
test-case-shorthand-stringsenforce consistent usage of shorthand strings for test cases with no options🔧

Presets

NameDescription
recommendedenables all recommended rules in this plugin
rules-recommendedenables all recommended rules that are aimed at linting ESLint rule files
tests-recommendedenables all recommended rules that are aimed at linting ESLint test files
allenables all rules in this plugin, excluding those requiring type information
all-type-checkedenables all rules in this plugin, including those requiring type information
rulesenables all rules that are aimed at linting ESLint rule files
testsenables all rules that are aimed at linting ESLint test files

Semantic versioning policy

The list of recommended rules will only change in a major release of this plugin. However, new non-recommended rules might be added in a minor release of this plugin. Therefore, using the all, rules, and tests presets is not recommended for production use, because the addition of new rules in a minor release could break your build.

Preset usage

Both flat and eslintrc configs are supported. For example, to enable the recommended preset, use:

eslint.config.js

const eslintPlugin = require('eslint-plugin-eslint-plugin');
module.exports = [eslintPlugin.configs['flat/recommended']];

.eslintrc.json

{
  "extends": ["plugin:eslint-plugin/recommended"]
}

Or to apply linting only to the appropriate rule or test files:

eslint.config.js

const eslintPlugin = require('eslint-plugin-eslint-plugin');
module.exports = [
  {
    files: ['lib/rules/*.{js,ts}'],
    ...eslintPlugin.configs['flat/rules-recommended'],
  },
  {
    files: ['tests/lib/rules/*.{js,ts}'],
    ...eslintPlugin.configs['flat/tests-recommended'],
  },
];

.eslintrc.js

{
  "overrides": [
    {
      "files": ["lib/rules/*.{js,ts}"],
      "extends": ["plugin:eslint-plugin/rules-recommended"]
    },
    {
      "files": ["tests/lib/rules/*.{js,ts}"],
      "extends": ["plugin:eslint-plugin/tests-recommended"]
    }
  ]
}

Keywords

FAQs

Last updated on 25 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc