An ESLint plugin for linting ESLint plugins. Rules written in CJS, ESM, and TypeScript are all supported.
npm install @osjwnpm/nihil-recusandae-errorAn ESLint plugin for linting ESLint plugins. Rules written in CJS, ESM, and TypeScript are all supported.
- Installation
- Usage
- .eslintrc.json
- eslint.config.js (requires eslint\>=v8.23.0)
- Rules
- Rules
- Tests
- Presets
- Semantic versioning policy
- Preset usage
You'll first need to install ESLint:
``sh`
npm i eslint --save-dev
Next, install @osjwnpm/nihil-recusandae-error:
`sh`
npm install @osjwnpm/nihil-recusandae-error --save-dev
Here's an example ESLint configuration that:
- Sets sourceType to script for CJS plugins (most users) (use module for ESM/TypeScript)recommended
- Enables the configuration
- Enables an optional/non-recommended rule
`json`
{
"extends": ["plugin:eslint-plugin/recommended"],
"rules": {
"eslint-plugin/require-meta-docs-description": "error"
}
}
`js`
const eslintPlugin = require('@osjwnpm/nihil-recusandae-error');
module.exports = [
eslintPlugin.configs['flat/recommended'],
{
rules: {
'eslint-plugin/require-meta-docs-description': 'error',
},
},
];
💼 Configurations enabled in.\
✅ Set in the recommended configuration.\--fix
🔧 Automatically fixable by the CLI option.\
💡 Manually fixable by editor suggestions.\
💠Requires type information.
| Name                         | Description | 💼 | 🔧 | 💡 | 💠|
| :--------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------- | :-- | :-- | :-- | :-- |
| 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 | ✅ | 🔧 | | |messageId
| no-missing-message-ids | disallow s that are missing from meta.messages | ✅ | | | |in
| no-missing-placeholders | disallow missing placeholders in rule report messages | ✅ | | | |
| no-property-in-node | disallow using to narrow node types instead of looking at properties | | | | 💠|messageId
| no-unused-message-ids | disallow unused s in meta.messages | ✅ | | | |sourceCode.getFirstToken()
| no-unused-placeholders | disallow unused placeholders in rule report messages | ✅ | | | |
| no-useless-token-range | disallow unnecessary calls to and sourceCode.getLastToken() | ✅ | 🔧 | | |messageId
| prefer-message-ids | require using instead of message or desc to report rule violations | ✅ | | | |replaceText()
| prefer-object-rule | disallow function-style rules | ✅ | 🔧 | | |
| prefer-placeholders | require using placeholders for dynamic report messages | | | | |
| prefer-replace-text | require using instead of replaceTextRange() | | | | |meta.docs.description
| report-message-format | enforce a consistent format for rule report messages | | | | |
| require-meta-docs-description | require rules to implement a property with the correct format | | | | |meta.docs.url
| require-meta-docs-url | require rules to implement a property | | 🔧 | | |meta.fixable
| require-meta-fixable | require rules to implement a property | ✅ | | | |meta.hasSuggestions
| require-meta-has-suggestions | require suggestable rules to implement a property | ✅ | 🔧 | | |meta.schema
| require-meta-schema | require rules to implement a property | ✅ | | 💡 | |meta.type
| require-meta-type | require rules to implement a property | ✅ | | | |
| Name                       | Description | 💼 | 🔧 | 💡 | 💠|
| :----------------------------------------------------------------------- | :--------------------------------------------------------------------------- | :-- | :-- | :-- | :-- |
| consistent-output | enforce consistent use of output assertions in rule tests | | | | |only
| no-identical-tests | disallow identical tests | ✅ | 🔧 | | |
| no-only-tests | disallow the test case property | ✅ | | 💡 | |output
| prefer-output-null | disallow invalid RuleTester test cases where the matches the code | ✅ | 🔧 | | |
| 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 | | 🔧 | | |
| | 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, excluding those requiring type information |all-type-checked
| | | enables all rules in this plugin, including those requiring type information |rules
| | | enables all rules that are aimed at linting ESLint rule files |tests
| | | enables all rules that are aimed at linting ESLint test files |
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.
Both flat and eslintrc configs are supported. For example, to enable the recommended preset, use:
eslint.config.js
`js`
const eslintPlugin = require('@osjwnpm/nihil-recusandae-error');
module.exports = [eslintPlugin.configs['flat/recommended']];
.eslintrc.json
`json`
{
"extends": ["plugin:eslint-plugin/recommended"]
}
Or to apply linting only to the appropriate rule or test files:
eslint.config.js
`js`
const eslintPlugin = require('@osjwnpm/nihil-recusandae-error');
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
`json``
{
"overrides": [
{
"files": ["lib/rules/*.{js,ts}"],
"extends": ["plugin:eslint-plugin/rules-recommended"]
},
{
"files": ["tests/lib/rules/*.{js,ts}"],
"extends": ["plugin:eslint-plugin/tests-recommended"]
}
]
}