Enable eslint, use spread and build update

This commit is contained in:
Kamran Ahmed
2018-03-14 00:48:51 +01:00
parent a5a663a5f6
commit dbd9ad0bc6
6 changed files with 36 additions and 32 deletions
+1
View File
@@ -19,6 +19,7 @@
"babel-eslint": "^8.2.2",
"babel-loader": "^7.1.3",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.6.1",
"copy-webpack-plugin": "^4.5.1",
"css-loader": "^0.28.10",
+1 -1
View File
@@ -41,4 +41,4 @@ export const POPOVER_HTML = `
</div>`;
export const OVERLAY_HTML = `<div id="${ID_OVERLAY}"></div>`;
export const STAGE_HTML = `<div id="${ID_STAGE}"></div>`;
export const STAGE_HTML = `<div id="${ID_STAGE}"></div>`;
+15 -18
View File
@@ -24,7 +24,7 @@ export default class Driver {
* @param {Object} options
*/
constructor(options = {}) {
this.options = Object.assign({
this.options = {
animate: OVERLAY_ANIMATE, // Whether to animate or not
opacity: OVERLAY_OPACITY, // Overlay opacity
padding: OVERLAY_PADDING, // Spacing around the element from the overlay
@@ -35,7 +35,8 @@ export default class Driver {
},
onDeselected: () => { // When the element has been deselected
},
}, options);
...options,
};
this.document = document;
this.window = window;
@@ -244,11 +245,10 @@ export default class Driver {
querySelector = currentStep;
} else {
querySelector = currentStep.element;
elementOptions = Object.assign(
{},
this.options,
currentStep,
);
elementOptions = {
...this.options,
...currentStep,
};
}
const domElement = this.document.querySelector(querySelector);
@@ -259,17 +259,14 @@ export default class Driver {
let popover = null;
if (elementOptions.popover && elementOptions.popover.description) {
const popoverOptions = Object.assign(
{},
this.options,
elementOptions.popover,
{
totalCount: allSteps.length,
currentIndex: index,
isFirst: index === 0,
isLast: index === allSteps.length - 1,
},
);
const popoverOptions = {
...this.options,
...elementOptions.popover,
totalCount: allSteps.length,
currentIndex: index,
isFirst: index === 0,
isLast: index === allSteps.length - 1,
};
popover = new Popover(popoverOptions, this.window, this.document);
}
+14 -11
View File
@@ -18,23 +18,26 @@ module.exports = {
},
module: {
rules: [
// {
// test: /\.js$/,
// exclude: /node_modules/,
// loader: 'eslint-loader',
// enforce: 'pre',
// options: {
// failOnWarning: false,
// failOnError: true,
// },
// },
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'eslint-loader',
enforce: 'pre',
options: {
failOnWarning: false,
failOnError: true,
},
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
presets: ['env'],
plugins: ['babel-plugin-add-module-exports'],
plugins: [
'babel-plugin-add-module-exports',
'transform-object-rest-spread',
],
},
},
{
+4 -1
View File
@@ -32,7 +32,10 @@ module.exports = {
loader: 'babel-loader',
options: {
presets: ['env'],
plugins: ['babel-plugin-add-module-exports'],
plugins: [
'babel-plugin-add-module-exports',
'transform-object-rest-spread',
],
},
},
{
+1 -1
View File
@@ -833,7 +833,7 @@ babel-plugin-transform-flow-strip-types@^6.8.0:
babel-plugin-syntax-flow "^6.18.0"
babel-runtime "^6.22.0"
babel-plugin-transform-object-rest-spread@^6.22.0:
babel-plugin-transform-object-rest-spread@^6.22.0, babel-plugin-transform-object-rest-spread@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz#0f36692d50fef6b7e2d4b3ac1478137a963b7b06"
dependencies: