Linter.lint

2 min read
Linter.lint(params: LintParams): Lint[];

Parameters

  • params * Linter configuration.

    • required
    • type: LintParams
interface LintParams {
  spec: AntVSpec;
  dataProps?: BasicDataPropertyForAdvice[];
  options?: LinterOptions;
}

Among above, spec, dataProps and options represent the input chart syntax, chart recommendation configuration items and Linter configuration items, respectively.

Linter parameters

  • AntVSpec Parameter configuration.

AntVSpec is the declarative grammar that supports various technology stacks of AntV. See AntVSpec API for detail configurations.

PropertiesDescriptionExamples
basisThe basic information.basis: { type: 'chart' }
dataThe data information.data: { type: 'json-array', values: [...] }
layerThe drawing information.{ [ encoding: { x: {...} , y:{...} }, mark: { type: 'line' } ] }
  • BasicDataPropertyForAdvice Parameter configuration, see Ruler for details..
interface BasicDataPropertyForAdvice {
  /** field name */
  readonly name?: string;
  /** LOM */
  readonly levelOfMeasurements?: LOM[];
  /** used for split column xy series */
  readonly rawData: any[];
  /** required types in analyzer FieldInfo */
  readonly recommendation: analyzer.FieldInfo['recommendation'];
  readonly type: analyzer.FieldInfo['type'];
  readonly distinct?: number;
  readonly count?: number;
  readonly sum?: number;
  readonly maximum?: any;
  readonly minimum?: any;
  readonly missing?: number;
  // for customized props
  [key: string]: any;
}
  • LinterOptions Parameter configuration.
PropertiesTypeDescriptionDefault
purposePurposeThe purpose of the analysis.None Optional
preferencesPreferencesChart preferences.None Optional
  • Purpose Parameter configuration.
type PURPOSE_OPTIONS = ["Comparison", "Trend", "Distribution", "Rank", "Proportion", 
  "Composition", "Relation", "Hierarchy", "Flow", "Spatial", "Anomaly", "Value"];
  • Preferences Parameter configuration.
interface Preferences {
  canvasLayout: 'landscape' | 'portrait';
}

Return value

Lint[]

  • Lint Parameter configuration.
PropertiesTypeDescriptionExamples
typestringRule type.hard / soft / design
idstringRule id.10
scorenumberThe score of the rule.1
fixanyThe solution based on this rule.
docsanyThe documentation for the rule.