mirror of
https://github.com/chartjs/Chart.js.git
synced 2026-03-20 23:26:53 +01:00
Convert elements to use ES6 modules (import/export) (#6776)
* Enable ES6 modules * Convert elements to use import/export * Need default export for backwards compatibility * Remove dangling comma
This commit is contained in:
@@ -6,5 +6,6 @@ env:
|
||||
|
||||
parserOptions:
|
||||
ecmaVersion: 6
|
||||
sourceType: 'module'
|
||||
|
||||
plugins: ['html']
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
const defaults = require('../core/core.defaults');
|
||||
const Element = require('../core/core.element');
|
||||
const helpers = require('../helpers/index');
|
||||
import defaults from '../core/core.defaults';
|
||||
import Element from '../core/core.element';
|
||||
import helpers from '../helpers';
|
||||
const TAU = Math.PI * 2;
|
||||
|
||||
defaults._set('global', {
|
||||
@@ -196,4 +196,4 @@ class Arc extends Element {
|
||||
|
||||
Arc.prototype._type = 'arc';
|
||||
|
||||
module.exports = Arc;
|
||||
export default Arc;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
const defaults = require('../core/core.defaults');
|
||||
const Element = require('../core/core.element');
|
||||
const helpers = require('../helpers/index');
|
||||
import defaults from '../core/core.defaults';
|
||||
import Element from '../core/core.element';
|
||||
import helpers from '../helpers';
|
||||
|
||||
const defaultColor = defaults.global.defaultColor;
|
||||
|
||||
@@ -184,4 +184,4 @@ class Line extends Element {
|
||||
|
||||
Line.prototype._type = 'line';
|
||||
|
||||
module.exports = Line;
|
||||
export default Line;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
const defaults = require('../core/core.defaults');
|
||||
const Element = require('../core/core.element');
|
||||
const helpers = require('../helpers/index');
|
||||
import defaults from '../core/core.defaults';
|
||||
import Element from '../core/core.element';
|
||||
import helpers from '../helpers';
|
||||
|
||||
const defaultColor = defaults.global.defaultColor;
|
||||
|
||||
@@ -91,4 +91,4 @@ class Point extends Element {
|
||||
|
||||
Point.prototype._type = 'point';
|
||||
|
||||
module.exports = Point;
|
||||
export default Point;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
const defaults = require('../core/core.defaults');
|
||||
const Element = require('../core/core.element');
|
||||
const helpers = require('../helpers/index');
|
||||
import defaults from '../core/core.defaults';
|
||||
import Element from '../core/core.element';
|
||||
import helpers from '../helpers';
|
||||
|
||||
const defaultColor = defaults.global.defaultColor;
|
||||
|
||||
@@ -196,4 +196,4 @@ class Rectangle extends Element {
|
||||
|
||||
Rectangle.prototype._type = 'rectangle';
|
||||
|
||||
module.exports = Rectangle;
|
||||
export default Rectangle;
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {};
|
||||
module.exports.Arc = require('./element.arc');
|
||||
module.exports.Line = require('./element.line');
|
||||
module.exports.Point = require('./element.point');
|
||||
module.exports.Rectangle = require('./element.rectangle');
|
||||
import Arc from './element.arc';
|
||||
import Line from './element.line';
|
||||
import Point from './element.point';
|
||||
import Rectangle from './element.rectangle';
|
||||
|
||||
export default {
|
||||
Arc,
|
||||
Line,
|
||||
Point,
|
||||
Rectangle
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user