]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Fix type linting and indent errors (#9843)
authorJukka Kurkela <jukka.kurkela@gmail.com>
Thu, 11 Nov 2021 20:00:52 +0000 (22:00 +0200)
committerGitHub <noreply@github.com>
Thu, 11 Nov 2021 20:00:52 +0000 (15:00 -0500)
* Fix type linting and indent errors
* Properly indent comments too

16 files changed:
types/.eslintrc.yml
types/adapters.d.ts
types/animation.d.ts
types/element.d.ts
types/helpers/helpers.canvas.d.ts
types/helpers/helpers.collection.d.ts
types/helpers/helpers.color.d.ts
types/helpers/helpers.core.d.ts
types/helpers/helpers.curve.d.ts
types/helpers/helpers.dom.d.ts
types/helpers/helpers.math.d.ts
types/helpers/helpers.options.d.ts
types/helpers/helpers.rtl.d.ts
types/index.esm.d.ts
types/layout.d.ts
types/utils.d.ts

index ea2c5e41787b3fe4478fcc0ece6533f7696c8e4e..14f736c75688e0f1ffb10a6cbcaf6673547bce63 100644 (file)
@@ -10,6 +10,8 @@ extends:
 rules:
   # Replace stock eslint rules with typescript-eslint equivalents for proper
   # TypeScript support.
+  indent: "off"
+  "@typescript-eslint/indent": ["error", 2]
   no-use-before-define: "off"
   '@typescript-eslint/no-use-before-define': "error"
   no-shadow: "off"
index 120598a1654e40912617b316d2683a8687d715c0..f06c41b6851c01dc70b1b6f621c9a784ecea3bc4 100644 (file)
@@ -1,63 +1,63 @@
 export type TimeUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
 
 export interface DateAdapter {
-       // Override one or multiple of the methods to adjust to the logic of the current date library.
-       override(members: Partial<DateAdapter>): void;
-       readonly options: unknown;
+  // Override one or multiple of the methods to adjust to the logic of the current date library.
+  override(members: Partial<DateAdapter>): void;
+  readonly options: unknown;
 
-       /**
-        * Returns a map of time formats for the supported formatting units defined
-        * in Unit as well as 'datetime' representing a detailed date/time string.
-        * @returns {{string: string}}
-        */
-       formats(): { [key: string]: string };
-       /**
-        * Parses the given `value` and return the associated timestamp.
-        * @param {unknown} value - the value to parse (usually comes from the data)
-        * @param {string} [format] - the expected data format
-        */
-       parse(value: unknown, format?: TimeUnit): number | null;
-       /**
-        * Returns the formatted date in the specified `format` for a given `timestamp`.
-        * @param {number} timestamp - the timestamp to format
-        * @param {string} format - the date/time token
-        * @return {string}
-        */
-       format(timestamp: number, format: TimeUnit): string;
-       /**
-        * Adds the specified `amount` of `unit` to the given `timestamp`.
-        * @param {number} timestamp - the input timestamp
-        * @param {number} amount - the amount to add
-        * @param {Unit} unit - the unit as string
-        * @return {number}
-        */
-       add(timestamp: number, amount: number, unit: TimeUnit): number;
-       /**
-        * Returns the number of `unit` between the given timestamps.
-        * @param {number} a - the input timestamp (reference)
-        * @param {number} b - the timestamp to subtract
-        * @param {Unit} unit - the unit as string
-        * @return {number}
-        */
-       diff(a: number, b: number, unit: TimeUnit): number;
-       /**
-        * Returns start of `unit` for the given `timestamp`.
-        * @param {number} timestamp - the input timestamp
-        * @param {Unit|'isoWeek'} unit - the unit as string
-        * @param {number} [weekday] - the ISO day of the week with 1 being Monday
-        * and 7 being Sunday (only needed if param *unit* is `isoWeek`).
-        * @return {number}
-        */
-       startOf(timestamp: number, unit: TimeUnit | 'isoWeek', weekday?: number): number;
-       /**
-        * Returns end of `unit` for the given `timestamp`.
-        * @param {number} timestamp - the input timestamp
-        * @param {Unit|'isoWeek'} unit - the unit as string
-        * @return {number}
-        */
-       endOf(timestamp: number, unit: TimeUnit | 'isoWeek'): number;
+  /**
+   * Returns a map of time formats for the supported formatting units defined
+   * in Unit as well as 'datetime' representing a detailed date/time string.
+   * @returns {{string: string}}
+   */
+  formats(): { [key: string]: string };
+  /**
+   * Parses the given `value` and return the associated timestamp.
+   * @param {unknown} value - the value to parse (usually comes from the data)
+   * @param {string} [format] - the expected data format
+   */
+  parse(value: unknown, format?: TimeUnit): number | null;
+  /**
+   * Returns the formatted date in the specified `format` for a given `timestamp`.
+   * @param {number} timestamp - the timestamp to format
+   * @param {string} format - the date/time token
+   * @return {string}
+   */
+  format(timestamp: number, format: TimeUnit): string;
+  /**
+   * Adds the specified `amount` of `unit` to the given `timestamp`.
+   * @param {number} timestamp - the input timestamp
+   * @param {number} amount - the amount to add
+   * @param {Unit} unit - the unit as string
+   * @return {number}
+   */
+  add(timestamp: number, amount: number, unit: TimeUnit): number;
+  /**
+   * Returns the number of `unit` between the given timestamps.
+   * @param {number} a - the input timestamp (reference)
+   * @param {number} b - the timestamp to subtract
+   * @param {Unit} unit - the unit as string
+   * @return {number}
+   */
+  diff(a: number, b: number, unit: TimeUnit): number;
+  /**
+   * Returns start of `unit` for the given `timestamp`.
+   * @param {number} timestamp - the input timestamp
+   * @param {Unit|'isoWeek'} unit - the unit as string
+   * @param {number} [weekday] - the ISO day of the week with 1 being Monday
+   * and 7 being Sunday (only needed if param *unit* is `isoWeek`).
+   * @return {number}
+   */
+  startOf(timestamp: number, unit: TimeUnit | 'isoWeek', weekday?: number): number;
+  /**
+   * Returns end of `unit` for the given `timestamp`.
+   * @param {number} timestamp - the input timestamp
+   * @param {Unit|'isoWeek'} unit - the unit as string
+   * @return {number}
+   */
+  endOf(timestamp: number, unit: TimeUnit | 'isoWeek'): number;
 }
 
 export const _adapters: {
-       _date: DateAdapter;
+  _date: DateAdapter;
 };
index 07d3bb37cafe52f8e865d9e83fbf23d2b4ae25ad..b83204124f86972541c0653536b6e1e7e9f1e9d7 100644 (file)
@@ -10,10 +10,10 @@ export class Animation {
 }
 
 export interface AnimationEvent {
-       chart: Chart;
-       numSteps: number;
-       initial: boolean;
-       currentStep: number;
+  chart: Chart;
+  numSteps: number;
+  initial: boolean;
+  currentStep: number;
 }
 
 export class Animator {
index 09e330182c444e58a9bfdde49d87bbeee9f52e6f..3b9359b3a1b6abf4d54ec7fbadd066c437de2f60 100644 (file)
@@ -2,16 +2,16 @@ import { AnyObject } from './basic';
 import { Point } from './geometric';
 
 export interface Element<T = AnyObject, O = AnyObject> {
-       readonly x: number;
-       readonly y: number;
-       readonly active: boolean;
-       readonly options: O;
+  readonly x: number;
+  readonly y: number;
+  readonly active: boolean;
+  readonly options: O;
 
-       tooltipPosition(useFinalPosition?: boolean): Point;
-       hasValue(): boolean;
-       getProps<P extends (keyof T)[]>(props: P, final?: boolean): Pick<T, P[number]>;
+  tooltipPosition(useFinalPosition?: boolean): Point;
+  hasValue(): boolean;
+  getProps<P extends (keyof T)[]>(props: P, final?: boolean): Pick<T, P[number]>;
 }
 export const Element: {
-       prototype: Element;
-       new <T = AnyObject, O = AnyObject>(): Element<T, O>;
+  prototype: Element;
+  new <T = AnyObject, O = AnyObject>(): Element<T, O>;
 };
index 4018f2e996f4de66153ffdd9ea3cab646d55ee20..44e570e653ee02883ff3cb6e6977ea4f5585a2d4 100644 (file)
@@ -10,10 +10,10 @@ export function clipArea(ctx: CanvasRenderingContext2D, area: ChartArea): void;
 export function unclipArea(ctx: CanvasRenderingContext2D): void;
 
 export interface DrawPointOptions {
-       pointStyle: PointStyle;
-       rotation?: number;
-       radius: number;
-       borderWidth: number;
+  pointStyle: PointStyle;
+  rotation?: number;
+  radius: number;
+  borderWidth: number;
 }
 
 export function drawPoint(ctx: CanvasRenderingContext2D, options: DrawPointOptions, x: number, y: number): void;
@@ -26,76 +26,76 @@ export function drawPoint(ctx: CanvasRenderingContext2D, options: DrawPointOptio
 export function toFontString(font: { size: number; family: string; style?: string; weight?: string }): string | null;
 
 export interface RenderTextOpts {
-       /**
-        * The fill color of the text. If unset, the existing
-        * fillStyle property of the canvas is unchanged.
-        */
-       color?: Color;
-
-       /**
-        * The width of the strikethrough / underline
-        * @default 2
-        */
-       decorationWidth?: number;
-
-       /**
-        * The max width of the text in pixels
-        */
-       maxWidth?: number;
-
-       /**
-        * A rotation to be applied to the canvas
-        * This is applied after the translation is applied
-        */
-       rotation?: number;
-
-       /**
-        * Apply a strikethrough effect to the text
-        */
-       strikethrough?: boolean;
-
-       /**
-        * The color of the text stroke. If unset, the existing
-        * strokeStyle property of the context is unchanged
-        */
-       strokeColor?: Color;
-
-       /**
-        * The text stroke width. If unset, the existing
-        * lineWidth property of the context is unchanged
-        */
-       strokeWidth?: number;
-
-       /**
-        * The text alignment to use. If unset, the existing
-        * textAlign property of the context is unchanged
-        */
-       textAlign: CanvasTextAlign;
-
-       /**
-        * The text baseline to use. If unset, the existing
-        * textBaseline property of the context is unchanged
-        */
-       textBaseline: CanvasTextBaseline;
-
-       /**
-        * If specified, a translation to apply to the context
-        */
-       translation?: [number, number];
-
-       /**
-        * Underline the text
-        */
-       underline?: boolean;
+  /**
+   * The fill color of the text. If unset, the existing
+   * fillStyle property of the canvas is unchanged.
+   */
+  color?: Color;
+
+  /**
+   * The width of the strikethrough / underline
+   * @default 2
+   */
+  decorationWidth?: number;
+
+  /**
+   * The max width of the text in pixels
+   */
+  maxWidth?: number;
+
+  /**
+   * A rotation to be applied to the canvas
+   * This is applied after the translation is applied
+   */
+  rotation?: number;
+
+  /**
+   * Apply a strikethrough effect to the text
+   */
+  strikethrough?: boolean;
+
+  /**
+   * The color of the text stroke. If unset, the existing
+   * strokeStyle property of the context is unchanged
+   */
+  strokeColor?: Color;
+
+  /**
+   * The text stroke width. If unset, the existing
+   * lineWidth property of the context is unchanged
+   */
+  strokeWidth?: number;
+
+  /**
+   * The text alignment to use. If unset, the existing
+   * textAlign property of the context is unchanged
+   */
+  textAlign: CanvasTextAlign;
+
+  /**
+   * The text baseline to use. If unset, the existing
+   * textBaseline property of the context is unchanged
+   */
+  textBaseline: CanvasTextBaseline;
+
+  /**
+   * If specified, a translation to apply to the context
+   */
+  translation?: [number, number];
+
+  /**
+   * Underline the text
+   */
+  underline?: boolean;
 }
 
 export function renderText(
-       ctx: CanvasRenderingContext2D,
-       text: string | string[],
-       x: number,
-       y: number,
-       font: CanvasFontSpec,
-       opts?: RenderTextOpts
+  ctx: CanvasRenderingContext2D,
+  text: string | string[],
+  x: number,
+  y: number,
+  font: CanvasFontSpec,
+  opts?: RenderTextOpts
 ): void;
 
 export function addRoundedRectPath(ctx: CanvasRenderingContext2D, rect: RoundedRect): void;
index a617a2b48a8ea4cfa5921ec1b0ae75196596f199..6a51597c953eb8a43c5117efd6ff9b6fa7e3a308 100644 (file)
@@ -1,9 +1,9 @@
 export interface ArrayListener<T> {
-       _onDataPush?(...item: T[]): void;
-       _onDataPop?(): void;
-       _onDataShift?(): void;
-       _onDataSplice?(index: number, deleteCount: number, ...items: T[]): void;
-       _onDataUnshift?(...item: T[]): void;
+  _onDataPush?(...item: T[]): void;
+  _onDataPop?(): void;
+  _onDataShift?(): void;
+  _onDataSplice?(index: number, deleteCount: number, ...items: T[]): void;
+  _onDataUnshift?(...item: T[]): void;
 }
 
 /**
index 1e8c118e1e5492d5f85b48980054a5c502c699f8..3cfc20ea77fa746869013741f3a75e6af62f5f4e 100644 (file)
@@ -1,31 +1,31 @@
 export function color(value: CanvasGradient): CanvasGradient;
 export function color(value: CanvasPattern): CanvasPattern;
 export function color(
-       value:
-               | string
-               | { r: number; g: number; b: number; a: number }
-               | [number, number, number]
-               | [number, number, number, number]
+  value:
+  | string
+  | { r: number; g: number; b: number; a: number }
+  | [number, number, number]
+  | [number, number, number, number]
 ): ColorModel;
 
 export interface ColorModel {
-       rgbString(): string;
-       hexString(): string;
-       hslString(): string;
-       rgb: { r: number; g: number; b: number; a: number };
-       valid: boolean;
-       mix(color: ColorModel, weight: number): this;
-       clone(): ColorModel;
-       alpha(a: number): ColorModel;
-       clearer(ration: number): ColorModel;
-       greyscale(): ColorModel;
-       opaquer(ratio: number): ColorModel;
-       negate(): ColorModel;
-       lighten(ratio: number): ColorModel;
-       darken(ratio: number): ColorModel;
-       saturate(ratio: number): ColorModel;
-       desaturate(ratio: number): ColorModel;
-       rotate(deg: number): this;
+  rgbString(): string;
+  hexString(): string;
+  hslString(): string;
+  rgb: { r: number; g: number; b: number; a: number };
+  valid: boolean;
+  mix(color: ColorModel, weight: number): this;
+  clone(): ColorModel;
+  alpha(a: number): ColorModel;
+  clearer(ration: number): ColorModel;
+  greyscale(): ColorModel;
+  opaquer(ratio: number): ColorModel;
+  negate(): ColorModel;
+  lighten(ratio: number): ColorModel;
+  darken(ratio: number): ColorModel;
+  saturate(ratio: number): ColorModel;
+  desaturate(ratio: number): ColorModel;
+  rotate(deg: number): this;
 }
 
 export function getHoverColor(value: CanvasGradient): CanvasGradient;
index a973b362c995fee488573f72ba3e88f16d7e6838..bc376da0274475d2759fd67cc2d2077d5ec3c1e5 100644 (file)
@@ -67,9 +67,9 @@ export function toDimension(value: number | string, dimension: number): number;
  * @returns {*}
  */
 export function callback<T extends (this: TA, ...args: unknown[]) => R, TA, R>(
-       fn: T | undefined,
-       args: unknown[],
-       thisArg?: TA
+  fn: T | undefined,
+  args: unknown[],
+  thisArg?: TA
 ): R | undefined;
 
 /**
@@ -82,10 +82,10 @@ export function callback<T extends (this: TA, ...args: unknown[]) => R, TA, R>(
  * @param [reverse] - If true, iterates backward on the loopable.
  */
 export function each<T, TA>(
-       loopable: T[],
-       fn: (this: TA, v: T, i: number) => void,
-       thisArg?: TA,
-       reverse?: boolean
+  loopable: T[],
+  fn: (this: TA, v: T, i: number) => void,
+  thisArg?: TA,
+  reverse?: boolean
 ): void;
 /**
  * Note(SB) for performance sake, this method should only be used when loopable type
@@ -97,10 +97,10 @@ export function each<T, TA>(
  * @param [reverse] - If true, iterates backward on the loopable.
  */
 export function each<T, TA>(
-       loopable: { [key: string]: T },
-       fn: (this: TA, v: T, k: string) => void,
-       thisArg?: TA,
-       reverse?: boolean
+  loopable: { [key: string]: T },
+  fn: (this: TA, v: T, k: string) => void,
+  thisArg?: TA,
+  reverse?: boolean
 ): void;
 
 /**
@@ -110,7 +110,7 @@ export function each<T, TA>(
 export function clone<T>(source: T): T;
 
 export interface MergeOptions {
-       merger?: (key: string, target: AnyObject, source: AnyObject, options: AnyObject) => AnyObject;
+  merger?: (key: string, target: AnyObject, source: AnyObject, options: AnyObject) => AnyObject;
 }
 /**
  * Recursively deep copies `source` properties into `target` with the given `options`.
@@ -127,9 +127,9 @@ export function merge<T, S1>(target: T, source: [S1], options?: MergeOptions): T
 export function merge<T, S1, S2>(target: T, source: [S1, S2], options?: MergeOptions): T & S1 & S2;
 export function merge<T, S1, S2, S3>(target: T, source: [S1, S2, S3], options?: MergeOptions): T & S1 & S2 & S3;
 export function merge<T, S1, S2, S3, S4>(
-       target: T,
-       source: [S1, S2, S3, S4],
-       options?: MergeOptions
+  target: T,
+  source: [S1, S2, S3, S4],
+  options?: MergeOptions
 ): T & S1 & S2 & S3 & S4;
 export function merge<T>(target: T, source: AnyObject[], options?: MergeOptions): AnyObject;
 
index d845e1579193f8526893a176ffcd7aa31898a7dc..28d9ee4a629cddf07be9aa4a90de2459832af01a 100644 (file)
@@ -1,6 +1,6 @@
 export interface SplinePoint {
-       x: number;
-       y: number;
+  x: number;
+  y: number;
 }
 
 /**
@@ -8,21 +8,21 @@ export interface SplinePoint {
  * http://scaledinnovation.com/analytics/splines/aboutSplines.html
  */
 export function splineCurve(
-       firstPoint: SplinePoint & { skip?: boolean },
-       middlePoint: SplinePoint,
-       afterPoint: SplinePoint,
-       t: number
+  firstPoint: SplinePoint & { skip?: boolean },
+  middlePoint: SplinePoint,
+  afterPoint: SplinePoint,
+  t: number
 ): {
-       previous: SplinePoint;
-       next: SplinePoint;
+  previous: SplinePoint;
+  next: SplinePoint;
 };
 
 export interface MonotoneSplinePoint extends SplinePoint {
-       skip: boolean;
-       cp1x?: number;
-       cp1y?: number;
-       cp2x?: number;
-       cp2y?: number;
+  skip: boolean;
+  cp1x?: number;
+  cp1y?: number;
+  cp2x?: number;
+  cp2y?: number;
 }
 
 /**
index a0f484a331aa7aeb5b41dd413b41a1973ee325da..738643140860418b17f810af52d2abf54fb4b892 100644 (file)
@@ -2,18 +2,18 @@ import { ChartEvent } from '../index.esm';
 
 export function getMaximumSize(node: HTMLElement, width?: number, height?: number, aspectRatio?: number): { width: number, height: number };
 export function getRelativePosition(
-       evt: MouseEvent | ChartEvent,
-       chart: { readonly canvas: HTMLCanvasElement }
+  evt: MouseEvent | ChartEvent,
+  chart: { readonly canvas: HTMLCanvasElement }
 ): { x: number; y: number };
 export function getStyle(el: HTMLElement, property: string): string;
 export function retinaScale(
-       chart: {
-               currentDevicePixelRatio: number;
-               readonly canvas: HTMLCanvasElement;
-               readonly width: number;
-               readonly height: number;
-               readonly ctx: CanvasRenderingContext2D;
-       },
+  chart: {
+    currentDevicePixelRatio: number;
+    readonly canvas: HTMLCanvasElement;
+    readonly width: number;
+    readonly height: number;
+    readonly ctx: CanvasRenderingContext2D;
+  },
   forceRatio: number,
   forceStyle?: boolean
 ): void;
index 3e0e9b8da0cae55a735ad8d7483495f2f14a6239..cc58b30e714cf8626def7c92f85a204cf641776b 100644 (file)
@@ -10,8 +10,8 @@ export function toDegrees(radians: number): number;
  * Gets the angle from vertical upright to the point about a centre.
  */
 export function getAngleFromPoint(
-       centrePoint: { x: number; y: number },
-       anglePoint: { x: number; y: number }
+  centrePoint: { x: number; y: number },
+  anglePoint: { x: number; y: number }
 ): { angle: number; distance: number };
 
 export function distanceBetweenPoints(pt1: { x: number; y: number }, pt2: { x: number; y: number }): number;
index a6ff051b5246b9d2087f4c895f71378e93345d6b..0bd783fa9703fe4337417ba3b20b1284353e9dd7 100644 (file)
@@ -2,7 +2,7 @@ import { TRBL, TRBLCorners } from '../geometric';
 import { FontSpec } from '../index.esm';
 
 export interface CanvasFontSpec extends FontSpec {
-       string: string;
+  string: string;
 }
 /**
  * Parses font options and returns the font object.
@@ -47,10 +47,10 @@ export function toPadding(
  * @since 2.7.0
  */
 export function resolve<T, C>(
-       inputs: undefined | T | ((c: C) => T) | readonly T[],
-       context?: C,
-       index?: number,
-       info?: { cacheable?: boolean }
+  inputs: undefined | T | ((c: C) => T) | readonly T[],
+  context?: C,
+  index?: number,
+  info?: { cacheable?: boolean }
 ): T | undefined;
 
 
index f366105bb34ba3e85e990ffa51f4427d7d38b725..ed0b9248fdae56baf45f30665c7e916489e5a363 100644 (file)
@@ -1,9 +1,9 @@
 export interface RTLAdapter {
-       x(x: number): number;
-       setWidth(w: number): void;
-       textAlign(align: 'center' | 'left' | 'right'): 'center' | 'left' | 'right';
-       xPlus(x: number, value: number): number;
-       leftForLtr(x: number, itemWidth: number): number;
+  x(x: number): number;
+  setWidth(w: number): void;
+  textAlign(align: 'center' | 'left' | 'right'): 'center' | 'left' | 'right';
+  xPlus(x: number, value: number): number;
+  leftForLtr(x: number, itemWidth: number): number;
 }
 export function getRtlAdapter(rtl: boolean, rectX: number, width: number): RTLAdapter;
 
index 550842f32970c8054f363f2547d47ab1a0a8ccf8..f1c37bdd32cb30abb99ee2904c10928e5655def7 100644 (file)
@@ -87,9 +87,9 @@ export interface ControllerDatasetOptions extends ParsingOptions {
 
 export interface BarControllerDatasetOptions
   extends ControllerDatasetOptions,
-    ScriptableAndArrayOptions<BarOptions, ScriptableContext<'bar'>>,
-    ScriptableAndArrayOptions<CommonHoverOptions, ScriptableContext<'bar'>>,
-    AnimationOptions<'bar'> {
+  ScriptableAndArrayOptions<BarOptions, ScriptableContext<'bar'>>,
+  ScriptableAndArrayOptions<CommonHoverOptions, ScriptableContext<'bar'>>,
+  AnimationOptions<'bar'> {
   /**
    * The ID of the x axis to plot this dataset on.
    */
@@ -147,8 +147,8 @@ export const BarController: ChartComponent & {
 
 export interface BubbleControllerDatasetOptions
   extends ControllerDatasetOptions,
-    ScriptableAndArrayOptions<PointOptions, ScriptableContext<'bubble'>>,
-    ScriptableAndArrayOptions<PointHoverOptions, ScriptableContext<'bubble'>> {}
+  ScriptableAndArrayOptions<PointOptions, ScriptableContext<'bubble'>>,
+  ScriptableAndArrayOptions<PointHoverOptions, ScriptableContext<'bubble'>> {}
 
 export interface BubbleDataPoint {
   /**
@@ -175,11 +175,11 @@ export const BubbleController: ChartComponent & {
 
 export interface LineControllerDatasetOptions
   extends ControllerDatasetOptions,
-    ScriptableAndArrayOptions<PointPrefixedOptions, ScriptableContext<'line'>>,
-    ScriptableAndArrayOptions<PointPrefixedHoverOptions, ScriptableContext<'line'>>,
-    ScriptableOptions<LineOptions, ScriptableContext<'line'>>,
-    ScriptableOptions<LineHoverOptions, ScriptableContext<'line'>>,
-    AnimationOptions<'line'> {
+  ScriptableAndArrayOptions<PointPrefixedOptions, ScriptableContext<'line'>>,
+  ScriptableAndArrayOptions<PointPrefixedHoverOptions, ScriptableContext<'line'>>,
+  ScriptableOptions<LineOptions, ScriptableContext<'line'>>,
+  ScriptableOptions<LineHoverOptions, ScriptableContext<'line'>>,
+  AnimationOptions<'line'> {
   /**
    * The ID of the x axis to plot this dataset on.
    */
@@ -234,9 +234,9 @@ export const ScatterController: ChartComponent & {
 
 export interface DoughnutControllerDatasetOptions
   extends ControllerDatasetOptions,
-    ScriptableAndArrayOptions<ArcOptions, ScriptableContext<'doughnut'>>,
-    ScriptableAndArrayOptions<ArcHoverOptions, ScriptableContext<'doughnut'>>,
-    AnimationOptions<'doughnut'> {
+  ScriptableAndArrayOptions<ArcOptions, ScriptableContext<'doughnut'>>,
+  ScriptableAndArrayOptions<ArcHoverOptions, ScriptableContext<'doughnut'>>,
+  AnimationOptions<'doughnut'> {
 
   /**
    * Sweep to allow arcs to cover.
@@ -377,10 +377,10 @@ export const PolarAreaController: ChartComponent & {
 
 export interface RadarControllerDatasetOptions
   extends ControllerDatasetOptions,
-    ScriptableAndArrayOptions<PointOptions & PointHoverOptions & PointPrefixedOptions & PointPrefixedHoverOptions, ScriptableContext<'radar'>>,
-    ScriptableAndArrayOptions<LineOptions & LineHoverOptions, ScriptableContext<'radar'>>,
-    AnimationOptions<'radar'> {
-        /**
+  ScriptableAndArrayOptions<PointOptions & PointHoverOptions & PointPrefixedOptions & PointPrefixedHoverOptions, ScriptableContext<'radar'>>,
+  ScriptableAndArrayOptions<LineOptions & LineHoverOptions, ScriptableContext<'radar'>>,
+  AnimationOptions<'radar'> {
+  /**
    * The ID of the x axis to plot this dataset on.
    */
   xAxisID: string;
@@ -449,7 +449,7 @@ export type ChartMeta<
   // When this was introduced, doing so was a breaking change
   TType extends ChartType = ChartType,
 > = DeepPartial<
-  { [key in ChartType]: ChartTypeRegistry[key]['metaExtensions'] }[TType]
+{ [key in ChartType]: ChartTypeRegistry[key]['metaExtensions'] }[TType]
 > & ChartMetaCommon<TElement, TDatasetElement>;
 
 export interface ActiveDataPoint {
@@ -465,7 +465,7 @@ export declare class Chart<
   TType extends ChartType = ChartType,
   TData = DefaultDataPoint<TType>,
   TLabel = unknown
-  > {
+> {
   readonly platform: BasePlatform;
   readonly id: string;
   readonly canvas: HTMLCanvasElement;
@@ -669,12 +669,12 @@ export interface Defaults extends CoreChartOptions<ChartType>, ElementChartOptio
 
 export type Overrides = {
   [key in ChartType]:
-    CoreChartOptions<key> &
-    ElementChartOptions<key> &
-    PluginChartOptions<key> &
-    DatasetChartOptions<ChartType> &
-    ScaleChartOptions<key> &
-    ChartTypeRegistry[key]['chartOptions'];
+  CoreChartOptions<key> &
+  ElementChartOptions<key> &
+  PluginChartOptions<key> &
+  DatasetChartOptions<ChartType> &
+  ScaleChartOptions<key> &
+  ChartTypeRegistry[key]['chartOptions'];
 }
 
 export const defaults: Defaults;
@@ -1341,18 +1341,18 @@ export interface TypedRegistry<T> {
 
 export interface ChartEvent {
   type:
-    | 'contextmenu'
-    | 'mouseenter'
-    | 'mousedown'
-    | 'mousemove'
-    | 'mouseup'
-    | 'mouseout'
-    | 'click'
-    | 'dblclick'
-    | 'keydown'
-    | 'keypress'
-    | 'keyup'
-    | 'resize';
+  | 'contextmenu'
+  | 'mouseenter'
+  | 'mousedown'
+  | 'mousemove'
+  | 'mouseup'
+  | 'mouseout'
+  | 'click'
+  | 'dblclick'
+  | 'keydown'
+  | 'keypress'
+  | 'keyup'
+  | 'resize';
   native: Event | null;
   x: number | null;
   y: number | null;
@@ -1694,7 +1694,7 @@ export interface ArcHoverOptions extends CommonHoverOptions {
 
 export interface ArcElement<T extends ArcProps = ArcProps, O extends ArcOptions = ArcOptions>
   extends Element<T, O>,
-    VisualElement {}
+  VisualElement {}
 
 export const ArcElement: ChartComponent & {
   prototype: ArcElement;
@@ -1771,7 +1771,7 @@ export interface LineHoverOptions extends CommonHoverOptions {
 
 export interface LineElement<T extends LineProps = LineProps, O extends LineOptions = LineOptions>
   extends Element<T, O>,
-    VisualElement {
+  VisualElement {
   updateControlPoints(chartArea: ChartArea, indexAxis?: 'x' | 'y'): void;
   points: Point[];
   readonly segments: Segment[];
@@ -1889,7 +1889,7 @@ export interface PointPrefixedHoverOptions {
 
 export interface PointElement<T extends PointProps = PointProps, O extends PointOptions = PointOptions>
   extends Element<T, O>,
-    VisualElement {
+  VisualElement {
   readonly skip: boolean;
   readonly parsed: CartesianParsedData;
 }
@@ -3472,12 +3472,12 @@ export type ScaleChartOptions<TType extends ChartType = ChartType> = {
 };
 
 export type ChartOptions<TType extends ChartType = ChartType> = DeepPartial<
-  CoreChartOptions<TType> &
-  ElementChartOptions<TType> &
-  PluginChartOptions<TType> &
-  DatasetChartOptions<TType> &
-  ScaleChartOptions<TType> &
-  ChartTypeRegistry[TType]['chartOptions']
+CoreChartOptions<TType> &
+ElementChartOptions<TType> &
+PluginChartOptions<TType> &
+DatasetChartOptions<TType> &
+ScaleChartOptions<TType> &
+ChartTypeRegistry[TType]['chartOptions']
 >;
 
 export type DefaultDataPoint<TType extends ChartType> = DistributiveArray<ChartTypeRegistry[TType]['defaultDataPoint']>;
@@ -3493,7 +3493,7 @@ export type ChartDataset<
   TType extends ChartType = ChartType,
   TData = DefaultDataPoint<TType>
 > = DeepPartial<
-  { [key in ChartType]: { type: key } & ChartTypeRegistry[key]['datasetOptions'] }[TType]
+{ [key in ChartType]: { type: key } & ChartTypeRegistry[key]['datasetOptions'] }[TType]
 > & ChartDatasetProperties<TType, TData>;
 
 export interface ChartData<
index 36f3237f3d8008711134ac5bf01b75bb55d48fb1..4c770711582b035b9fca0abec301ac9296ec3a2d 100644 (file)
@@ -3,63 +3,63 @@ import { ChartArea } from './geometric';
 export type LayoutPosition = 'left' | 'top' | 'right' | 'bottom' | 'center' | 'chartArea' | {[scaleId: string]: number};
 
 export interface LayoutItem {
-       /**
-        * The position of the item in the chart layout. Possible values are
-        */
-       position: LayoutPosition;
-       /**
-        * The weight used to sort the item. Higher weights are further away from the chart area
-        */
-       weight: number;
-       /**
-        * if true, and the item is horizontal, then push vertical boxes down
-        */
-       fullSize: boolean;
-       /**
-        * Width of item. Must be valid after update()
-        */
-       width: number;
-       /**
-        * Height of item. Must be valid after update()
-        */
-       height: number;
-       /**
-        * Left edge of the item. Set by layout system and cannot be used in update
-        */
-       left: number;
-       /**
-        * Top edge of the item. Set by layout system and cannot be used in update
-        */
-       top: number;
-       /**
-        * Right edge of the item. Set by layout system and cannot be used in update
-        */
-       right: number;
-       /**
-        * Bottom edge of the item. Set by layout system and cannot be used in update
-        */
-       bottom: number;
+  /**
+   * The position of the item in the chart layout. Possible values are
+   */
+  position: LayoutPosition;
+  /**
+   * The weight used to sort the item. Higher weights are further away from the chart area
+   */
+  weight: number;
+  /**
+   * if true, and the item is horizontal, then push vertical boxes down
+   */
+  fullSize: boolean;
+  /**
+   * Width of item. Must be valid after update()
+   */
+  width: number;
+  /**
+   * Height of item. Must be valid after update()
+   */
+  height: number;
+  /**
+   * Left edge of the item. Set by layout system and cannot be used in update
+   */
+  left: number;
+  /**
+   * Top edge of the item. Set by layout system and cannot be used in update
+   */
+  top: number;
+  /**
+   * Right edge of the item. Set by layout system and cannot be used in update
+   */
+  right: number;
+  /**
+   * Bottom edge of the item. Set by layout system and cannot be used in update
+   */
+  bottom: number;
 
-       /**
-        * Called before the layout process starts
-        */
-       beforeLayout?(): void;
-       /**
-        * Draws the element
-        */
-       draw(chartArea: ChartArea): void;
-       /**
-        * Returns an object with padding on the edges
-        */
-       getPadding?(): ChartArea;
-       /**
-        * returns true if the layout item is horizontal (ie. top or bottom)
-        */
-       isHorizontal(): boolean;
-       /**
-        * Takes two parameters: width and height.
-        * @param width
-        * @param height
-        */
-       update(width: number, height: number, margins?: ChartArea): void;
+  /**
+   * Called before the layout process starts
+   */
+  beforeLayout?(): void;
+  /**
+   * Draws the element
+   */
+  draw(chartArea: ChartArea): void;
+  /**
+   * Returns an object with padding on the edges
+   */
+  getPadding?(): ChartArea;
+  /**
+   * returns true if the layout item is horizontal (ie. top or bottom)
+   */
+  isHorizontal(): boolean;
+  /**
+   * Takes two parameters: width and height.
+   * @param width
+   * @param height
+   */
+  update(width: number, height: number, margins?: ChartArea): void;
 }
index 309c1608c6bf9d207f8948c9e2b743ba59d6eee0..8313d9fae9b50130289d19fc688cca5075c66728 100644 (file)
@@ -6,10 +6,10 @@
 export type DeepPartial<T> = T extends Function
   ? T
   : T extends Array<infer U>
-  ? _DeepPartialArray<U>
-  : T extends object
-  ? _DeepPartialObject<T>
-  : T | undefined;
+    ? _DeepPartialArray<U>
+    : T extends object
+      ? _DeepPartialObject<T>
+      : T | undefined;
 
 type _DeepPartialArray<T> = Array<DeepPartial<T>>
 type _DeepPartialObject<T> = { [P in keyof T]?: DeepPartial<T[P]> };