Skip to content

Commit

Permalink
Convert elements to use ES6 modules (import/export) (#6776)
Browse files Browse the repository at this point in the history
* Enable ES6 modules
* Convert elements to use import/export
* Need default export for backwards compatibility
* Remove dangling comma
  • Loading branch information
etimberg authored Nov 23, 2019
1 parent e6cf2fe commit 62bbaeb
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 21 deletions.
1 change: 1 addition & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ env:

parserOptions:
ecmaVersion: 6
sourceType: 'module'

plugins: ['html']
8 changes: 4 additions & 4 deletions src/elements/element.arc.js
Original file line number Diff line number Diff line change
@@ -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', {
Expand Down Expand Up @@ -196,4 +196,4 @@ class Arc extends Element {

Arc.prototype._type = 'arc';

module.exports = Arc;
export default Arc;
8 changes: 4 additions & 4 deletions src/elements/element.line.js
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -184,4 +184,4 @@ class Line extends Element {

Line.prototype._type = 'line';

module.exports = Line;
export default Line;
8 changes: 4 additions & 4 deletions src/elements/element.point.js
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -91,4 +91,4 @@ class Point extends Element {

Point.prototype._type = 'point';

module.exports = Point;
export default Point;
8 changes: 4 additions & 4 deletions src/elements/element.rectangle.js
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -196,4 +196,4 @@ class Rectangle extends Element {

Rectangle.prototype._type = 'rectangle';

module.exports = Rectangle;
export default Rectangle;
16 changes: 11 additions & 5 deletions src/elements/index.js
Original file line number Diff line number Diff line change
@@ -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
};

0 comments on commit 62bbaeb

Please sign in to comment.