2 min read
Class Linter(ruleCfg?: RuleConfig)
  • Linter: is the tool classes for providing chart optimization suggestions.

Linter provides lint() function for providing chart optimization suggestions.


  • ruleCfg * Chart rule Config

    • optional
    • Parameter type: RuleConfig object
  • RuleConfig Parameter configuration.
excludestring[]Specify to exclude rules in ruler.None Optional
includestring[]Specify to include rules, with lower priority than exclude.None Optional
customRecord<string, RuleModule>Customized rules.None Optional
optionsChartRuleConfigMapRule configuration.None Optional
  • RuleModule ruler Custom rules, see Ruler for details.
type RuleModule = ChartRuleModule | DesignRuleModule;

type ChartRuleModule = DefaultRuleModule & {
  type: 'HARD' | 'SOFT';
  validator: Validator;

type DesignRuleModule = DefaultRuleModule & {
  type: 'DESIGN';
  optimizer: Optimizer;
  • ChartRuleConfigMap ruler Rule configuration, see Ruler for details.
type ChartRuleConfigMap = Record<string, ChartRuleConfig>;

interface ChartRuleConfig {
  weight?: number;
  off?: boolean;



Get the Lint[] of chart optimization suggestions as detailed in Linter.lint.

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


interface LintParams {
  spec: AntVSpec;
  dataProps?: BasicDataPropertyForAdvice[];
  options?: LinterOptions;

Return value:

interface Lint {
  type: string;
  id: string;
  score: number;
  fix?: any;
  docs?: any;