From 13e5790174dddff6a6fe1e637866cc6df9e7228d Mon Sep 17 00:00:00 2001 From: dangreen Date: Fri, 16 Dec 2022 14:42:50 +0400 Subject: [PATCH] fix: move types to src dir to escape src / dist dirs in paths --- .github/workflows/ci.yml | 3 +- .gitignore | 2 +- docs/.vuepress/config.ts | 2 +- package.json | 8 ++-- src/core/core.adapters.ts | 4 +- src/core/core.controller.js | 8 ++-- src/core/core.element.ts | 6 +-- src/core/core.interaction.js | 4 +- src/core/core.plugins.js | 2 +- src/elements/element.arc.ts | 2 +- src/elements/element.point.ts | 2 +- src/helpers/helpers.canvas.js | 2 +- src/helpers/helpers.core.ts | 4 +- src/helpers/helpers.curve.ts | 2 +- src/helpers/helpers.dom.ts | 2 +- src/helpers/helpers.extras.ts | 2 +- src/helpers/helpers.interpolation.ts | 2 +- src/helpers/helpers.math.ts | 2 +- src/helpers/helpers.options.ts | 4 +- src/helpers/types.ts | 2 +- src/plugins/plugin.filler/filler.options.js | 4 +- src/plugins/plugin.legend.js | 2 +- src/plugins/plugin.tooltip.js | 4 +- src/types.ts | 4 +- {types => src/types}/animation.d.ts | 4 +- {types => src/types}/basic.d.ts | 0 {types => src/types}/color.d.ts | 0 {types => src/types}/geometric.d.ts | 0 .../types}/helpers/helpers.canvas.d.ts | 8 ++-- .../types}/helpers/helpers.segment.d.ts | 0 {types => src/types}/helpers/index.d.ts | 0 {types => src/types}/index.d.ts | 45 ++++++++++--------- {types => src/types}/layout.d.ts | 2 +- {types => src/types}/utils.d.ts | 0 {types => test/types}/.eslintrc.yml | 3 +- {types/tests => test/types}/animation.ts | 0 {types/tests => test/types}/autogen.js | 0 {types/tests => test/types}/chart_types.ts | 0 {types/tests => test/types}/config_types.ts | 0 .../types}/controllers/bar_floating_data.ts | 0 .../controllers/bubble_chart_options.ts | 0 .../types}/controllers/doughnut_meta_total.ts | 0 .../types}/controllers/doughnut_offset.ts | 0 .../controllers/doughnut_outer_radius.ts | 0 .../line_scriptable_parsed_data.ts | 0 .../types}/controllers/line_segments.ts | 0 .../types}/controllers/line_span_gaps.ts | 0 .../types}/controllers/line_styling_array.ts | 0 .../radar_dataset_indexable_options.ts | 0 {types/tests => test/types}/data_types.ts | 0 .../tests => test/types}/dataset_null_data.ts | 0 {types/tests => test/types}/date_adapter.ts | 0 {types/tests => test/types}/defaults.ts | 0 .../elements/scriptable_element_options.ts | 0 .../tests => test/types}/extensions/plugin.ts | 0 .../tests => test/types}/extensions/scale.ts | 4 +- .../tests => test/types}/helpers/options.ts | 0 {types/tests => test/types}/interaction.ts | 0 .../tests => test/types}/layout/position.ts | 0 {types/tests => test/types}/options.ts | 0 {types/tests => test/types}/overrides.ts | 0 .../tests => test/types}/parsed.data.type.ts | 0 .../tests => test/types}/plugins/defaults.ts | 0 .../plugin.decimation/decimation_algorithm.ts | 0 .../plugins/plugin.filler/fill_target_true.ts | 0 .../plugins/plugin.tooltip/chart.tooltip.ts | 0 .../plugin.tooltip/tooltip_dataset_type.ts | 0 .../plugin.tooltip/tooltip_parsed_data.ts | 0 .../tooltip_parsed_data_chart_defaults.ts | 0 .../tooltip_scriptable_background_color.ts | 0 {types/tests => test/types}/register.ts | 0 .../types}/scales/chart_options.ts | 0 {types/tests => test/types}/scales/options.ts | 0 .../types}/scales/time_string_max.ts | 0 {types/tests => test/types}/scriptable.ts | 0 .../types}/scriptable_core_chart_options.ts | 0 .../types}/test_instance_assignment.ts | 0 {types/tests => test/types}/tsconfig.json | 2 +- tsconfig.json | 6 +-- types/tests/.eslintrc.yml | 2 - 80 files changed, 74 insertions(+), 81 deletions(-) rename {types => src/types}/animation.d.ts (92%) rename {types => src/types}/basic.d.ts (100%) rename {types => src/types}/color.d.ts (100%) rename {types => src/types}/geometric.d.ts (100%) rename {types => src/types}/helpers/helpers.canvas.d.ts (92%) rename {types => src/types}/helpers/helpers.segment.d.ts (100%) rename {types => src/types}/helpers/index.d.ts (100%) rename {types => src/types}/index.d.ts (98%) rename {types => src/types}/layout.d.ts (97%) rename {types => src/types}/utils.d.ts (100%) rename {types => test/types}/.eslintrc.yml (62%) rename {types/tests => test/types}/animation.ts (100%) rename {types/tests => test/types}/autogen.js (100%) rename {types/tests => test/types}/chart_types.ts (100%) rename {types/tests => test/types}/config_types.ts (100%) rename {types/tests => test/types}/controllers/bar_floating_data.ts (100%) rename {types/tests => test/types}/controllers/bubble_chart_options.ts (100%) rename {types/tests => test/types}/controllers/doughnut_meta_total.ts (100%) rename {types/tests => test/types}/controllers/doughnut_offset.ts (100%) rename {types/tests => test/types}/controllers/doughnut_outer_radius.ts (100%) rename {types/tests => test/types}/controllers/line_scriptable_parsed_data.ts (100%) rename {types/tests => test/types}/controllers/line_segments.ts (100%) rename {types/tests => test/types}/controllers/line_span_gaps.ts (100%) rename {types/tests => test/types}/controllers/line_styling_array.ts (100%) rename {types/tests => test/types}/controllers/radar_dataset_indexable_options.ts (100%) rename {types/tests => test/types}/data_types.ts (100%) rename {types/tests => test/types}/dataset_null_data.ts (100%) rename {types/tests => test/types}/date_adapter.ts (100%) rename {types/tests => test/types}/defaults.ts (100%) rename {types/tests => test/types}/elements/scriptable_element_options.ts (100%) rename {types/tests => test/types}/extensions/plugin.ts (100%) rename {types/tests => test/types}/extensions/scale.ts (87%) rename {types/tests => test/types}/helpers/options.ts (100%) rename {types/tests => test/types}/interaction.ts (100%) rename {types/tests => test/types}/layout/position.ts (100%) rename {types/tests => test/types}/options.ts (100%) rename {types/tests => test/types}/overrides.ts (100%) rename {types/tests => test/types}/parsed.data.type.ts (100%) rename {types/tests => test/types}/plugins/defaults.ts (100%) rename {types/tests => test/types}/plugins/plugin.decimation/decimation_algorithm.ts (100%) rename {types/tests => test/types}/plugins/plugin.filler/fill_target_true.ts (100%) rename {types/tests => test/types}/plugins/plugin.tooltip/chart.tooltip.ts (100%) rename {types/tests => test/types}/plugins/plugin.tooltip/tooltip_dataset_type.ts (100%) rename {types/tests => test/types}/plugins/plugin.tooltip/tooltip_parsed_data.ts (100%) rename {types/tests => test/types}/plugins/plugin.tooltip/tooltip_parsed_data_chart_defaults.ts (100%) rename {types/tests => test/types}/plugins/plugin.tooltip/tooltip_scriptable_background_color.ts (100%) rename {types/tests => test/types}/register.ts (100%) rename {types/tests => test/types}/scales/chart_options.ts (100%) rename {types/tests => test/types}/scales/options.ts (100%) rename {types/tests => test/types}/scales/time_string_max.ts (100%) rename {types/tests => test/types}/scriptable.ts (100%) rename {types/tests => test/types}/scriptable_core_chart_options.ts (100%) rename {types/tests => test/types}/test_instance_assignment.ts (100%) rename {types/tests => test/types}/tsconfig.json (95%) delete mode 100644 types/tests/.eslintrc.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bbaac56b333..075c93c8db2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,7 +52,6 @@ jobs: - 'karma.conf.js' - 'package.json' types: - - 'types/**' - 'package.json' - 'tsconfig.json' - name: Install @@ -64,7 +63,7 @@ jobs: - name: Test if: | (steps.changes.outputs.src == 'true' || - steps.changes.outputs.test == 'true') && + steps.changes.outputs.test == 'true') && runner.os != 'Windows' run: | pnpm run build diff --git a/.gitignore b/.gitignore index bf69bd2c6b4..c731872efa5 100644 --- a/.gitignore +++ b/.gitignore @@ -31,7 +31,7 @@ docs/.vuepress/dist *.stackdump # Generated -/types/tests/autogen*.ts +/test/types/autogen*.ts # Eslint .eslintcache diff --git a/docs/.vuepress/config.ts b/docs/.vuepress/config.ts index cb8577c95e9..d1f7591fbfc 100644 --- a/docs/.vuepress/config.ts +++ b/docs/.vuepress/config.ts @@ -34,7 +34,7 @@ export default defineConfig({ }], ['vuepress-plugin-code-copy', true], ['vuepress-plugin-typedoc', { - entryPoints: ['../../types/index.d.ts'], + entryPoints: ['../../src/types/index.d.ts'], hideInPageTOC: true, tsconfig: path.resolve(__dirname, '../../tsconfig.json'), }, diff --git a/package.json b/package.json index cac1fb077aa..2f13e5a8ef6 100644 --- a/package.json +++ b/package.json @@ -49,13 +49,11 @@ "auto/**", "dist/**", "!dist/docs/**", - "helpers/**", - "types/**/*.ts", - "!types/tests/**" + "helpers/**" ], "scripts": { "autobuild": "rollup -c -w", - "emitDeclarations": "tsc --emitDeclarationOnly", + "emitDeclarations": "tsc --emitDeclarationOnly && cp -R ./src/types/ ./dist/types/", "build": "rollup -c && pnpm emitDeclarations", "dev": "karma start ./karma.conf.cjs --auto-watch --no-single-run --browsers chrome --grep", "dev:ff": "karma start ./karma.conf.cjs --auto-watch --no-single-run --browsers firefox --grep", @@ -63,7 +61,7 @@ "docs:dev": "pnpm run build && pnpm --filter \"./docs/**\" dev", "lint-js": "eslint \"src/**/*.{js,ts}\" \"test/**/*.js\" \"docs/**/*.js\" --cache", "lint-md": "eslint \"**/*.md\" --cache", - "lint-types": "eslint \"types/**/*.ts\" --cache && pnpm build && node types/tests/autogen.js && tsc -p types/tests/", + "lint-types": "pnpm build && node test/types/autogen.js && tsc -p test/types", "lint": "concurrently \"pnpm:lint-*\"", "test-size": "size-limit", "test": "pnpm lint && pnpm test-ci", diff --git a/src/core/core.adapters.ts b/src/core/core.adapters.ts index 56899ae1322..6c9b2b03248 100644 --- a/src/core/core.adapters.ts +++ b/src/core/core.adapters.ts @@ -4,8 +4,8 @@ * @private */ -import type {AnyObject} from '../../types/basic.js'; -import type {ChartOptions} from '../../types/index.js'; +import type {AnyObject} from '../types/basic.js'; +import type {ChartOptions} from '../types/index.js'; export type TimeUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year'; diff --git a/src/core/core.controller.js b/src/core/core.controller.js index 007ea6f65d8..2ba26c9f3ee 100644 --- a/src/core/core.controller.js +++ b/src/core/core.controller.js @@ -14,8 +14,8 @@ import {version} from '../../package.json'; import {debounce} from '../helpers/helpers.extras.js'; /** - * @typedef { import('../../types/index.js').ChartEvent } ChartEvent - * @typedef { import('../../types/index.js').Point } Point + * @typedef { import('../types/index.js').ChartEvent } ChartEvent + * @typedef { import('../types/index.js').Point } Point */ const KNOWN_POSITIONS = ['top', 'bottom', 'left', 'right', 'chartArea']; @@ -1258,10 +1258,10 @@ class Chart { /** * @param {ChartEvent} e - The event - * @param {import('../../types/index.js').ActiveElement[]} lastActive - Previously active elements + * @param {import('../types/index.js').ActiveElement[]} lastActive - Previously active elements * @param {boolean} inChartArea - Is the envent inside chartArea * @param {boolean} useFinalPosition - Should the evaluation be done with current or final (after animation) element positions - * @returns {import('../../types/index.js').ActiveElement[]} - The active elements + * @returns {import('../types/index.js').ActiveElement[]} - The active elements * @pravate */ _getActiveElements(e, lastActive, inChartArea, useFinalPosition) { diff --git a/src/core/core.element.ts b/src/core/core.element.ts index 20f72e95a76..9c1e76172c9 100644 --- a/src/core/core.element.ts +++ b/src/core/core.element.ts @@ -1,6 +1,6 @@ -import type {AnyObject} from '../../types/basic.js'; -import type {Point} from '../../types/geometric.js'; -import type {Animation} from '../../types/animation.js'; +import type {AnyObject} from '../types/basic.js'; +import type {Point} from '../types/geometric.js'; +import type {Animation} from '../types/animation.js'; import {isNumber} from '../helpers/helpers.math.js'; export default class Element { diff --git a/src/core/core.interaction.js b/src/core/core.interaction.js index 9f9046b4920..fc5aac83d38 100644 --- a/src/core/core.interaction.js +++ b/src/core/core.interaction.js @@ -5,10 +5,10 @@ import {_isPointInArea} from '../helpers/index.js'; /** * @typedef { import('./core.controller.js').default } Chart - * @typedef { import('../../types/index.js').ChartEvent } ChartEvent + * @typedef { import('../types/index.js').ChartEvent } ChartEvent * @typedef {{axis?: string, intersect?: boolean, includeInvisible?: boolean}} InteractionOptions * @typedef {{datasetIndex: number, index: number, element: import('./core.element.js').default}} InteractionItem - * @typedef { import('../../types/index.js').Point } Point + * @typedef { import('../types/index.js').Point } Point */ /** diff --git a/src/core/core.plugins.js b/src/core/core.plugins.js index b2584955a0f..6de82758944 100644 --- a/src/core/core.plugins.js +++ b/src/core/core.plugins.js @@ -3,7 +3,7 @@ import {callback as callCallback, isNullOrUndef, valueOrDefault} from '../helper /** * @typedef { import('./core.controller.js').default } Chart - * @typedef { import('../../types/index.js').ChartEvent } ChartEvent + * @typedef { import('../types/index.js').ChartEvent } ChartEvent * @typedef { import('../plugins/plugin.tooltip.js').default } Tooltip */ diff --git a/src/elements/element.arc.ts b/src/elements/element.arc.ts index 5a1dc18451f..f99e2dbc05a 100644 --- a/src/elements/element.arc.ts +++ b/src/elements/element.arc.ts @@ -2,7 +2,7 @@ import Element from '../core/core.element.js'; import {_angleBetween, getAngleFromPoint, TAU, HALF_PI, valueOrDefault} from '../helpers/index.js'; import {PI, _isBetween, _limitValue} from '../helpers/helpers.math.js'; import {_readValueToProps} from '../helpers/helpers.options.js'; -import type {ArcOptions, Point} from '../../types/index.js'; +import type {ArcOptions, Point} from '../types/index.js'; function clipArc(ctx: CanvasRenderingContext2D, element: ArcElement, endAngle: number) { diff --git a/src/elements/element.point.ts b/src/elements/element.point.ts index 4b7b26d8a2b..dbe6b131ef4 100644 --- a/src/elements/element.point.ts +++ b/src/elements/element.point.ts @@ -6,7 +6,7 @@ import type { Point, PointHoverOptions, PointOptions, -} from '../../types/index.js'; +} from '../types/index.js'; function inRange(el: PointElement, pos: number, axis: 'x' | 'y', useFinalPosition?: boolean) { const options = el.options; diff --git a/src/helpers/helpers.canvas.js b/src/helpers/helpers.canvas.js index ce3bf2c1f06..217c3f1edce 100644 --- a/src/helpers/helpers.canvas.js +++ b/src/helpers/helpers.canvas.js @@ -6,7 +6,7 @@ import {PI, TAU, HALF_PI, QUARTER_PI, TWO_THIRDS_PI, RAD_PER_DEG} from './helper * necessary to avoid duplicates with `export * from './helpers`; see * https://github.com/microsoft/TypeScript/issues/46011 * @typedef { import('../core/core.controller.js').default } canvas.Chart - * @typedef { import('../../types/index.js').Point } Point + * @typedef { import('../types/index.js').Point } Point */ /** diff --git a/src/helpers/helpers.core.ts b/src/helpers/helpers.core.ts index f6f6f5ce5aa..74cd7ab1704 100644 --- a/src/helpers/helpers.core.ts +++ b/src/helpers/helpers.core.ts @@ -2,8 +2,8 @@ * @namespace Chart.helpers */ -import type {AnyObject} from '../../types/basic.js'; -import type {ActiveDataPoint, ChartEvent} from '../../types/index.js'; +import type {AnyObject} from '../types/basic.js'; +import type {ActiveDataPoint, ChartEvent} from '../types/index.js'; /** * An empty function that can be used, for example, for optional callback. diff --git a/src/helpers/helpers.curve.ts b/src/helpers/helpers.curve.ts index e9dab22e838..97b76993e64 100644 --- a/src/helpers/helpers.curve.ts +++ b/src/helpers/helpers.curve.ts @@ -1,6 +1,6 @@ import {almostEquals, distanceBetweenPoints, sign} from './helpers.math.js'; import {_isPointInArea} from './helpers.canvas.js'; -import type {ChartArea} from '../../types/index.js'; +import type {ChartArea} from '../types/index.js'; export interface SplinePoint { x: number; diff --git a/src/helpers/helpers.dom.ts b/src/helpers/helpers.dom.ts index 60b0aefb0e1..ce1d1a0459d 100644 --- a/src/helpers/helpers.dom.ts +++ b/src/helpers/helpers.dom.ts @@ -1,4 +1,4 @@ -import type {ChartArea, Scale} from '../../types/index.js'; +import type {ChartArea, Scale} from '../types/index.js'; import type Chart from '../core/core.controller.js'; import type {ChartEvent} from '../types.js'; import {INFINITY} from './helpers.math.js'; diff --git a/src/helpers/helpers.extras.ts b/src/helpers/helpers.extras.ts index 754f6050483..1428419119e 100644 --- a/src/helpers/helpers.extras.ts +++ b/src/helpers/helpers.extras.ts @@ -1,4 +1,4 @@ -import type {ChartMeta, PointElement} from '../../types/index.js'; +import type {ChartMeta, PointElement} from '../types/index.js'; import {_limitValue} from './helpers.math.js'; import {_lookupByKey} from './helpers.collection.js'; diff --git a/src/helpers/helpers.interpolation.ts b/src/helpers/helpers.interpolation.ts index 222654e530c..202575629d1 100644 --- a/src/helpers/helpers.interpolation.ts +++ b/src/helpers/helpers.interpolation.ts @@ -1,4 +1,4 @@ -import type {Point} from '../../types/geometric.js'; +import type {Point} from '../types/geometric.js'; import type {SplinePoint} from './helpers.curve.js'; /** diff --git a/src/helpers/helpers.math.ts b/src/helpers/helpers.math.ts index f7178694562..da463aeb04e 100644 --- a/src/helpers/helpers.math.ts +++ b/src/helpers/helpers.math.ts @@ -1,4 +1,4 @@ -import type {Point} from '../../types/geometric.js'; +import type {Point} from '../types/geometric.js'; import {isFinite as isFiniteNumber} from './helpers.core.js'; /** diff --git a/src/helpers/helpers.options.ts b/src/helpers/helpers.options.ts index 0cd38e4d7d6..c476ccb5e1a 100644 --- a/src/helpers/helpers.options.ts +++ b/src/helpers/helpers.options.ts @@ -1,8 +1,8 @@ import defaults from '../core/core.defaults.js'; import {isArray, isObject, toDimension, valueOrDefault} from './helpers.core.js'; import {Point, toFontString} from './helpers.canvas.js'; -import type {ChartArea, FontSpec} from '../../types/index.js'; -import type {TRBL, TRBLCorners} from '../../types/geometric.js'; +import type {ChartArea, FontSpec} from '../types/index.js'; +import type {TRBL, TRBLCorners} from '../types/geometric.js'; const LINE_HEIGHT = /^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/; const FONT_STYLE = /^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/; diff --git a/src/helpers/types.ts b/src/helpers/types.ts index 7eff7d57c97..3c3badbc892 100644 --- a/src/helpers/types.ts +++ b/src/helpers/types.ts @@ -16,4 +16,4 @@ export * from './helpers.intl.js'; export * from './helpers.math.js'; export * from './helpers.options.js'; export * from './helpers.rtl.js'; -export * from '../../types/helpers/index.js'; +export * from '../types/helpers/index.js'; diff --git a/src/plugins/plugin.filler/filler.options.js b/src/plugins/plugin.filler/filler.options.js index 3185760a2c3..33b965bc798 100644 --- a/src/plugins/plugin.filler/filler.options.js +++ b/src/plugins/plugin.filler/filler.options.js @@ -3,8 +3,8 @@ import {isObject, isFinite, valueOrDefault} from '../../helpers/helpers.core.js' /** * @typedef { import('../../core/core.scale.js').default } Scale * @typedef { import('../../elements/element.line.js').default } LineElement - * @typedef { import('../../../types/index.js').FillTarget } FillTarget - * @typedef { import('../../../types/index.js').ComplexFillTarget } ComplexFillTarget + * @typedef { import('../../types/index.js').FillTarget } FillTarget + * @typedef { import('../../types/index.js').ComplexFillTarget } ComplexFillTarget */ export function _resolveTarget(sources, index, propagate) { diff --git a/src/plugins/plugin.legend.js b/src/plugins/plugin.legend.js index e3cee4f2c8e..8d8264d637f 100644 --- a/src/plugins/plugin.legend.js +++ b/src/plugins/plugin.legend.js @@ -18,7 +18,7 @@ import {_alignStartEnd, _textX, _toLeftRightCenter} from '../helpers/helpers.ext import {toTRBLCorners} from '../helpers/helpers.options.js'; /** - * @typedef { import('../../types/index.js').ChartEvent } ChartEvent + * @typedef { import('../types/index.js').ChartEvent } ChartEvent */ const getBoxSize = (labelOpts, fontSize) => { diff --git a/src/plugins/plugin.tooltip.js b/src/plugins/plugin.tooltip.js index 1e59f432971..6a13c8ff285 100644 --- a/src/plugins/plugin.tooltip.js +++ b/src/plugins/plugin.tooltip.js @@ -9,8 +9,8 @@ import {createContext, drawPoint} from '../helpers/index.js'; /** * @typedef { import('../platform/platform.base.js').Chart } Chart - * @typedef { import('../../types/index.js').ChartEvent } ChartEvent - * @typedef { import('../../types/index.js').ActiveElement } ActiveElement + * @typedef { import('../types/index.js').ChartEvent } ChartEvent + * @typedef { import('../types/index.js').ActiveElement } ActiveElement * @typedef { import('../core/core.interaction.js').InteractionItem } InteractionItem */ diff --git a/src/types.ts b/src/types.ts index 56689652188..32e83eb9189 100644 --- a/src/types.ts +++ b/src/types.ts @@ -46,5 +46,5 @@ export { TimeScale, TimeSeriesScale, registerables -} from '../types/index.js'; -export * from '../types/index.js'; +} from './types/index.js'; +export * from './types/index.js'; diff --git a/types/animation.d.ts b/src/types/animation.d.ts similarity index 92% rename from types/animation.d.ts rename to src/types/animation.d.ts index 9c6aaa34060..41895125e99 100644 --- a/types/animation.d.ts +++ b/src/types/animation.d.ts @@ -1,5 +1,5 @@ -import { Chart } from './index.js'; -import { AnyObject } from './basic.js'; +import {Chart} from './index.js'; +import {AnyObject} from './basic.js'; export declare class Animation { constructor(cfg: AnyObject, target: AnyObject, prop: string, to?: unknown); diff --git a/types/basic.d.ts b/src/types/basic.d.ts similarity index 100% rename from types/basic.d.ts rename to src/types/basic.d.ts diff --git a/types/color.d.ts b/src/types/color.d.ts similarity index 100% rename from types/color.d.ts rename to src/types/color.d.ts diff --git a/types/geometric.d.ts b/src/types/geometric.d.ts similarity index 100% rename from types/geometric.d.ts rename to src/types/geometric.d.ts diff --git a/types/helpers/helpers.canvas.d.ts b/src/types/helpers/helpers.canvas.d.ts similarity index 92% rename from types/helpers/helpers.canvas.d.ts rename to src/types/helpers/helpers.canvas.d.ts index 6e7895adb54..41f99b2ad10 100644 --- a/types/helpers/helpers.canvas.d.ts +++ b/src/types/helpers/helpers.canvas.d.ts @@ -1,7 +1,7 @@ -import { PointStyle, Scriptable, ScriptableScaleContext } from '../index.js'; -import { Color } from '../color.js'; -import { ChartArea, RoundedRect } from '../geometric.js'; -import { CanvasFontSpec } from '../../src/helpers/helpers.options.js'; +import {PointStyle, Scriptable, ScriptableScaleContext} from '../index.js'; +import {Color} from '../color.js'; +import {ChartArea, RoundedRect} from '../geometric.js'; +import {CanvasFontSpec} from '../../helpers/helpers.options.js'; export function clearCanvas(canvas: HTMLCanvasElement, ctx?: CanvasRenderingContext2D): void; diff --git a/types/helpers/helpers.segment.d.ts b/src/types/helpers/helpers.segment.d.ts similarity index 100% rename from types/helpers/helpers.segment.d.ts rename to src/types/helpers/helpers.segment.d.ts diff --git a/types/helpers/index.d.ts b/src/types/helpers/index.d.ts similarity index 100% rename from types/helpers/index.d.ts rename to src/types/helpers/index.d.ts diff --git a/types/index.d.ts b/src/types/index.d.ts similarity index 98% rename from types/index.d.ts rename to src/types/index.d.ts index e3b377562b7..67ceab2383b 100644 --- a/types/index.d.ts +++ b/src/types/index.d.ts @@ -1,24 +1,25 @@ -import { DeepPartial, DistributiveArray, UnionToIntersection } from './utils.js'; - -import { TimeUnit } from '../src/core/core.adapters.js'; -import PointElement from '../src/elements/element.point.js'; -import { EasingFunction } from '../src/helpers/helpers.easing.js'; -import { AnimationEvent } from './animation.js'; -import { AnyObject, EmptyObject } from './basic.js'; -import { Color } from './color.js'; -import Element from '../src/core/core.element.js'; -import { ChartArea, Padding, Point } from './geometric.js'; -import { LayoutItem, LayoutPosition } from './layout.js'; -import { RenderTextOpts } from './helpers/helpers.canvas.js'; -import { CanvasFontSpec } from '../src/helpers/helpers.options.js'; - -export { EasingFunction } from '../src/helpers/helpers.easing.js'; -export { default as ArcElement, ArcProps } from '../src/elements/element.arc.js'; -export { default as PointElement, PointProps } from '../src/elements/element.point.js'; -export { Animation, Animations, Animator, AnimationEvent } from './animation.js'; -export { Color } from './color.js'; -export { ChartArea, Point } from './geometric.js'; -export { LayoutItem, LayoutPosition } from './layout.js'; +/* eslint-disable @typescript-eslint/ban-types */ +import {DeepPartial, DistributiveArray, UnionToIntersection} from './utils.js'; + +import {TimeUnit} from '../core/core.adapters.js'; +import PointElement from '../elements/element.point.js'; +import {EasingFunction} from '../helpers/helpers.easing.js'; +import {AnimationEvent} from './animation.js'; +import {AnyObject, EmptyObject} from './basic.js'; +import {Color} from './color.js'; +import Element from '../core/core.element.js'; +import {ChartArea, Padding, Point} from './geometric.js'; +import {LayoutItem, LayoutPosition} from './layout.js'; +import {RenderTextOpts} from './helpers/helpers.canvas.js'; +import {CanvasFontSpec} from '../helpers/helpers.options.js'; + +export {EasingFunction} from '../helpers/helpers.easing.js'; +export {default as ArcElement, ArcProps} from '../elements/element.arc.js'; +export {default as PointElement, PointProps} from '../elements/element.point.js'; +export {Animation, Animations, Animator, AnimationEvent} from './animation.js'; +export {Color} from './color.js'; +export {ChartArea, Point} from './geometric.js'; +export {LayoutItem, LayoutPosition} from './layout.js'; export interface ScriptableContext { active: boolean; @@ -234,7 +235,7 @@ export declare const LineController: ChartComponent & { export type ScatterControllerDatasetOptions = LineControllerDatasetOptions; -export interface ScatterDataPoint extends Point {} +export type ScatterDataPoint = Point export type ScatterControllerChartOptions = LineControllerChartOptions; diff --git a/types/layout.d.ts b/src/types/layout.d.ts similarity index 97% rename from types/layout.d.ts rename to src/types/layout.d.ts index 32fef763451..39ddc1394b7 100644 --- a/types/layout.d.ts +++ b/src/types/layout.d.ts @@ -1,4 +1,4 @@ -import { ChartArea } from './geometric.js'; +import {ChartArea} from './geometric.js'; export type LayoutPosition = 'left' | 'top' | 'right' | 'bottom' | 'center' | 'chartArea' | {[scaleId: string]: number}; diff --git a/types/utils.d.ts b/src/types/utils.d.ts similarity index 100% rename from types/utils.d.ts rename to src/types/utils.d.ts diff --git a/types/.eslintrc.yml b/test/types/.eslintrc.yml similarity index 62% rename from types/.eslintrc.yml rename to test/types/.eslintrc.yml index ca79ca01047..07b109145d8 100644 --- a/types/.eslintrc.yml +++ b/test/types/.eslintrc.yml @@ -1,6 +1,5 @@ rules: - # These rules were set to warning to make the linting pass initially, - # without making any major changes to types. + '@typescript-eslint/no-unused-vars': 'off' object-curly-spacing: ["warn", "always"] '@typescript-eslint/no-empty-interface': "warn" '@typescript-eslint/ban-types': "warn" diff --git a/types/tests/animation.ts b/test/types/animation.ts similarity index 100% rename from types/tests/animation.ts rename to test/types/animation.ts diff --git a/types/tests/autogen.js b/test/types/autogen.js similarity index 100% rename from types/tests/autogen.js rename to test/types/autogen.js diff --git a/types/tests/chart_types.ts b/test/types/chart_types.ts similarity index 100% rename from types/tests/chart_types.ts rename to test/types/chart_types.ts diff --git a/types/tests/config_types.ts b/test/types/config_types.ts similarity index 100% rename from types/tests/config_types.ts rename to test/types/config_types.ts diff --git a/types/tests/controllers/bar_floating_data.ts b/test/types/controllers/bar_floating_data.ts similarity index 100% rename from types/tests/controllers/bar_floating_data.ts rename to test/types/controllers/bar_floating_data.ts diff --git a/types/tests/controllers/bubble_chart_options.ts b/test/types/controllers/bubble_chart_options.ts similarity index 100% rename from types/tests/controllers/bubble_chart_options.ts rename to test/types/controllers/bubble_chart_options.ts diff --git a/types/tests/controllers/doughnut_meta_total.ts b/test/types/controllers/doughnut_meta_total.ts similarity index 100% rename from types/tests/controllers/doughnut_meta_total.ts rename to test/types/controllers/doughnut_meta_total.ts diff --git a/types/tests/controllers/doughnut_offset.ts b/test/types/controllers/doughnut_offset.ts similarity index 100% rename from types/tests/controllers/doughnut_offset.ts rename to test/types/controllers/doughnut_offset.ts diff --git a/types/tests/controllers/doughnut_outer_radius.ts b/test/types/controllers/doughnut_outer_radius.ts similarity index 100% rename from types/tests/controllers/doughnut_outer_radius.ts rename to test/types/controllers/doughnut_outer_radius.ts diff --git a/types/tests/controllers/line_scriptable_parsed_data.ts b/test/types/controllers/line_scriptable_parsed_data.ts similarity index 100% rename from types/tests/controllers/line_scriptable_parsed_data.ts rename to test/types/controllers/line_scriptable_parsed_data.ts diff --git a/types/tests/controllers/line_segments.ts b/test/types/controllers/line_segments.ts similarity index 100% rename from types/tests/controllers/line_segments.ts rename to test/types/controllers/line_segments.ts diff --git a/types/tests/controllers/line_span_gaps.ts b/test/types/controllers/line_span_gaps.ts similarity index 100% rename from types/tests/controllers/line_span_gaps.ts rename to test/types/controllers/line_span_gaps.ts diff --git a/types/tests/controllers/line_styling_array.ts b/test/types/controllers/line_styling_array.ts similarity index 100% rename from types/tests/controllers/line_styling_array.ts rename to test/types/controllers/line_styling_array.ts diff --git a/types/tests/controllers/radar_dataset_indexable_options.ts b/test/types/controllers/radar_dataset_indexable_options.ts similarity index 100% rename from types/tests/controllers/radar_dataset_indexable_options.ts rename to test/types/controllers/radar_dataset_indexable_options.ts diff --git a/types/tests/data_types.ts b/test/types/data_types.ts similarity index 100% rename from types/tests/data_types.ts rename to test/types/data_types.ts diff --git a/types/tests/dataset_null_data.ts b/test/types/dataset_null_data.ts similarity index 100% rename from types/tests/dataset_null_data.ts rename to test/types/dataset_null_data.ts diff --git a/types/tests/date_adapter.ts b/test/types/date_adapter.ts similarity index 100% rename from types/tests/date_adapter.ts rename to test/types/date_adapter.ts diff --git a/types/tests/defaults.ts b/test/types/defaults.ts similarity index 100% rename from types/tests/defaults.ts rename to test/types/defaults.ts diff --git a/types/tests/elements/scriptable_element_options.ts b/test/types/elements/scriptable_element_options.ts similarity index 100% rename from types/tests/elements/scriptable_element_options.ts rename to test/types/elements/scriptable_element_options.ts diff --git a/types/tests/extensions/plugin.ts b/test/types/extensions/plugin.ts similarity index 100% rename from types/tests/extensions/plugin.ts rename to test/types/extensions/plugin.ts diff --git a/types/tests/extensions/scale.ts b/test/types/extensions/scale.ts similarity index 87% rename from types/tests/extensions/scale.ts rename to test/types/extensions/scale.ts index 712b3f15ca5..3623eb3e7dc 100644 --- a/types/tests/extensions/scale.ts +++ b/test/types/extensions/scale.ts @@ -1,4 +1,4 @@ -import { AnyObject } from '../../basic.js'; +import { AnyObject } from '../../../src/types/basic.js'; import { CartesianScaleOptions, Chart, Scale } from '../../../src/types.js'; export type TestScaleOptions = CartesianScaleOptions & { @@ -17,7 +17,7 @@ export class TestScale extends Sc } } -declare module '../../index.js' { +declare module '../../../src/types/index.js' { interface CartesianScaleTypeRegistry { test: { options: TestScaleOptions diff --git a/types/tests/helpers/options.ts b/test/types/helpers/options.ts similarity index 100% rename from types/tests/helpers/options.ts rename to test/types/helpers/options.ts diff --git a/types/tests/interaction.ts b/test/types/interaction.ts similarity index 100% rename from types/tests/interaction.ts rename to test/types/interaction.ts diff --git a/types/tests/layout/position.ts b/test/types/layout/position.ts similarity index 100% rename from types/tests/layout/position.ts rename to test/types/layout/position.ts diff --git a/types/tests/options.ts b/test/types/options.ts similarity index 100% rename from types/tests/options.ts rename to test/types/options.ts diff --git a/types/tests/overrides.ts b/test/types/overrides.ts similarity index 100% rename from types/tests/overrides.ts rename to test/types/overrides.ts diff --git a/types/tests/parsed.data.type.ts b/test/types/parsed.data.type.ts similarity index 100% rename from types/tests/parsed.data.type.ts rename to test/types/parsed.data.type.ts diff --git a/types/tests/plugins/defaults.ts b/test/types/plugins/defaults.ts similarity index 100% rename from types/tests/plugins/defaults.ts rename to test/types/plugins/defaults.ts diff --git a/types/tests/plugins/plugin.decimation/decimation_algorithm.ts b/test/types/plugins/plugin.decimation/decimation_algorithm.ts similarity index 100% rename from types/tests/plugins/plugin.decimation/decimation_algorithm.ts rename to test/types/plugins/plugin.decimation/decimation_algorithm.ts diff --git a/types/tests/plugins/plugin.filler/fill_target_true.ts b/test/types/plugins/plugin.filler/fill_target_true.ts similarity index 100% rename from types/tests/plugins/plugin.filler/fill_target_true.ts rename to test/types/plugins/plugin.filler/fill_target_true.ts diff --git a/types/tests/plugins/plugin.tooltip/chart.tooltip.ts b/test/types/plugins/plugin.tooltip/chart.tooltip.ts similarity index 100% rename from types/tests/plugins/plugin.tooltip/chart.tooltip.ts rename to test/types/plugins/plugin.tooltip/chart.tooltip.ts diff --git a/types/tests/plugins/plugin.tooltip/tooltip_dataset_type.ts b/test/types/plugins/plugin.tooltip/tooltip_dataset_type.ts similarity index 100% rename from types/tests/plugins/plugin.tooltip/tooltip_dataset_type.ts rename to test/types/plugins/plugin.tooltip/tooltip_dataset_type.ts diff --git a/types/tests/plugins/plugin.tooltip/tooltip_parsed_data.ts b/test/types/plugins/plugin.tooltip/tooltip_parsed_data.ts similarity index 100% rename from types/tests/plugins/plugin.tooltip/tooltip_parsed_data.ts rename to test/types/plugins/plugin.tooltip/tooltip_parsed_data.ts diff --git a/types/tests/plugins/plugin.tooltip/tooltip_parsed_data_chart_defaults.ts b/test/types/plugins/plugin.tooltip/tooltip_parsed_data_chart_defaults.ts similarity index 100% rename from types/tests/plugins/plugin.tooltip/tooltip_parsed_data_chart_defaults.ts rename to test/types/plugins/plugin.tooltip/tooltip_parsed_data_chart_defaults.ts diff --git a/types/tests/plugins/plugin.tooltip/tooltip_scriptable_background_color.ts b/test/types/plugins/plugin.tooltip/tooltip_scriptable_background_color.ts similarity index 100% rename from types/tests/plugins/plugin.tooltip/tooltip_scriptable_background_color.ts rename to test/types/plugins/plugin.tooltip/tooltip_scriptable_background_color.ts diff --git a/types/tests/register.ts b/test/types/register.ts similarity index 100% rename from types/tests/register.ts rename to test/types/register.ts diff --git a/types/tests/scales/chart_options.ts b/test/types/scales/chart_options.ts similarity index 100% rename from types/tests/scales/chart_options.ts rename to test/types/scales/chart_options.ts diff --git a/types/tests/scales/options.ts b/test/types/scales/options.ts similarity index 100% rename from types/tests/scales/options.ts rename to test/types/scales/options.ts diff --git a/types/tests/scales/time_string_max.ts b/test/types/scales/time_string_max.ts similarity index 100% rename from types/tests/scales/time_string_max.ts rename to test/types/scales/time_string_max.ts diff --git a/types/tests/scriptable.ts b/test/types/scriptable.ts similarity index 100% rename from types/tests/scriptable.ts rename to test/types/scriptable.ts diff --git a/types/tests/scriptable_core_chart_options.ts b/test/types/scriptable_core_chart_options.ts similarity index 100% rename from types/tests/scriptable_core_chart_options.ts rename to test/types/scriptable_core_chart_options.ts diff --git a/types/tests/test_instance_assignment.ts b/test/types/test_instance_assignment.ts similarity index 100% rename from types/tests/test_instance_assignment.ts rename to test/types/test_instance_assignment.ts diff --git a/types/tests/tsconfig.json b/test/types/tsconfig.json similarity index 95% rename from types/tests/tsconfig.json rename to test/types/tsconfig.json index 438b3b48fd0..091024595a2 100644 --- a/types/tests/tsconfig.json +++ b/test/types/tsconfig.json @@ -5,7 +5,7 @@ "rootDir": "../../" }, "include": [ - "../", + "./", "../../src/", "../../dist/**/*.d.ts" ], diff --git a/tsconfig.json b/tsconfig.json index 5ccc6334e76..bbcd0a350da 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -33,18 +33,16 @@ }, "typedocOptions": { "name": "Chart.js", - "entryPoints": ["types/index.d.ts"], + "entryPoints": ["src/types/index.d.ts"], "readme": "none", "excludeExternals": true, "includeVersion": true, "out": "./dist/docs/typedoc" }, "include": [ - "./src/**/*", - "./types" + "./src/**/*" ], "exclude": [ - "./types/tests", "./dist/**" ] } diff --git a/types/tests/.eslintrc.yml b/types/tests/.eslintrc.yml deleted file mode 100644 index d5b7cf09454..00000000000 --- a/types/tests/.eslintrc.yml +++ /dev/null @@ -1,2 +0,0 @@ -rules: - '@typescript-eslint/no-unused-vars': 'off'