UNPKG

@sap/eslint-plugin-cds

Version:

ESLint plugin including recommended SAP Cloud Application Programming model and environment rules

47 lines (39 loc) 1.22 kB
import { Rule, RuleTester, SourceCode } from "eslint"; export interface CDSRuleContext extends Rule.RuleContext { cds: any; rootPath: string; code: string; filePath: string; options: []; id: string; sourcecode: SourceCode; getModel: Function; report: (descriptor: CDSRuleReport) => void; err: Error; } export interface Rule { meta: Rule.RuleMetaData, create: (context: CDSRuleContext) => void; } export interface CDSRuleMetaData extends Rule.RuleMetaData { model?: "parsed" | "inferred" | "none"; } export type CDSRuleReport = Rule.ReportDescriptor & { loc?: Rule.ReportDescriptorLocation; file?: string; }; export interface CDSTestCaseError extends RuleTester.TestCaseError { message: string | RegExp; } export interface CDSRuleTestOpts { /** specifies __dirname */ root: string; /** requires your rule .js here */ rule?: string; /** filename ('schema.cds' for model, 'package.json' for env) */ filename: string; /** resolves cds parser path */ parser?: string; /** list of errors from ESLint's [RuleTester](https://eslint.org/docs/developer-guide/nodejs-api#ruletester) */ errors: CDSTestCaseError[] }