Closed
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Relevant Package
utils
Playground Link
Repro Code
import { ESLintUtils } from '@typescript-eslint/utils';
export const rule = ESLintUtils.RuleCreator.withoutDocs({
create(context) {
return {
Identifier(node) {
context.report({ messageId: "example", node });
}
}
},
defaultOptions: [],
meta: {
docs: {
description: '',
recommended: 'recommended',
other: true,
},
messages: {
example: "Oh no!"
},
type: 'layout',
schema: []
},
});
ESLint Config
n/a
tsconfig
Expected Result
Custom rules in community plugins shouldn't be tied into our types for what goes into a rule's meta.docs
. Plugins might define their own, potentially different documentation metadata & strategies.
Maybe we should make meta.docs
type... Record<string, unknown>
for consumers? Or a type parameter on RuleCreator
that defaults to Record<string, unknown>
?
Actual Result
- Known properties have types set to ours: e.g.
meta.docs.recommended
isRuleRecommended | undefined
in 7.2.0- After feat(eslint-plugin): add meta.docs.recommended setting for strict config options #8364 (7.3.0), it'll be
RuleRecommendation | RuleRecommendationAcrossConfigs<Options> | undefined
- After feat(eslint-plugin): add meta.docs.recommended setting for strict config options #8364 (7.3.0), it'll be
- Unknown properties cause a type error: e.g.
meta.docs.other
Additional Info
See also:
- Change Request: Standardize documentation properties (e.g. allow configs to export description) eslint/eslint#17842: for a more general approach in ESLint core
- feat(eslint-plugin): add meta.docs.recommended setting for strict config options #8364 (comment): noting that feat(eslint-plugin): add meta.docs.recommended setting for strict config options #8364's expansion of the
meta.docs.recommended
property will be visible to users
Versions
package | version |
---|---|
@typescript-eslint/utils |
7.2.0 |
💖