eslint-plugin-eslint-plugin
Advanced tools
Comparing version 6.3.2 to 6.4.0
@@ -35,2 +35,3 @@ /** | ||
], | ||
defaultOptions: ['consistent'], | ||
messages: { | ||
@@ -37,0 +38,0 @@ missingOutput: 'This test case should have an output assertion.', |
@@ -9,2 +9,14 @@ /** | ||
const defaultOrder = [ | ||
'type', | ||
'docs', | ||
'fixable', | ||
'hasSuggestions', | ||
'deprecated', | ||
'replacedBy', | ||
'schema', | ||
'defaultOptions', // https://github.com/eslint/rfcs/tree/main/designs/2023-rule-options-defaults | ||
'messages', | ||
]; | ||
// ------------------------------------------------------------------------------ | ||
@@ -32,2 +44,3 @@ // Rule Definition | ||
], | ||
defaultOptions: [defaultOrder], | ||
messages: { | ||
@@ -46,13 +59,3 @@ inconsistentOrder: | ||
const order = context.options[0] || [ | ||
'type', | ||
'docs', | ||
'fixable', | ||
'hasSuggestions', | ||
'deprecated', | ||
'replacedBy', | ||
'schema', | ||
'defaultOptions', // https://github.com/eslint/rfcs/tree/main/designs/2023-rule-options-defaults | ||
'messages', | ||
]; | ||
const order = context.options[0] || defaultOrder; | ||
@@ -59,0 +62,0 @@ const orderMap = new Map(order.map((name, i) => [name, i])); |
@@ -73,2 +73,3 @@ 'use strict'; | ||
], | ||
defaultOptions: [{ additionalNodeTypeFiles: [] }], | ||
messages: { | ||
@@ -75,0 +76,0 @@ in: 'Prefer checking specific node properties instead of a broad `in`.', |
@@ -32,2 +32,3 @@ /** | ||
], | ||
defaultOptions: [''], | ||
messages: { | ||
@@ -34,0 +35,0 @@ noMatch: "Report message does not match the pattern '{{pattern}}'.", |
@@ -38,2 +38,3 @@ 'use strict'; | ||
], | ||
defaultOptions: [{ pattern: '^(enforce|require|disallow)' }], | ||
messages: { | ||
@@ -40,0 +41,0 @@ extraWhitespace: |
@@ -6,2 +6,20 @@ 'use strict'; | ||
/** | ||
* @param {import('eslint').Rule.RuleFixer} fixer | ||
* @param {import('estree').ObjectExpression} objectNode | ||
* @param {boolean} recommendedValue | ||
*/ | ||
function insertRecommendedProperty(fixer, objectNode, recommendedValue) { | ||
if (objectNode.properties.length === 0) { | ||
return fixer.replaceText( | ||
objectNode, | ||
`{ recommended: ${recommendedValue} }`, | ||
); | ||
} | ||
return fixer.insertTextAfter( | ||
objectNode.properties.at(-1), | ||
`, recommended: ${recommendedValue}`, | ||
); | ||
} | ||
/** @type {import('eslint').Rule.RuleModule} */ | ||
@@ -19,2 +37,3 @@ module.exports = { | ||
fixable: null, | ||
hasSuggestions: true, | ||
schema: [ | ||
@@ -33,5 +52,8 @@ { | ||
], | ||
defaultOptions: [{ allowNonBoolean: false }], | ||
messages: { | ||
incorrect: '`meta.docs.recommended` is required to be a boolean.', | ||
missing: '`meta.docs.recommended` is required.', | ||
setRecommendedTrue: 'Set `meta.docs.recommended` to `true`.', | ||
setRecommendedFalse: 'Set `meta.docs.recommended` to `false`.', | ||
}, | ||
@@ -55,5 +77,22 @@ }, | ||
if (!descriptionNode) { | ||
const suggestions = | ||
docsNode?.value?.type === 'ObjectExpression' | ||
? [ | ||
{ | ||
messageId: 'setRecommendedTrue', | ||
fix: (fixer) => | ||
insertRecommendedProperty(fixer, docsNode.value, true), | ||
}, | ||
{ | ||
messageId: 'setRecommendedFalse', | ||
fix: (fixer) => | ||
insertRecommendedProperty(fixer, docsNode.value, false), | ||
}, | ||
] | ||
: []; | ||
context.report({ | ||
node: docsNode || metaNode || ruleInfo.create, | ||
messageId: 'missing', | ||
suggest: suggestions, | ||
}); | ||
@@ -75,2 +114,12 @@ return {}; | ||
messageId: 'incorrect', | ||
suggest: [ | ||
{ | ||
messageId: 'setRecommendedTrue', | ||
fix: (fixer) => fixer.replaceText(descriptionNode.value, 'true'), | ||
}, | ||
{ | ||
messageId: 'setRecommendedFalse', | ||
fix: (fixer) => fixer.replaceText(descriptionNode.value, 'false'), | ||
}, | ||
], | ||
}); | ||
@@ -77,0 +126,0 @@ return {}; |
@@ -43,2 +43,3 @@ /** | ||
], | ||
defaultOptions: [{}], | ||
messages: { | ||
@@ -45,0 +46,0 @@ mismatch: '`meta.docs.url` property must be `{{expectedUrl}}`.', |
@@ -39,2 +39,3 @@ /** | ||
], | ||
defaultOptions: [{ catchNoFixerButFixableProperty: false }], | ||
messages: { | ||
@@ -41,0 +42,0 @@ invalid: '`meta.fixable` must be either `code`, `whitespace`, or `null`.', |
@@ -34,2 +34,3 @@ 'use strict'; | ||
], | ||
defaultOptions: [{ requireSchemaPropertyWhenOptionless: true }], | ||
messages: { | ||
@@ -36,0 +37,0 @@ addEmptySchema: 'Add empty schema indicating the rule has no options.', |
@@ -10,2 +10,15 @@ /** | ||
const defaultOrder = [ | ||
'filename', | ||
'code', | ||
'output', | ||
'options', | ||
'parser', | ||
'languageOptions', // flat-mode only | ||
'parserOptions', // eslintrc-mode only | ||
'globals', // eslintrc-mode only | ||
'env', // eslintrc-mode only | ||
'errors', | ||
]; | ||
// ------------------------------------------------------------------------------ | ||
@@ -34,2 +47,3 @@ // Rule Definition | ||
], | ||
defaultOptions: [defaultOrder], | ||
messages: { | ||
@@ -45,14 +59,3 @@ inconsistentOrder: | ||
// ---------------------------------------------------------------------- | ||
const order = context.options[0] || [ | ||
'filename', | ||
'code', | ||
'output', | ||
'options', | ||
'parser', | ||
'languageOptions', // flat-mode only | ||
'parserOptions', // eslintrc-mode only | ||
'globals', // eslintrc-mode only | ||
'env', // eslintrc-mode only | ||
'errors', | ||
]; | ||
const order = context.options[0] || defaultOrder; | ||
const sourceCode = context.sourceCode || context.getSourceCode(); // TODO: just use context.sourceCode when dropping eslint < v9 | ||
@@ -74,3 +77,3 @@ | ||
if ( | ||
current > -1 && | ||
current !== -1 && | ||
(current < lastChecked || lastChecked === -1) | ||
@@ -77,0 +80,0 @@ ) { |
@@ -33,2 +33,3 @@ /** | ||
], | ||
defaultOptions: ['as-needed'], | ||
messages: { | ||
@@ -35,0 +36,0 @@ useShorthand: |
{ | ||
"name": "eslint-plugin-eslint-plugin", | ||
"version": "6.3.2", | ||
"version": "6.4.0", | ||
"description": "An ESLint plugin for linting ESLint plugins", | ||
@@ -22,3 +22,3 @@ "author": "Teddy Katz", | ||
"test": "nyc --all --check-coverage --include lib mocha tests --recursive", | ||
"test:remote": "eslint-remote-tester", | ||
"test:remote": "eslint-remote-tester -c ./eslint-remote-tester.config.mjs", | ||
"update:eslint-docs": "eslint-doc-generator" | ||
@@ -48,3 +48,3 @@ }, | ||
"nyc": { | ||
"branches": 94, | ||
"branches": 90, | ||
"functions": 99, | ||
@@ -55,37 +55,36 @@ "lines": 99, | ||
"devDependencies": { | ||
"@commitlint/cli": "^19.2.2", | ||
"@commitlint/config-conventional": "^19.2.2", | ||
"@commitlint/cli": "^19.6.0", | ||
"@commitlint/config-conventional": "^19.6.0", | ||
"@eslint-community/eslint-plugin-eslint-comments": "^4.3.0", | ||
"@eslint/eslintrc": "^3.0.2", | ||
"@eslint/js": "^9.0.0", | ||
"@release-it/conventional-changelog": "^8.0.1", | ||
"@types/eslint": "^8.56.9", | ||
"@eslint/js": "^9.16.0", | ||
"@release-it/conventional-changelog": "^9.0.3", | ||
"@types/eslint": "^9.6.1", | ||
"@types/estree": "^1.0.5", | ||
"@typescript-eslint/parser": "^7.7.0", | ||
"@typescript-eslint/utils": "^7.7.0", | ||
"chai": "^4.4.1", | ||
"dirty-chai": "^2.0.1", | ||
"eslint": "9.14.0", | ||
"chai": "^4.5.0", | ||
"eslint": "^9.16.0", | ||
"eslint-config-not-an-aardvark": "^2.1.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-doc-generator": "^1.7.0", | ||
"eslint-doc-generator": "^2.0.0", | ||
"eslint-plugin-eslint-plugin": "file:./", | ||
"eslint-plugin-markdown": "^5.0.0", | ||
"eslint-plugin-n": "^17.2.1", | ||
"eslint-plugin-n": "^17.14.0", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"eslint-plugin-unicorn": "^53.0.0", | ||
"eslint-remote-tester": "^3.0.1", | ||
"eslint-plugin-unicorn": "^56.0.1", | ||
"eslint-remote-tester": "^4.0.1", | ||
"eslint-scope": "^8.0.1", | ||
"espree": "^10.0.1", | ||
"globals": "^15.0.0", | ||
"husky": "^9.0.11", | ||
"globals": "^15.13.0", | ||
"husky": "^9.1.7", | ||
"lodash": "^4.17.21", | ||
"markdownlint-cli": "^0.41.0", | ||
"mocha": "^10.4.0", | ||
"npm-package-json-lint": "^7.1.0", | ||
"npm-run-all2": "^6.1.2", | ||
"nyc": "^15.1.0", | ||
"prettier": "^3.2.5", | ||
"markdownlint-cli": "^0.43.0", | ||
"mocha": "^11.0.0", | ||
"npm-package-json-lint": "^8.0.0", | ||
"npm-run-all2": "^7.0.1", | ||
"nyc": "^17.1.0", | ||
"prettier": "^3.4.1", | ||
"release-it": "^17.2.0", | ||
"typescript": "^5.4.3" | ||
"typescript": "^5.7.2" | ||
}, | ||
@@ -92,0 +91,0 @@ "peerDependencies": { |
@@ -89,2 +89,3 @@ # eslint-plugin-eslint-plugin ![CI](https://github.com/eslint-community/eslint-plugin-eslint-plugin/workflows/CI/badge.svg) [![NPM version](https://img.shields.io/npm/v/eslint-plugin-eslint-plugin.svg?style=flat)](https://npmjs.org/package/eslint-plugin-eslint-plugin) [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) <!-- omit from toc --> | ||
| [no-deprecated-report-api](docs/rules/no-deprecated-report-api.md) | disallow the version of `context.report()` with multiple arguments | ✅ | 🔧 | | | | ||
| [no-meta-schema-default](docs/rules/no-meta-schema-default.md) | disallow rules `meta.schema` properties to include defaults | | | | | | ||
| [no-missing-message-ids](docs/rules/no-missing-message-ids.md) | disallow `messageId`s that are missing from `meta.messages` | ✅ | | | | | ||
@@ -101,4 +102,5 @@ | [no-missing-placeholders](docs/rules/no-missing-placeholders.md) | disallow missing placeholders in rule report messages | ✅ | | | | | ||
| [report-message-format](docs/rules/report-message-format.md) | enforce a consistent format for rule report messages | | | | | | ||
| [require-meta-default-options](docs/rules/require-meta-default-options.md) | require only rules with options to implement a `meta.defaultOptions` property | | 🔧 | | | | ||
| [require-meta-docs-description](docs/rules/require-meta-docs-description.md) | require rules to implement a `meta.docs.description` property with the correct format | | | | | | ||
| [require-meta-docs-recommended](docs/rules/require-meta-docs-recommended.md) | require rules to implement a `meta.docs.recommended` property | | | | | | ||
| [require-meta-docs-recommended](docs/rules/require-meta-docs-recommended.md) | require rules to implement a `meta.docs.recommended` property | | | 💡 | | | ||
| [require-meta-docs-url](docs/rules/require-meta-docs-url.md) | require rules to implement a `meta.docs.url` property | | 🔧 | | | | ||
@@ -105,0 +107,0 @@ | [require-meta-fixable](docs/rules/require-meta-fixable.md) | require rules to implement a `meta.fixable` property | ✅ | | | | |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
171919
34
43
4281
193