diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index 07172a9bfb1..00000000000 --- a/.jshintrc +++ /dev/null @@ -1,26 +0,0 @@ -{ - "boss": true, - "curly": true, - "eqeqeq": true, - "eqnull": true, - "es3": true, - "expr": true, - "immed": true, - "noarg": true, - "onevar": true, - "quotmark": "single", - "trailing": true, - "undef": true, - "unused": true, - "multistr": true, - - "browser": true, - - "globals": { - "_": false, - "Backbone": false, - "jQuery": false, - "JSON": false, - "wp": false - } -} diff --git a/Gruntfile.js b/Gruntfile.js index bb38d5151fc..0a8316eb8c9 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,4 +1,3 @@ -/* jshint node:true */ module.exports = function( grunt ) { 'use strict'; var sass = require( 'node-sass' ); @@ -14,12 +13,9 @@ module.exports = function( grunt ) { php: 'includes' }, - // JavaScript linting with JSHint. - jshint: { - options: { - jshintrc: '.jshintrc' - }, - all: [ + // JavaScript linting with ESLint. + eslint: { + src: [ '<%= dirs.js %>/admin/*.js', '!<%= dirs.js %>/admin/*.min.js', '<%= dirs.js %>/frontend/*.js', @@ -192,12 +188,13 @@ module.exports = function( grunt ) { }, js: { files: [ + 'GruntFile.js', '<%= dirs.js %>/admin/*js', '<%= dirs.js %>/frontend/*js', '!<%= dirs.js %>/admin/*.min.js', '!<%= dirs.js %>/frontend/*.min.js' ], - tasks: ['jshint', 'uglify'] + tasks: ['eslint','uglify'] } }, @@ -291,7 +288,7 @@ module.exports = function( grunt ) { grunt.loadNpmTasks( 'grunt-rtlcss' ); grunt.loadNpmTasks( 'grunt-postcss' ); grunt.loadNpmTasks( 'grunt-stylelint' ); - grunt.loadNpmTasks( 'grunt-contrib-jshint' ); + grunt.loadNpmTasks( 'gruntify-eslint' ); grunt.loadNpmTasks( 'grunt-contrib-uglify' ); grunt.loadNpmTasks( 'grunt-contrib-cssmin' ); grunt.loadNpmTasks( 'grunt-contrib-concat' ); @@ -307,7 +304,7 @@ module.exports = function( grunt ) { ]); grunt.registerTask( 'js', [ - 'jshint', + 'eslint', 'uglify:admin', 'uglify:frontend' ]); diff --git a/assets/js/admin/api-keys.js b/assets/js/admin/api-keys.js index 760e883be27..4a5c0dd7ceb 100644 --- a/assets/js/admin/api-keys.js +++ b/assets/js/admin/api-keys.js @@ -142,7 +142,9 @@ $( '#key_permissions', self.el ).val( data.permissions ); } } else { - $( 'h2, h3', self.el ).first().append( '

' + response.data.message + '

' ); + $( 'h2, h3', self.el ) + .first() + .append( '

' + response.data.message + '

' ); } self.unblock(); diff --git a/assets/js/admin/backbone-modal.js b/assets/js/admin/backbone-modal.js index 7aa02f8a90f..63cca56422a 100644 --- a/assets/js/admin/backbone-modal.js +++ b/assets/js/admin/backbone-modal.js @@ -130,7 +130,10 @@ var button = e.keyCode || e.which; // Enter key - if ( 13 === button && ! ( e.target.tagName && ( e.target.tagName.toLowerCase() === 'input' || e.target.tagName.toLowerCase() === 'textarea' ) ) ) { + if ( + 13 === button && + ! ( e.target.tagName && ( e.target.tagName.toLowerCase() === 'input' || e.target.tagName.toLowerCase() === 'textarea' ) ) + ) { this.addButton( e ); } diff --git a/assets/js/admin/meta-boxes-order.js b/assets/js/admin/meta-boxes-order.js index 603ba14733f..3175beb5760 100644 --- a/assets/js/admin/meta-boxes-order.js +++ b/assets/js/admin/meta-boxes-order.js @@ -1,3 +1,4 @@ +// eslint-disable-next-line max-len /*global woocommerce_admin_meta_boxes, woocommerce_admin, accounting, woocommerce_admin_meta_boxes_order, wcSetClipboard, wcClearClipboard */ jQuery( function ( $ ) { @@ -11,7 +12,12 @@ jQuery( function ( $ ) { var wc_meta_boxes_order = { states: null, init: function() { - if ( ! ( typeof woocommerce_admin_meta_boxes_order === 'undefined' || typeof woocommerce_admin_meta_boxes_order.countries === 'undefined' ) ) { + if ( + ! ( + typeof woocommerce_admin_meta_boxes_order === 'undefined' || + typeof woocommerce_admin_meta_boxes_order.countries === 'undefined' + ) + ) { /* State/Country select boxes */ this.states = $.parseJSON( woocommerce_admin_meta_boxes_order.countries.replace( /"/g, '"' ) ); } @@ -380,11 +386,19 @@ jQuery( function ( $ ) { $( 'input.line_tax', $row ).each( function() { var $line_total_tax = $( this ); var tax_id = $line_total_tax.data( 'tax_id' ); - var unit_total_tax = accounting.unformat( $line_total_tax.attr( 'data-total_tax' ), woocommerce_admin.mon_decimal_point ) / o_qty; + var unit_total_tax = accounting.unformat( + $line_total_tax.attr( 'data-total_tax' ), + woocommerce_admin.mon_decimal_point + ) / o_qty; var $line_subtotal_tax = $( 'input.line_subtotal_tax[data-tax_id="' + tax_id + '"]', $row ); - var unit_subtotal_tax = accounting.unformat( $line_subtotal_tax.attr( 'data-subtotal_tax' ), woocommerce_admin.mon_decimal_point ) / o_qty; + var unit_subtotal_tax = accounting.unformat( + $line_subtotal_tax.attr( 'data-subtotal_tax' ), + woocommerce_admin.mon_decimal_point + ) / o_qty; var round_at_subtotal = 'yes' === woocommerce_admin_meta_boxes.round_at_subtotal; - var precision = woocommerce_admin_meta_boxes[ round_at_subtotal ? 'rounding_precision' : 'currency_format_num_decimals' ]; + var precision = woocommerce_admin_meta_boxes[ + round_at_subtotal ? 'rounding_precision' : 'currency_format_num_decimals' + ]; if ( 0 < unit_total_tax ) { $line_total_tax.val( @@ -877,7 +891,10 @@ jQuery( function ( $ ) { $( '.refund input.refund_line_total' ).each(function( index, item ) { if ( $( item ).closest( 'tr' ).data( 'order_item_id' ) ) { - line_item_totals[ $( item ).closest( 'tr' ).data( 'order_item_id' ) ] = accounting.unformat( item.value, woocommerce_admin.mon_decimal_point ); + line_item_totals[ $( item ).closest( 'tr' ).data( 'order_item_id' ) ] = accounting.unformat( + item.value, + woocommerce_admin.mon_decimal_point + ); } }); @@ -889,7 +906,10 @@ jQuery( function ( $ ) { line_item_tax_totals[ $( item ).closest( 'tr' ).data( 'order_item_id' ) ] = {}; } - line_item_tax_totals[ $( item ).closest( 'tr' ).data( 'order_item_id' ) ][ tax_id ] = accounting.unformat( item.value, woocommerce_admin.mon_decimal_point ); + line_item_tax_totals[ $( item ).closest( 'tr' ).data( 'order_item_id' ) ][ tax_id ] = accounting.unformat( + item.value, + woocommerce_admin.mon_decimal_point + ); } }); @@ -1018,11 +1038,16 @@ jQuery( function ( $ ) { var $refund_line_total_tax = $( this ); var tax_id = $refund_line_total_tax.data( 'tax_id' ); var line_total_tax = $( 'input.line_tax[data-tax_id="' + tax_id + '"]', $row ); - var unit_total_tax = accounting.unformat( line_total_tax.data( 'total_tax' ), woocommerce_admin.mon_decimal_point ) / qty; + var unit_total_tax = accounting.unformat( + line_total_tax.data( 'total_tax' ), + woocommerce_admin.mon_decimal_point + ) / qty; if ( 0 < unit_total_tax ) { var round_at_subtotal = 'yes' === woocommerce_admin_meta_boxes.round_at_subtotal; - var precision = woocommerce_admin_meta_boxes[ round_at_subtotal ? 'rounding_precision' : 'currency_format_num_decimals' ]; + var precision = woocommerce_admin_meta_boxes[ + round_at_subtotal ? 'rounding_precision' : 'currency_format_num_decimals' + ]; $refund_line_total_tax.val( parseFloat( accounting.formatNumber( unit_total_tax * refund_qty, precision, '' ) ) @@ -1059,8 +1084,17 @@ jQuery( function ( $ ) { var index = $items.find('tr').length + 1; var $row = '' + '' + - '' + - '' + + '' + + '' + '' + '' + ''; diff --git a/assets/js/admin/meta-boxes-product.js b/assets/js/admin/meta-boxes-product.js index f21e2cc9ceb..efbae1dbf4d 100644 --- a/assets/js/admin/meta-boxes-product.js +++ b/assets/js/admin/meta-boxes-product.js @@ -476,7 +476,9 @@ jQuery( function( $ ) { $( '.product_attributes .woocommerce_attribute' ).each( function( index, el ) { if ( $( el ).css( 'display' ) !== 'none' && $( el ).is( '.taxonomy' ) ) { - $( 'select.attribute_taxonomy' ).find( 'option[value="' + $( el ).data( 'taxonomy' ) + '"]' ).prop( 'disabled', true ); + $( 'select.attribute_taxonomy' ) + .find( 'option[value="' + $( el ).data( 'taxonomy' ) + '"]' ) + .prop( 'disabled', true ); } }); diff --git a/assets/js/admin/product-ordering.js b/assets/js/admin/product-ordering.js index 9c2075eb5cd..c030871a48b 100644 --- a/assets/js/admin/product-ordering.js +++ b/assets/js/admin/product-ordering.js @@ -38,17 +38,24 @@ jQuery( function( $ ) { var nextpostid = ui.item.next().find( '.check-column input' ).val(); // Show Spinner - ui.item.find( '.check-column input' ).hide().after( 'processing' ); + ui.item + .find( '.check-column input' ) + .hide() + .after( 'processing' ); // Go do the sorting stuff via ajax - $.post( ajaxurl, { action: 'woocommerce_product_ordering', id: postid, previd: prevpostid, nextid: nextpostid }, function( response ) { - $.each( response, function( key, value ) { - $( '#inline_' + key + ' .menu_order' ).html( value ); - }); - ui.item.find( '.check-column input' ).show().siblings( 'img' ).remove(); - $( 'table.widefat tbody th, table.widefat tbody td' ).css( 'cursor', 'move' ); - $( 'table.widefat tbody' ).sortable( 'enable' ); - }); + $.post( + ajaxurl, + { action: 'woocommerce_product_ordering', id: postid, previd: prevpostid, nextid: nextpostid }, + function( response ) { + $.each( response, function( key, value ) { + $( '#inline_' + key + ' .menu_order' ).html( value ); + }); + ui.item.find( '.check-column input' ).show().siblings( 'img' ).remove(); + $( 'table.widefat tbody th, table.widefat tbody td' ).css( 'cursor', 'move' ); + $( 'table.widefat tbody' ).sortable( 'enable' ); + } + ); // fix cell colors $( 'table.widefat tbody tr' ).each( function() { diff --git a/assets/js/admin/quick-edit.js b/assets/js/admin/quick-edit.js index 74f2f94c866..56bd651779d 100644 --- a/assets/js/admin/quick-edit.js +++ b/assets/js/admin/quick-edit.js @@ -45,6 +45,7 @@ jQuery(function( $ ) { $( 'input[name="_stock"]', '.inline-edit-row' ).val( stock ); $( 'input[name="menu_order"]', '.inline-edit-row' ).val( menu_order ); + // eslint-disable-next-line max-len $( 'select[name="_tax_status"] option, select[name="_tax_class"] option, select[name="_visibility"] option, select[name="_stock_status"] option, select[name="_backorders"] option' ).removeAttr( 'selected' ); $( 'select[name="_tax_status"] option[value="' + tax_status + '"]', '.inline-edit-row' ).attr( 'selected', 'selected' ); diff --git a/assets/js/admin/reports.js b/assets/js/admin/reports.js index 3173462e470..f419f16fc03 100644 --- a/assets/js/admin/reports.js +++ b/assets/js/admin/reports.js @@ -222,7 +222,13 @@ jQuery(function( $ ) { csv_data += '"' + index + '",'; } else { if ( groupby === 'day' ) { - csv_data += '"' + date.getUTCFullYear() + '-' + parseInt( date.getUTCMonth() + 1, 10 ) + '-' + date.getUTCDate() + '",'; + csv_data += '"' + + date.getUTCFullYear() + + '-' + + parseInt( date.getUTCMonth() + 1, 10 ) + + '-' + + date.getUTCDate() + + '",'; } else { csv_data += '"' + date.getUTCFullYear() + '-' + parseInt( date.getUTCMonth() + 1, 10 ) + '",'; } diff --git a/assets/js/admin/settings-views-html-settings-tax.js b/assets/js/admin/settings-views-html-settings-tax.js index 9d6793aa173..061c2bd1af7 100644 --- a/assets/js/admin/settings-views-html-settings-tax.js +++ b/assets/js/admin/settings-views-html-settings-tax.js @@ -165,7 +165,8 @@ minLength: 3 }); - // Postcode and city don't have `name` values by default. They're only created if the contents changes, to save on database queries (I think) + // Postcode and city don't have `name` values by default. + // They're only created if the contents changes, to save on database queries (I think) this.$el.find( 'td.postcode input, td.city input' ).change( function() { $( this ).attr( 'name', $( this ).data( 'name' ) ); }); @@ -232,7 +233,9 @@ reordered_rates = _.map( rates_to_reorder, function( rate ) { rate.tax_rate_order++; - changes[ rate.tax_rate_id ] = _.extend( changes[ rate.tax_rate_id ] || {}, { tax_rate_order : rate.tax_rate_order } ); + changes[ rate.tax_rate_id ] = _.extend( + changes[ rate.tax_rate_id ] || {}, { tax_rate_order : rate.tax_rate_order } + ); return rate; } ); } else { diff --git a/assets/js/admin/term-ordering.js b/assets/js/admin/term-ordering.js index 302f6854d6e..1a1a99d8d97 100644 --- a/assets/js/admin/term-ordering.js +++ b/assets/js/admin/term-ordering.js @@ -30,7 +30,13 @@ jQuery( function( $ ) { }; $( document ).ajaxComplete( function( event, request, options ) { - if ( request && 4 === request.readyState && 200 === request.status && options.data && ( 0 <= options.data.indexOf( '_inline_edit' ) || 0 <= options.data.indexOf( 'add-tag' ) ) ) { + if ( + request && + 4 === request.readyState && + 200 === request.status && + options.data && + ( 0 <= options.data.indexOf( '_inline_edit' ) || 0 <= options.data.indexOf( 'add-tag' ) ) + ) { $.wc_add_missing_sort_handles(); $( document.body ).trigger( 'init_tooltips' ); } @@ -80,25 +86,41 @@ jQuery( function( $ ) { } } - // If previous and next not at same tree level, or next not at same tree level and the previous is the parent of the next, or just moved item beneath its own children - if ( ( prevtermid === undefined && nexttermid === undefined ) || ( nexttermid === undefined && nexttermparent === prevtermid ) || ( nexttermid !== undefined && prevtermparent === termid ) ) { + // If previous and next not at same tree level, or next not at same tree level and + // the previous is the parent of the next, or just moved item beneath its own children. + if ( + ( prevtermid === undefined && nexttermid === undefined ) || + ( nexttermid === undefined && nexttermparent === prevtermid ) || + ( nexttermid !== undefined && prevtermparent === termid ) + ) { $( table_selector ).sortable( 'cancel' ); return; } // Show Spinner ui.item.find( '.check-column input' ).hide(); - ui.item.find( '.check-column' ).append( 'processing' ); + ui.item + .find( '.check-column' ) + .append( 'processing' ); - // Go do the sorting stuff via ajax - $.post( ajaxurl, { action: 'woocommerce_term_ordering', id: termid, nextid: nexttermid, thetaxonomy: woocommerce_term_ordering_params.taxonomy }, function(response){ - if ( response === 'children' ) { - window.location.reload(); - } else { - ui.item.find( '.check-column input' ).show(); - ui.item.find( '.check-column' ).find( 'img' ).remove(); + // Go do the sorting stuff via ajax. + $.post( + ajaxurl, + { + action: 'woocommerce_term_ordering', + id: termid, + nextid: nexttermid, + thetaxonomy: woocommerce_term_ordering_params.taxonomy + }, + function(response) { + if ( response === 'children' ) { + window.location.reload(); + } else { + ui.item.find( '.check-column input' ).show(); + ui.item.find( '.check-column' ).find( 'img' ).remove(); + } } - }); + ); // Fix cell colors $( 'table.widefat tbody tr' ).each( function() { diff --git a/assets/js/admin/wc-product-import.js b/assets/js/admin/wc-product-import.js index 0af872bcd8a..7ba790ed5e6 100644 --- a/assets/js/admin/wc-product-import.js +++ b/assets/js/admin/wc-product-import.js @@ -58,7 +58,15 @@ $this.$form.find('.woocommerce-importer-progress').val( response.data.percentage ); if ( 'done' === response.data.position ) { - window.location = response.data.url + '&products-imported=' + parseInt( $this.imported, 10 ) + '&products-failed=' + parseInt( $this.failed, 10 ) + '&products-updated=' + parseInt( $this.updated, 10 ) + '&products-skipped=' + parseInt( $this.skipped, 10 ); + window.location = response.data.url + + '&products-imported=' + + parseInt( $this.imported, 10 ) + + '&products-failed=' + + parseInt( $this.failed, 10 ) + + '&products-updated=' + + parseInt( $this.updated, 10 ) + + '&products-skipped=' + + parseInt( $this.skipped, 10 ); } else { $this.run_import(); } diff --git a/assets/js/admin/wc-shipping-zone-methods.js b/assets/js/admin/wc-shipping-zone-methods.js index 813b7ebda9a..17289866132 100644 --- a/assets/js/admin/wc-shipping-zone-methods.js +++ b/assets/js/admin/wc-shipping-zone-methods.js @@ -34,11 +34,16 @@ this.trigger( 'change:methods' ); }, save: function() { - $.post( ajaxurl + ( ajaxurl.indexOf( '?' ) > 0 ? '&' : '?' ) + 'action=woocommerce_shipping_zone_methods_save_changes', { - wc_shipping_zones_nonce : data.wc_shipping_zones_nonce, - changes : this.changes, - zone_id : data.zone_id - }, this.onSaveResponse, 'json' ); + $.post( + ajaxurl + ( ajaxurl.indexOf( '?' ) > 0 ? '&' : '?' ) + 'action=woocommerce_shipping_zone_methods_save_changes', + { + wc_shipping_zones_nonce : data.wc_shipping_zones_nonce, + changes : this.changes, + zone_id : data.zone_id + }, + this.onSaveResponse, + 'json' + ); }, onSaveResponse: function( response, textStatus ) { if ( 'success' === textStatus ) { @@ -46,7 +51,11 @@ if ( response.data.zone_id !== data.zone_id ) { data.zone_id = response.data.zone_id; if ( window.history.pushState ) { - window.history.pushState({}, '', 'admin.php?page=wc-settings&tab=shipping&zone_id=' + response.data.zone_id ); + window.history.pushState( + {}, + '', + 'admin.php?page=wc-settings&tab=shipping&zone_id=' + response.data.zone_id + ); } } shippingMethod.set( 'methods', response.data.methods ); @@ -72,7 +81,12 @@ $( window ).on( 'beforeunload', { view: this }, this.unloadConfirmation ); $save_button.on( 'click', { view: this }, this.onSubmit ); - $( document.body ).on( 'input change', '#zone_name, #zone_locations, #zone_postcodes', { view: this }, this.onUpdateZone ); + $( document.body ).on( + 'input change', + '#zone_name, #zone_locations, #zone_postcodes', + { view: this }, + this.onUpdateZone + ); $( document.body ).on( 'click', '.wc-shipping-zone-method-settings', { view: this }, this.onConfigureShippingMethod ); $( document.body ).on( 'click', '.wc-shipping-zone-add-method', { view: this }, this.onAddShippingMethod ); $( document.body ).on( 'wc_backbone_modal_response', this.onConfigureShippingMethodSubmitted ); @@ -128,9 +142,13 @@ // Populate $tbody with the current methods $.each( methods, function( id, rowData ) { if ( 'yes' === rowData.enabled ) { - rowData.enabled_icon = '' + data.strings.yes + ''; + rowData.enabled_icon = '' + + data.strings.yes + + ''; } else { - rowData.enabled_icon = '' + data.strings.no + ''; + rowData.enabled_icon = '' + + data.strings.no + + ''; } view.$el.append( view.rowTemplate( rowData ) ); @@ -138,7 +156,9 @@ var $tr = view.$el.find( 'tr[data-id="' + rowData.instance_id + '"]'); if ( ! rowData.has_settings ) { - $tr.find( '.wc-shipping-zone-method-title > a' ).replaceWith('' + $tr.find( '.wc-shipping-zone-method-title > a' ).text() + '' ); + $tr + .find( '.wc-shipping-zone-method-title > a' ) + .replaceWith('' + $tr.find( '.wc-shipping-zone-method-title > a' ).text() + '' ); var $del = $tr.find( '.wc-shipping-zone-method-delete' ); $tr.find( '.wc-shipping-zone-method-title .row-actions' ).empty().html($del); } @@ -241,7 +261,9 @@ if ( old_position !== new_position ) { methods[ method.instance_id ].method_order = new_position; changes.methods = changes.methods || { methods : {} }; - changes.methods[ method.instance_id ] = _.extend( changes.methods[ method.instance_id ] || {}, { method_order : new_position } ); + changes.methods[ method.instance_id ] = _.extend( + changes.methods[ method.instance_id ] || {}, { method_order : new_position } + ); } } ); @@ -281,30 +303,35 @@ shippingMethodView.block(); // Save method settings via ajax call - $.post( ajaxurl + ( ajaxurl.indexOf( '?' ) > 0 ? '&' : '?' ) + 'action=woocommerce_shipping_zone_methods_save_settings', { - wc_shipping_zones_nonce : data.wc_shipping_zones_nonce, - instance_id : posted_data.instance_id, - data : posted_data - }, function( response, textStatus ) { - if ( 'success' === textStatus && response.success ) { - $( 'table.wc-shipping-zone-methods' ).parent().find( '#woocommerce_errors' ).remove(); + $.post( + ajaxurl + ( ajaxurl.indexOf( '?' ) > 0 ? '&' : '?' ) + 'action=woocommerce_shipping_zone_methods_save_settings', + { + wc_shipping_zones_nonce : data.wc_shipping_zones_nonce, + instance_id : posted_data.instance_id, + data : posted_data + }, + function( response, textStatus ) { + if ( 'success' === textStatus && response.success ) { + $( 'table.wc-shipping-zone-methods' ).parent().find( '#woocommerce_errors' ).remove(); - // If there were errors, prepend the form. - if ( response.data.errors.length > 0 ) { - shippingMethodView.showErrors( response.data.errors ); - } + // If there were errors, prepend the form. + if ( response.data.errors.length > 0 ) { + shippingMethodView.showErrors( response.data.errors ); + } - // Method was saved. Re-render. - if ( _.size( shippingMethodView.model.changes ) ) { - shippingMethodView.model.save(); + // Method was saved. Re-render. + if ( _.size( shippingMethodView.model.changes ) ) { + shippingMethodView.model.save(); + } else { + shippingMethodView.model.onSaveResponse( response, textStatus ); + } } else { - shippingMethodView.model.onSaveResponse( response, textStatus ); + window.alert( data.strings.save_failed ); + shippingMethodView.unblock(); } - } else { - window.alert( data.strings.save_failed ); - shippingMethodView.unblock(); - } - }, 'json' ); + }, + 'json' + ); } }, showErrors: function( errors ) { @@ -343,7 +370,11 @@ if ( response.data.zone_id !== data.zone_id ) { data.zone_id = response.data.zone_id; if ( window.history.pushState ) { - window.history.pushState({}, '', 'admin.php?page=wc-settings&tab=shipping&zone_id=' + response.data.zone_id ); + window.history.pushState( + {}, + '', + 'admin.php?page=wc-settings&tab=shipping&zone_id=' + response.data.zone_id + ); } } // Trigger save if there are changes, or just re-render diff --git a/assets/js/admin/wc-shipping-zones.js b/assets/js/admin/wc-shipping-zones.js index 79026f2d964..093170a1ca9 100644 --- a/assets/js/admin/wc-shipping-zones.js +++ b/assets/js/admin/wc-shipping-zones.js @@ -161,7 +161,9 @@ class_name = 'method_enabled'; } - $method_list.append( '
  • ' + shipping_method.title + '
  • ' ); + $method_list.append( + '
  • ' + shipping_method.title + '
  • ' + ); } ); } else { $method_list.append( '
  • ' + data.strings.no_shipping_methods_offered + '
  • ' ); diff --git a/assets/js/admin/woocommerce_admin.js b/assets/js/admin/woocommerce_admin.js index 51351a52839..5070f3f5508 100644 --- a/assets/js/admin/woocommerce_admin.js +++ b/assets/js/admin/woocommerce_admin.js @@ -12,10 +12,22 @@ if ( 0 === $blankslate.length ) { if ( woocommerce_admin.urls.export_products ) { - $title_action.after('' + woocommerce_admin.strings.export_products + ''); + $title_action.after( + '' + + woocommerce_admin.strings.export_products + + '' + ); } if ( woocommerce_admin.urls.import_products ) { - $title_action.after( '' + woocommerce_admin.strings.import_products + '' ); + $title_action.after( + '' + + woocommerce_admin.strings.import_products + + '' + ); } } else { $title_action.hide(); @@ -60,70 +72,85 @@ $( '.wc_error_tip' ).fadeOut( '100', function() { $( this ).remove(); } ); }) - .on( 'change', '.wc_input_price[type=text], .wc_input_decimal[type=text], .wc-order-totals #refund_amount[type=text]', function() { - var regex, decimalRegex, - decimailPoint = woocommerce_admin.decimal_point; + .on( + 'change', + '.wc_input_price[type=text], .wc_input_decimal[type=text], .wc-order-totals #refund_amount[type=text]', + function() { + var regex, decimalRegex, + decimailPoint = woocommerce_admin.decimal_point; - if ( $( this ).is( '.wc_input_price' ) || $( this ).is( '#refund_amount' ) ) { - decimailPoint = woocommerce_admin.mon_decimal_point; + if ( $( this ).is( '.wc_input_price' ) || $( this ).is( '#refund_amount' ) ) { + decimailPoint = woocommerce_admin.mon_decimal_point; + } + + regex = new RegExp( '[^\-0-9\%\\' + decimailPoint + ']+', 'gi' ); + decimalRegex = new RegExp( '\\' + decimailPoint + '+', 'gi' ); + + var value = $( this ).val(); + var newvalue = value.replace( regex, '' ).replace( decimalRegex, decimailPoint ); + + if ( value !== newvalue ) { + $( this ).val( newvalue ); + } } + ) - regex = new RegExp( '[^\-0-9\%\\' + decimailPoint + ']+', 'gi' ); - decimalRegex = new RegExp( '\\' + decimailPoint + '+', 'gi' ); + .on( + 'keyup', + // eslint-disable-next-line max-len + '.wc_input_price[type=text], .wc_input_decimal[type=text], .wc_input_country_iso[type=text], .wc-order-totals #refund_amount[type=text]', + function() { + var regex, error, decimalRegex; + var checkDecimalNumbers = false; - var value = $( this ).val(); - var newvalue = value.replace( regex, '' ).replace( decimalRegex, decimailPoint ); + if ( $( this ).is( '.wc_input_price' ) || $( this ).is( '#refund_amount' ) ) { + checkDecimalNumbers = true; + regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.mon_decimal_point + ']+', 'gi' ); + decimalRegex = new RegExp( '[^\\' + woocommerce_admin.mon_decimal_point + ']', 'gi' ); + error = 'i18n_mon_decimal_error'; + } else if ( $( this ).is( '.wc_input_country_iso' ) ) { + regex = new RegExp( '([^A-Z])+|(.){3,}', 'im' ); + error = 'i18n_country_iso_error'; + } else { + checkDecimalNumbers = true; + regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.decimal_point + ']+', 'gi' ); + decimalRegex = new RegExp( '[^\\' + woocommerce_admin.decimal_point + ']', 'gi' ); + error = 'i18n_decimal_error'; + } - if ( value !== newvalue ) { - $( this ).val( newvalue ); + var value = $( this ).val(); + var newvalue = value.replace( regex, '' ); + + // Check if newvalue have more than one decimal point. + if ( checkDecimalNumbers && 1 < newvalue.replace( decimalRegex, '' ).length ) { + newvalue = newvalue.replace( decimalRegex, '' ); + } + + if ( value !== newvalue ) { + $( document.body ).triggerHandler( 'wc_add_error_tip', [ $( this ), error ] ); + } else { + $( document.body ).triggerHandler( 'wc_remove_error_tip', [ $( this ), error ] ); + } } - }) - - .on( 'keyup', '.wc_input_price[type=text], .wc_input_decimal[type=text], .wc_input_country_iso[type=text], .wc-order-totals #refund_amount[type=text]', function() { - var regex, error, decimalRegex; - var checkDecimalNumbers = false; - - if ( $( this ).is( '.wc_input_price' ) || $( this ).is( '#refund_amount' ) ) { - checkDecimalNumbers = true; - regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.mon_decimal_point + ']+', 'gi' ); - decimalRegex = new RegExp( '[^\\' + woocommerce_admin.mon_decimal_point + ']', 'gi' ); - error = 'i18n_mon_decimal_error'; - } else if ( $( this ).is( '.wc_input_country_iso' ) ) { - regex = new RegExp( '([^A-Z])+|(.){3,}', 'im' ); - error = 'i18n_country_iso_error'; - } else { - checkDecimalNumbers = true; - regex = new RegExp( '[^\-0-9\%\\' + woocommerce_admin.decimal_point + ']+', 'gi' ); - decimalRegex = new RegExp( '[^\\' + woocommerce_admin.decimal_point + ']', 'gi' ); - error = 'i18n_decimal_error'; - } - - var value = $( this ).val(); - var newvalue = value.replace( regex, '' ); - - // Check if newvalue have more than one decimal point. - if ( checkDecimalNumbers && 1 < newvalue.replace( decimalRegex, '' ).length ) { - newvalue = newvalue.replace( decimalRegex, '' ); - } - - if ( value !== newvalue ) { - $( document.body ).triggerHandler( 'wc_add_error_tip', [ $( this ), error ] ); - } else { - $( document.body ).triggerHandler( 'wc_remove_error_tip', [ $( this ), error ] ); - } - }) + ) .on( 'change', '#_sale_price.wc_input_price[type=text], .wc_input_price[name^=variable_sale_price]', function() { var sale_price_field = $( this ), regular_price_field; if ( sale_price_field.attr( 'name' ).indexOf( 'variable' ) !== -1 ) { - regular_price_field = sale_price_field.parents( '.variable_pricing' ).find( '.wc_input_price[name^=variable_regular_price]' ); + regular_price_field = sale_price_field + .parents( '.variable_pricing' ) + .find( '.wc_input_price[name^=variable_regular_price]' ); } else { regular_price_field = $( '#_regular_price' ); } - var sale_price = parseFloat( window.accounting.unformat( sale_price_field.val(), woocommerce_admin.mon_decimal_point ) ); - var regular_price = parseFloat( window.accounting.unformat( regular_price_field.val(), woocommerce_admin.mon_decimal_point ) ); + var sale_price = parseFloat( + window.accounting.unformat( sale_price_field.val(), woocommerce_admin.mon_decimal_point ) + ); + var regular_price = parseFloat( + window.accounting.unformat( regular_price_field.val(), woocommerce_admin.mon_decimal_point ) + ); if ( sale_price >= regular_price ) { $( this ).val( '' ); @@ -134,13 +161,19 @@ var sale_price_field = $( this ), regular_price_field; if ( sale_price_field.attr( 'name' ).indexOf( 'variable' ) !== -1 ) { - regular_price_field = sale_price_field.parents( '.variable_pricing' ).find( '.wc_input_price[name^=variable_regular_price]' ); + regular_price_field = sale_price_field + .parents( '.variable_pricing' ) + .find( '.wc_input_price[name^=variable_regular_price]' ); } else { regular_price_field = $( '#_regular_price' ); } - var sale_price = parseFloat( window.accounting.unformat( sale_price_field.val(), woocommerce_admin.mon_decimal_point ) ); - var regular_price = parseFloat( window.accounting.unformat( regular_price_field.val(), woocommerce_admin.mon_decimal_point ) ); + var sale_price = parseFloat( + window.accounting.unformat( sale_price_field.val(), woocommerce_admin.mon_decimal_point ) + ); + var regular_price = parseFloat( + window.accounting.unformat( regular_price_field.val(), woocommerce_admin.mon_decimal_point ) + ); if ( sale_price >= regular_price ) { $( document.body ).triggerHandler( 'wc_add_error_tip', [ $(this), 'i18n_sale_less_than_regular_error' ] ); @@ -236,9 +269,13 @@ if ( $( 'tr.last_selected', $this_table ).length > 0 ) { if ( $this_row.index() > $( 'tr.last_selected', $this_table ).index() ) { - $( 'tr', $this_table ).slice( $( 'tr.last_selected', $this_table ).index(), $this_row.index() ).addClass( 'current' ); + $( 'tr', $this_table ) + .slice( $( 'tr.last_selected', $this_table ).index(), $this_row.index() ) + .addClass( 'current' ); } else { - $( 'tr', $this_table ).slice( $this_row.index(), $( 'tr.last_selected', $this_table ).index() + 1 ).addClass( 'current' ); + $( 'tr', $this_table ) + .slice( $this_row.index(), $( 'tr.last_selected', $this_table ).index() + 1 ) + .addClass( 'current' ); } } @@ -260,7 +297,8 @@ }); // Additional cost and Attribute term tables - $( '.woocommerce_page_wc-settings .shippingrows tbody tr:even, table.attributes-table tbody tr:nth-child(odd)' ).addClass( 'alternate' ); + $( '.woocommerce_page_wc-settings .shippingrows tbody tr:even, table.attributes-table tbody tr:nth-child(odd)' ) + .addClass( 'alternate' ); // Show order items on orders page $( document.body ).on( 'click', '.show_order_items', function() { @@ -281,9 +319,15 @@ $( '.hide_options_if_checked' ).each( function() { $( this ).find( 'input:eq(0)' ).change( function() { if ( $( this ).is( ':checked' ) ) { - $( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).hide(); + $( this ) + .closest( 'fieldset, tr' ) + .nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ) + .hide(); } else { - $( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).show(); + $( this ) + .closest( 'fieldset, tr' ) + .nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ) + .show(); } }).change(); }); @@ -291,9 +335,15 @@ $( '.show_options_if_checked' ).each( function() { $( this ).find( 'input:eq(0)' ).change( function() { if ( $( this ).is( ':checked' ) ) { - $( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).show(); + $( this ) + .closest( 'fieldset, tr' ) + .nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ) + .show(); } else { - $( this ).closest( 'fieldset, tr' ).nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ).hide(); + $( this ) + .closest( 'fieldset, tr' ) + .nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' ) + .hide(); } }).change(); }); diff --git a/assets/js/frontend/add-to-cart-variation.js b/assets/js/frontend/add-to-cart-variation.js index ffc851b544f..9c0a7b77e5e 100644 --- a/assets/js/frontend/add-to-cart-variation.js +++ b/assets/js/frontend/add-to-cart-variation.js @@ -72,8 +72,14 @@ */ VariationForm.prototype.onHide = function( event ) { event.preventDefault(); - event.data.variationForm.$form.find( '.single_add_to_cart_button' ).removeClass( 'wc-variation-is-unavailable' ).addClass( 'disabled wc-variation-selection-needed' ); - event.data.variationForm.$form.find( '.woocommerce-variation-add-to-cart' ).removeClass( 'woocommerce-variation-add-to-cart-enabled' ).addClass( 'woocommerce-variation-add-to-cart-disabled' ); + event.data.variationForm.$form + .find( '.single_add_to_cart_button' ) + .removeClass( 'wc-variation-is-unavailable' ) + .addClass( 'disabled wc-variation-selection-needed' ); + event.data.variationForm.$form + .find( '.woocommerce-variation-add-to-cart' ) + .removeClass( 'woocommerce-variation-add-to-cart-enabled' ) + .addClass( 'woocommerce-variation-add-to-cart-disabled' ); }; /** @@ -82,11 +88,22 @@ VariationForm.prototype.onShow = function( event, variation, purchasable ) { event.preventDefault(); if ( purchasable ) { - event.data.variationForm.$form.find( '.single_add_to_cart_button' ).removeClass( 'disabled wc-variation-selection-needed wc-variation-is-unavailable' ); - event.data.variationForm.$form.find( '.woocommerce-variation-add-to-cart' ).removeClass( 'woocommerce-variation-add-to-cart-disabled' ).addClass( 'woocommerce-variation-add-to-cart-enabled' ); + event.data.variationForm.$form + .find( '.single_add_to_cart_button' ) + .removeClass( 'disabled wc-variation-selection-needed wc-variation-is-unavailable' ); + event.data.variationForm.$form + .find( '.woocommerce-variation-add-to-cart' ) + .removeClass( 'woocommerce-variation-add-to-cart-disabled' ) + .addClass( 'woocommerce-variation-add-to-cart-enabled' ); } else { - event.data.variationForm.$form.find( '.single_add_to_cart_button' ).removeClass( 'wc-variation-selection-needed' ).addClass( 'disabled wc-variation-is-unavailable' ); - event.data.variationForm.$form.find( '.woocommerce-variation-add-to-cart' ).removeClass( 'woocommerce-variation-add-to-cart-enabled' ).addClass( 'woocommerce-variation-add-to-cart-disabled' ); + event.data.variationForm.$form + .find( '.single_add_to_cart_button' ) + .removeClass( 'wc-variation-selection-needed' ) + .addClass( 'disabled wc-variation-is-unavailable' ); + event.data.variationForm.$form + .find( '.woocommerce-variation-add-to-cart' ) + .removeClass( 'woocommerce-variation-add-to-cart-enabled' ) + .addClass( 'woocommerce-variation-add-to-cart-disabled' ); } // If present, the media element library needs initialized on the variation description. @@ -123,8 +140,12 @@ VariationForm.prototype.onResetDisplayedVariation = function( event ) { var form = event.data.variationForm; form.$product.find( '.product_meta' ).find( '.sku' ).wc_reset_content(); - form.$product.find( '.product_weight, .woocommerce-product-attributes-item--weight .woocommerce-product-attributes-item__value' ).wc_reset_content(); - form.$product.find( '.product_dimensions, .woocommerce-product-attributes-item--dimensions .woocommerce-product-attributes-item__value' ).wc_reset_content(); + form.$product + .find( '.product_weight, .woocommerce-product-attributes-item--weight .woocommerce-product-attributes-item__value' ) + .wc_reset_content(); + form.$product + .find( '.product_dimensions, .woocommerce-product-attributes-item--dimensions .woocommerce-product-attributes-item__value' ) + .wc_reset_content(); form.$form.trigger( 'reset_image' ); form.$singleVariation.slideUp( 200 ).trigger( 'hide_variation' ); }; @@ -164,7 +185,13 @@ attributes.chosenCount = 0; if ( ! form.loading ) { - form.$form.find( '.single_variation' ).after( '

    ' + wc_add_to_cart_variation_params.i18n_no_matching_variations_text + '

    ' ); + form.$form + .find( '.single_variation' ) + .after( + '

    ' + + wc_add_to_cart_variation_params.i18n_no_matching_variations_text + + '

    ' + ); form.$form.find( '.wc-no-matching-variations' ).slideDown( 200 ); } } @@ -186,7 +213,13 @@ attributes.chosenCount = 0; if ( ! form.loading ) { - form.$form.find( '.single_variation' ).after( '

    ' + wc_add_to_cart_variation_params.i18n_no_matching_variations_text + '

    ' ); + form.$form + .find( '.single_variation' ) + .after( + '

    ' + + wc_add_to_cart_variation_params.i18n_no_matching_variations_text + + '

    ' + ); form.$form.find( '.wc-no-matching-variations' ).slideDown( 200 ); } } @@ -206,8 +239,12 @@ VariationForm.prototype.onFoundVariation = function( event, variation ) { var form = event.data.variationForm, $sku = form.$product.find( '.product_meta' ).find( '.sku' ), - $weight = form.$product.find( '.product_weight, .woocommerce-product-attributes-item--weight .woocommerce-product-attributes-item__value' ), - $dimensions = form.$product.find( '.product_dimensions, .woocommerce-product-attributes-item--dimensions .woocommerce-product-attributes-item__value' ), + $weight = form.$product.find( + '.product_weight, .woocommerce-product-attributes-item--weight .woocommerce-product-attributes-item__value' + ), + $dimensions = form.$product.find( + '.product_dimensions, .woocommerce-product-attributes-item--dimensions .woocommerce-product-attributes-item__value' + ), $qty = form.$singleVariationWrap.find( '.quantity' ), purchasable = true, variation_id = '', @@ -333,7 +370,11 @@ refSelect.find( 'option' ).removeAttr( 'disabled attached' ).removeAttr( 'selected' ); - current_attr_select.data( 'attribute_options', refSelect.find( 'option' + option_gt_filter ).get() ); // Legacy data attribute. + // Legacy data attribute. + current_attr_select.data( + 'attribute_options', + refSelect.find( 'option' + option_gt_filter ).get() + ); current_attr_select.data( 'attribute_html', refSelect.html() ); } @@ -597,7 +638,9 @@ $product_gallery = $product.find( '.images' ), $gallery_nav = $product.find( '.flex-control-nav' ), $gallery_img = $gallery_nav.find( 'li:eq(0) img' ), - $product_img_wrap = $product_gallery.find( '.woocommerce-product-gallery__image, .woocommerce-product-gallery__image--placeholder' ).eq( 0 ), + $product_img_wrap = $product_gallery + .find( '.woocommerce-product-gallery__image, .woocommerce-product-gallery__image--placeholder' ) + .eq( 0 ), $product_img = $product_img_wrap.find( '.wp-post-image' ), $product_link = $product_img_wrap.find( 'a' ).eq( 0 ); @@ -658,7 +701,9 @@ $product_gallery = $product.find( '.images' ), $gallery_nav = $product.find( '.flex-control-nav' ), $gallery_img = $gallery_nav.find( 'li:eq(0) img' ), - $product_img_wrap = $product_gallery.find( '.woocommerce-product-gallery__image, .woocommerce-product-gallery__image--placeholder' ).eq( 0 ), + $product_img_wrap = $product_gallery + .find( '.woocommerce-product-gallery__image, .woocommerce-product-gallery__image--placeholder' ) + .eq( 0 ), $product_img = $product_img_wrap.find( '.wp-post-image' ), $product_link = $product_img_wrap.find( 'a' ).eq( 0 ); diff --git a/assets/js/frontend/cart.js b/assets/js/frontend/cart.js index 816863ed454..ec1d843d31d 100644 --- a/assets/js/frontend/cart.js +++ b/assets/js/frontend/cart.js @@ -134,7 +134,9 @@ jQuery( function( $ ) { */ var show_notice = function( html_element, $target ) { if ( ! $target ) { - $target = $( '.woocommerce-notices-wrapper:first' ) || $( '.cart-empty' ).closest( '.woocommerce' ) || $( '.woocommerce-cart-form' ); + $target = $( '.woocommerce-notices-wrapper:first' ) || + $( '.cart-empty' ).closest( '.woocommerce' ) || + $( '.woocommerce-cart-form' ); } $target.prepend( html_element ); }; @@ -188,6 +190,7 @@ jQuery( function( $ ) { shipping_method_selected: function() { var shipping_methods = {}; + // eslint-disable-next-line max-len $( 'select.shipping_method, :input[name^=shipping_method][type=radio]:checked, :input[name^=shipping_method][type=hidden]' ).each( function() { shipping_methods[ $( this ).data( 'index' ) ] = $( this ).val(); } ); diff --git a/assets/js/frontend/tokenization-form.js b/assets/js/frontend/tokenization-form.js index 15e9054b7c4..3a5a8bffbad 100644 --- a/assets/js/frontend/tokenization-form.js +++ b/assets/js/frontend/tokenization-form.js @@ -22,7 +22,12 @@ jQuery( function( $ ) { this.hideSaveNewCheckbox = this.hideSaveNewCheckbox.bind( this ); // When a radio button is changed, make sure to show/hide our new CC info area. - this.$target.on( 'click change', ':input.woocommerce-SavedPaymentMethods-tokenInput', { tokenizationForm: this }, this.onTokenChange ); + this.$target.on( + 'click change', + ':input.woocommerce-SavedPaymentMethods-tokenInput', + { tokenizationForm: this }, + this.onTokenChange + ); // OR if create account is checked. $( 'input#createaccount' ).change( { tokenizationForm: this }, this.onCreateAccountChange ); diff --git a/package-lock.json b/package-lock.json index 8319d78e6ae..382e2bf58d0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6789,16 +6789,6 @@ "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", "dev": true }, - "cli": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/cli/-/cli-1.0.1.tgz", - "integrity": "sha1-IoF1NPJL+klQw01TLUjsvGIbjBQ=", - "dev": true, - "requires": { - "exit": "0.1.2", - "glob": "^7.1.1" - } - }, "cli-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", @@ -7105,15 +7095,6 @@ "json5": "^2.1.1" } }, - "console-browserify": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", - "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", - "dev": true, - "requires": { - "date-now": "^0.1.4" - } - }, "console-control-strings": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", @@ -7356,12 +7337,6 @@ "integrity": "sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==", "dev": true }, - "date-now": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", - "integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=", - "dev": true - }, "dateformat": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.12.tgz", @@ -7770,12 +7745,6 @@ "once": "^1.4.0" } }, - "entities": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.0.0.tgz", - "integrity": "sha1-sph6o4ITR/zeZCsk/fyeT7cSvyY=", - "dev": true - }, "error": { "version": "7.0.2", "resolved": "https://registry.npmjs.org/error/-/error-7.0.2.tgz", @@ -9910,17 +9879,6 @@ "maxmin": "^2.1.0" } }, - "grunt-contrib-jshint": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/grunt-contrib-jshint/-/grunt-contrib-jshint-2.1.0.tgz", - "integrity": "sha512-65S2/C/6RfjY/umTxfwXXn+wVvaYmykHkHSsW6Q6rhkbv3oudTEgqnFFZvWzWCoHUb+3GMZLbP3oSrNyvshmIQ==", - "dev": true, - "requires": { - "chalk": "^2.4.2", - "hooker": "^0.2.3", - "jshint": "~2.10.2" - } - }, "grunt-contrib-uglify": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/grunt-contrib-uglify/-/grunt-contrib-uglify-4.0.1.tgz", @@ -10288,6 +10246,190 @@ "chalk": "^2.4.2" } }, + "gruntify-eslint": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/gruntify-eslint/-/gruntify-eslint-5.0.0.tgz", + "integrity": "sha512-pa2sXHK9+U4dCGdGSIMkpJARNwRStdLBsddNxmSHSSWROUdhWMrXvFWm6pj48zJhyV3Qy068VIuF1seYIvc0cw==", + "dev": true, + "requires": { + "eslint": "^5.0.0" + }, + "dependencies": { + "acorn": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz", + "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==", + "dev": true + }, + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "dev": true, + "requires": { + "restore-cursor": "^2.0.0" + } + }, + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "eslint": { + "version": "5.16.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.16.0.tgz", + "integrity": "sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "ajv": "^6.9.1", + "chalk": "^2.1.0", + "cross-spawn": "^6.0.5", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "eslint-scope": "^4.0.3", + "eslint-utils": "^1.3.1", + "eslint-visitor-keys": "^1.0.0", + "espree": "^5.0.1", + "esquery": "^1.0.1", + "esutils": "^2.0.2", + "file-entry-cache": "^5.0.1", + "functional-red-black-tree": "^1.0.1", + "glob": "^7.1.2", + "globals": "^11.7.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "inquirer": "^6.2.2", + "js-yaml": "^3.13.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.3.0", + "lodash": "^4.17.11", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "natural-compare": "^1.4.0", + "optionator": "^0.8.2", + "path-is-inside": "^1.0.2", + "progress": "^2.0.0", + "regexpp": "^2.0.1", + "semver": "^5.5.1", + "strip-ansi": "^4.0.0", + "strip-json-comments": "^2.0.1", + "table": "^5.2.3", + "text-table": "^0.2.0" + } + }, + "eslint-scope": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz", + "integrity": "sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, + "espree": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-5.0.1.tgz", + "integrity": "sha512-qWAZcWh4XE/RwzLJejfcofscgMc9CamR6Tn1+XRXNzrvUSSbiAjGOI/fggztjIi7y9VLPqnICMIPiGyr8JaZ0A==", + "dev": true, + "requires": { + "acorn": "^6.0.7", + "acorn-jsx": "^5.0.0", + "eslint-visitor-keys": "^1.0.0" + } + }, + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true + }, + "inquirer": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.2.tgz", + "integrity": "sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ==", + "dev": true, + "requires": { + "ansi-escapes": "^3.2.0", + "chalk": "^2.4.2", + "cli-cursor": "^2.1.0", + "cli-width": "^2.0.0", + "external-editor": "^3.0.3", + "figures": "^2.0.0", + "lodash": "^4.17.12", + "mute-stream": "0.0.7", + "run-async": "^2.2.0", + "rxjs": "^6.4.0", + "string-width": "^2.1.0", + "strip-ansi": "^5.1.0", + "through": "^2.3.6" + }, + "dependencies": { + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "mute-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", + "dev": true + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + } + } + } + }, "gzip-size": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-3.0.0.tgz", @@ -10477,39 +10619,6 @@ "integrity": "sha512-1qYz89hW3lFDEazhjW0yVAV87lw8lVkrJocr72XmBkMKsoSVJCQx3W8BXsC7hO2qAt8BoVjYjtAcZ9perqGnNg==", "dev": true }, - "htmlparser2": { - "version": "3.8.3", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.3.tgz", - "integrity": "sha1-mWwosZFRaovoZQGn15dX5ccMEGg=", - "dev": true, - "requires": { - "domelementtype": "1", - "domhandler": "2.3", - "domutils": "1.5", - "entities": "1.0", - "readable-stream": "1.1" - }, - "dependencies": { - "readable-stream": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", - "dev": true - } - } - }, "http-parser-js": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.0.tgz", @@ -11158,12 +11267,6 @@ "dev": true, "optional": true }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", - "dev": true - }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -13361,30 +13464,6 @@ "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, - "jshint": { - "version": "2.10.2", - "resolved": "https://registry.npmjs.org/jshint/-/jshint-2.10.2.tgz", - "integrity": "sha512-e7KZgCSXMJxznE/4WULzybCMNXNAd/bf5TSrvVEq78Q/K8ZwFpmBqQeDtNiHc3l49nV4E/+YeHU/JZjSUIrLAA==", - "dev": true, - "requires": { - "cli": "~1.0.0", - "console-browserify": "1.1.x", - "exit": "0.1.x", - "htmlparser2": "3.8.x", - "lodash": "~4.17.11", - "minimatch": "~3.0.2", - "shelljs": "0.3.x", - "strip-json-comments": "1.0.x" - }, - "dependencies": { - "strip-json-comments": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-1.0.4.tgz", - "integrity": "sha1-HhX7ysl9Pumb8tc7TGVrCCu6+5E=", - "dev": true - } - } - }, "json-parse-better-errors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", @@ -15114,6 +15193,12 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "dev": true + }, "path-key": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", @@ -18379,12 +18464,6 @@ "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", "dev": true }, - "shelljs": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.3.0.tgz", - "integrity": "sha1-NZbmMHp4FUT1kfN9phg2DzHbV7E=", - "dev": true - }, "shellwords": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", diff --git a/package.json b/package.json index cbfa3a03b50..d39aab8703b 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,6 @@ "grunt-contrib-concat": "1.0.1", "grunt-contrib-copy": "1.0.0", "grunt-contrib-cssmin": "3.0.0", - "grunt-contrib-jshint": "2.1.0", "grunt-contrib-uglify": "4.0.1", "grunt-contrib-watch": "1.1.0", "grunt-phpcs": "0.4.0", @@ -53,6 +52,7 @@ "grunt-sass": "3.1.0", "grunt-shell": "3.0.1", "grunt-stylelint": "0.14.0", + "gruntify-eslint": "5.0.0", "husky": "4.2.5", "istanbul": "1.0.0-alpha.2", "jest": "25.1.0",