From b56ebdbf4e17e0004eb8631286755e8cd00da445 Mon Sep 17 00:00:00 2001 From: Teppei Sato Date: Sat, 10 Aug 2019 00:26:39 +0900 Subject: [PATCH] [eslint] add type property to RuleMetaData (#37351) --- types/eslint/eslint-tests.ts | 6 ++++++ types/eslint/index.d.ts | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/types/eslint/eslint-tests.ts b/types/eslint/eslint-tests.ts index 26959d5c5e..f6347dc917 100644 --- a/types/eslint/eslint-tests.ts +++ b/types/eslint/eslint-tests.ts @@ -283,6 +283,12 @@ rule = { create(context) { return {}; }, meta: { fixable: 'whitespace' }}; rule = { create(context) { return {}; }, meta: { fixable: 'code' }}; rule = { create(context) { return {}; }, meta: { schema: [{ enum: ['always', 'never'] }] }}; rule = { create(context) { return {}; }, meta: { deprecated: true }}; +rule = { + create(context) { + return {}; + }, + meta: { type: 'layout' }, +}; rule = { create(context) { diff --git a/types/eslint/index.d.ts b/types/eslint/index.d.ts index 04367936e6..b3cbfbc8df 100644 --- a/types/eslint/index.d.ts +++ b/types/eslint/index.d.ts @@ -292,6 +292,7 @@ export namespace Rule { fixable?: 'code' | 'whitespace'; schema?: JSONSchema4 | JSONSchema4[]; deprecated?: boolean; + type?: 'problem' | 'suggestion' | 'layout'; } interface RuleContext { @@ -319,7 +320,9 @@ export namespace Rule { type ReportDescriptor = ReportDescriptorMessage & ReportDescriptorLocation & ReportDescriptorOptions; type ReportDescriptorMessage = { message: string } | { messageId: string }; - type ReportDescriptorLocation = { node: ESTree.Node } | { loc: AST.SourceLocation | { line: number, column: number } }; + type ReportDescriptorLocation = + | { node: ESTree.Node } + | { loc: AST.SourceLocation | { line: number; column: number } }; interface ReportDescriptorOptions { data?: { [key: string]: string };