kamrify commited on
Commit
ef1f6b6
·
1 Parent(s): 1337c0d

Enable eslint, use spread and build update

Browse files
package.json CHANGED
@@ -19,6 +19,7 @@
19
  "babel-eslint": "^8.2.2",
20
  "babel-loader": "^7.1.3",
21
  "babel-plugin-add-module-exports": "^0.2.1",
 
22
  "babel-preset-env": "^1.6.1",
23
  "copy-webpack-plugin": "^4.5.1",
24
  "css-loader": "^0.28.10",
 
19
  "babel-eslint": "^8.2.2",
20
  "babel-loader": "^7.1.3",
21
  "babel-plugin-add-module-exports": "^0.2.1",
22
+ "babel-plugin-transform-object-rest-spread": "^6.26.0",
23
  "babel-preset-env": "^1.6.1",
24
  "copy-webpack-plugin": "^4.5.1",
25
  "css-loader": "^0.28.10",
src/common/constants.js CHANGED
@@ -41,4 +41,4 @@ export const POPOVER_HTML = `
41
  </div>`;
42
 
43
  export const OVERLAY_HTML = `<div id="${ID_OVERLAY}"></div>`;
44
- export const STAGE_HTML = `<div id="${ID_STAGE}"></div>`;
 
41
  </div>`;
42
 
43
  export const OVERLAY_HTML = `<div id="${ID_OVERLAY}"></div>`;
44
+ export const STAGE_HTML = `<div id="${ID_STAGE}"></div>`;
src/index.js CHANGED
@@ -24,7 +24,7 @@ export default class Driver {
24
  * @param {Object} options
25
  */
26
  constructor(options = {}) {
27
- this.options = Object.assign({
28
  animate: OVERLAY_ANIMATE, // Whether to animate or not
29
  opacity: OVERLAY_OPACITY, // Overlay opacity
30
  padding: OVERLAY_PADDING, // Spacing around the element from the overlay
@@ -35,7 +35,8 @@ export default class Driver {
35
  },
36
  onDeselected: () => { // When the element has been deselected
37
  },
38
- }, options);
 
39
 
40
  this.document = document;
41
  this.window = window;
@@ -244,11 +245,10 @@ export default class Driver {
244
  querySelector = currentStep;
245
  } else {
246
  querySelector = currentStep.element;
247
- elementOptions = Object.assign(
248
- {},
249
- this.options,
250
- currentStep,
251
- );
252
  }
253
 
254
  const domElement = this.document.querySelector(querySelector);
@@ -259,17 +259,14 @@ export default class Driver {
259
 
260
  let popover = null;
261
  if (elementOptions.popover && elementOptions.popover.description) {
262
- const popoverOptions = Object.assign(
263
- {},
264
- this.options,
265
- elementOptions.popover,
266
- {
267
- totalCount: allSteps.length,
268
- currentIndex: index,
269
- isFirst: index === 0,
270
- isLast: index === allSteps.length - 1,
271
- },
272
- );
273
 
274
  popover = new Popover(popoverOptions, this.window, this.document);
275
  }
 
24
  * @param {Object} options
25
  */
26
  constructor(options = {}) {
27
+ this.options = {
28
  animate: OVERLAY_ANIMATE, // Whether to animate or not
29
  opacity: OVERLAY_OPACITY, // Overlay opacity
30
  padding: OVERLAY_PADDING, // Spacing around the element from the overlay
 
35
  },
36
  onDeselected: () => { // When the element has been deselected
37
  },
38
+ ...options,
39
+ };
40
 
41
  this.document = document;
42
  this.window = window;
 
245
  querySelector = currentStep;
246
  } else {
247
  querySelector = currentStep.element;
248
+ elementOptions = {
249
+ ...this.options,
250
+ ...currentStep,
251
+ };
 
252
  }
253
 
254
  const domElement = this.document.querySelector(querySelector);
 
259
 
260
  let popover = null;
261
  if (elementOptions.popover && elementOptions.popover.description) {
262
+ const popoverOptions = {
263
+ ...this.options,
264
+ ...elementOptions.popover,
265
+ totalCount: allSteps.length,
266
+ currentIndex: index,
267
+ isFirst: index === 0,
268
+ isLast: index === allSteps.length - 1,
269
+ };
 
 
 
270
 
271
  popover = new Popover(popoverOptions, this.window, this.document);
272
  }
webpack.config.dev.js CHANGED
@@ -18,23 +18,26 @@ module.exports = {
18
  },
19
  module: {
20
  rules: [
21
- // {
22
- // test: /\.js$/,
23
- // exclude: /node_modules/,
24
- // loader: 'eslint-loader',
25
- // enforce: 'pre',
26
- // options: {
27
- // failOnWarning: false,
28
- // failOnError: true,
29
- // },
30
- // },
31
  {
32
  test: /\.js$/,
33
  exclude: /node_modules/,
34
  loader: 'babel-loader',
35
  options: {
36
  presets: ['env'],
37
- plugins: ['babel-plugin-add-module-exports'],
 
 
 
38
  },
39
  },
40
  {
 
18
  },
19
  module: {
20
  rules: [
21
+ {
22
+ test: /\.js$/,
23
+ exclude: /node_modules/,
24
+ loader: 'eslint-loader',
25
+ enforce: 'pre',
26
+ options: {
27
+ failOnWarning: false,
28
+ failOnError: true,
29
+ },
30
+ },
31
  {
32
  test: /\.js$/,
33
  exclude: /node_modules/,
34
  loader: 'babel-loader',
35
  options: {
36
  presets: ['env'],
37
+ plugins: [
38
+ 'babel-plugin-add-module-exports',
39
+ 'transform-object-rest-spread',
40
+ ],
41
  },
42
  },
43
  {
webpack.config.prod.js CHANGED
@@ -32,7 +32,10 @@ module.exports = {
32
  loader: 'babel-loader',
33
  options: {
34
  presets: ['env'],
35
- plugins: ['babel-plugin-add-module-exports'],
 
 
 
36
  },
37
  },
38
  {
 
32
  loader: 'babel-loader',
33
  options: {
34
  presets: ['env'],
35
+ plugins: [
36
+ 'babel-plugin-add-module-exports',
37
+ 'transform-object-rest-spread',
38
+ ],
39
  },
40
  },
41
  {
yarn.lock CHANGED
@@ -833,7 +833,7 @@ babel-plugin-transform-flow-strip-types@^6.8.0:
833
  babel-plugin-syntax-flow "^6.18.0"
834
  babel-runtime "^6.22.0"
835
 
836
- babel-plugin-transform-object-rest-spread@^6.22.0:
837
  version "6.26.0"
838
  resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz#0f36692d50fef6b7e2d4b3ac1478137a963b7b06"
839
  dependencies:
 
833
  babel-plugin-syntax-flow "^6.18.0"
834
  babel-runtime "^6.22.0"
835
 
836
+ babel-plugin-transform-object-rest-spread@^6.22.0, babel-plugin-transform-object-rest-spread@^6.26.0:
837
  version "6.26.0"
838
  resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz#0f36692d50fef6b7e2d4b3ac1478137a963b7b06"
839
  dependencies: