Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Closed
Labels
Milestone
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 havesearched for related issues and found none that matched my issue.
- I haveread the FAQ and my problem is not listed.
Relevant Package
utils
Playground Link
Repro Code
import{ESLintUtils}from'@typescript-eslint/utils';exportconstrule=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
n/a
Expected Result
Custom rules in community plugins shouldn't be tied into our types for what goes into a rule'smeta.docs. Plugins might define their own, potentially different documentation metadata & strategies.
Maybe we should makemeta.docs type...Record<string, unknown> for consumers? Or a type parameter onRuleCreator that defaults toRecord<string, unknown>?
Actual Result
- Known properties have types set to ours: e.g.
meta.docs.recommendedisRuleRecommended | undefinedin 7.2.0- Afterfeat(eslint-plugin): add meta.docs.recommended setting for strict config options #8364 (7.3.0), it'll be
RuleRecommendation | RuleRecommendationAcrossConfigs<Options> | undefined
- Afterfeat(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 thatfeat(eslint-plugin): add meta.docs.recommended setting for strict config options #8364's expansion of the
meta.docs.recommendedproperty will be visible to users
Versions
| package | version |
|---|---|
@typescript-eslint/utils | 7.2.0 |
💖