Sandesh333333 / eslint-plugin-eslint-plugin

An ESLint plugin for linting ESLint plugins

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Add eslint-plugin to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "eslint-plugin"
    ]
}

Then configure the rules you want to use under the rules section.

{
    "rules": {
        "eslint-plugin/no-deprecated-report-api": "error"
    }
}

Rules

  • βœ”οΈ if the rule belongs to the recommended configuration
  • πŸ›  if some problems reported by the rule are automatically fixable by the --fix command line option
  • πŸ’‘ if some problems reported by the rule are manually fixable by editor suggestions
Name βœ”οΈ πŸ›  πŸ’‘ Description
consistent-output βœ”οΈ enforce consistent use of output assertions in rule tests
fixer-return βœ”οΈ require fixer functions to return a fix
meta-property-ordering πŸ›  enforce the order of meta properties
no-deprecated-context-methods βœ”οΈ πŸ›  disallow usage of deprecated methods on rule context objects
no-deprecated-report-api βœ”οΈ πŸ›  disallow the version of context.report() with multiple arguments
no-identical-tests βœ”οΈ πŸ›  disallow identical tests
no-missing-placeholders βœ”οΈ disallow missing placeholders in rule report messages
no-only-tests βœ”οΈ πŸ’‘ disallow the test case property only
no-unused-placeholders βœ”οΈ disallow unused placeholders in rule report messages
no-useless-token-range βœ”οΈ πŸ›  disallow unnecessary calls to sourceCode.getFirstToken() and sourceCode.getLastToken()
prefer-message-ids require using messageId instead of message to report rule violations
prefer-object-rule βœ”οΈ πŸ›  disallow rule exports where the export is a function
prefer-output-null πŸ›  disallow invalid RuleTester test cases where the output matches the code
prefer-placeholders require using placeholders for dynamic report messages
prefer-replace-text require using replaceText() instead of replaceTextRange()
report-message-format enforce a consistent format for rule report messages
require-meta-docs-description require rules to implement a meta.docs.description property with the correct format
require-meta-docs-url πŸ›  require rules to implement a meta.docs.url property
require-meta-fixable βœ”οΈ require rules to implement a meta.fixable property
require-meta-has-suggestions βœ”οΈ πŸ›  require suggestable rules to implement a meta.hasSuggestions property
require-meta-schema βœ”οΈ πŸ’‘ require rules to implement a meta.schema property
require-meta-type βœ”οΈ require rules to implement a meta.type property
test-case-property-ordering πŸ›  require the properties of a test case to be placed in a consistent order
test-case-shorthand-strings πŸ›  enforce consistent usage of shorthand strings for test cases with no options

Presets

Name Description
βœ”οΈ recommended enables all recommended rules in this plugin
rules-recommended enables all recommended rules that are aimed at linting ESLint rule files
tests-recommended enables all recommended rules that are aimed at linting ESLint test files
all enables all rules in this plugin
rules enables all rules that are aimed at linting ESLint rule files
tests enables 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

Presets are enabled by adding a line to the extends list in your config file. For example, to enable the recommended preset, use:

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

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

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

About

An ESLint plugin for linting ESLint plugins

License:MIT License


Languages

Language:JavaScript 100.0%Language:Shell 0.0%