diff --git a/.eslintrc b/.eslintrc index e1692a0e..f212dfc5 100644 --- a/.eslintrc +++ b/.eslintrc @@ -6,6 +6,7 @@ "rules": { "max-len": [2, 80, 2, {"ignoreUrls": true}], "indent": [2, 4, {"SwitchCase": 1}], + "semi": ["error", "always"], "no-trailing-spaces": 2, "no-multi-spaces": 2, "array-bracket-spacing": 2, diff --git a/package.json b/package.json index e9caae8c..37c8414b 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "script-loader": "^0.7.0", "string-replace-webpack-plugin": "^0.0.5", "sugar-date": "2.0.4", - "webpack": "^2.5.1", + "webpack": "^2.6.0", "webpack-dev-server": "^2.4.5" }, "dependencies": {}, diff --git a/src/array.js b/src/array.js index db04e9ef..bd9662e5 100644 --- a/src/array.js +++ b/src/array.js @@ -19,4 +19,4 @@ export const has = (arr, val, caseSensitive) => { } } return false; -} +}; diff --git a/src/dom.js b/src/dom.js index cc3cb9de..04fd3a72 100644 --- a/src/dom.js +++ b/src/dom.js @@ -18,7 +18,7 @@ export const getText = (node) => { return trim(node.innerText); } return trim(node.textContent); -} +}; /** * Returns the first text node contained in the supplied node @@ -32,7 +32,7 @@ export const getFirstTextNode = (node) => { return n.data; } } -} +}; /** * Creates an html element with given collection of attributes @@ -56,7 +56,7 @@ export const createElm = (...args) => { } } return el; -} +}; /** * Removes passed node from DOM @@ -87,7 +87,7 @@ export const hasClass = (ele, cls) => { return ele.classList.contains(cls); } return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')); -} +}; /** * Adds the specified class to the passed element @@ -110,7 +110,7 @@ export const addClass = (ele, cls) => { else if (!hasClass(ele, cls)) { ele.className += ' ' + cls; } -} +}; /** * Removes the specified class to the passed element @@ -128,7 +128,7 @@ export const removeClass = (ele, cls) => { } let reg = new RegExp('(\\s|^)' + cls + '(\\s|$)', 'g'); ele.className = ele.className.replace(reg, ''); -} +}; /** * Creates and returns an option element @@ -144,7 +144,7 @@ export const createOpt = (text, value, isSel) => { createElm('option', ['value', value]); opt.appendChild(createText(text)); return opt; -} +}; /** * Creates and returns a checklist item @@ -168,7 +168,7 @@ export const createCheckItem = (id, chkValue, labelText) => { li.label = label; li.check = check; return li; -} +}; /** * Returns the element matching the supplied Id diff --git a/src/modules/dateType.js b/src/modules/dateType.js index 6657792b..6485d4f2 100644 --- a/src/modules/dateType.js +++ b/src/modules/dateType.js @@ -101,7 +101,7 @@ export class DateType extends Feature { * @returns {String} Locale code (ie: 'en-us') */ getLocale(colIndex) { - return this.getOptions(colIndex).locale || this.locale + return this.getOptions(colIndex).locale || this.locale; } /** diff --git a/src/number.js b/src/number.js index e076b85c..92821ccb 100644 --- a/src/number.js +++ b/src/number.js @@ -26,4 +26,4 @@ export const parse = (value, decimal = '.') => { // This will fail silently return !isNaN(unformatted) ? unformatted : 0; -} +}; diff --git a/src/sort.js b/src/sort.js index ab9f1299..aedff276 100644 --- a/src/sort.js +++ b/src/sort.js @@ -15,7 +15,7 @@ export const ignoreCase = (a, b) => { let x = a.toLowerCase(); let y = b.toLowerCase(); return x < y ? -1 : (x > y ? 1 : 0); -} +}; /** * Compare function for sorting passed numbers in ascending manner @@ -63,8 +63,8 @@ export const sortNumberStr = (compareFn, decimal = ',') => { let num1 = parseNb(numStr1, decimal); let num2 = parseNb(numStr2, decimal); return compareFn(num1, num2); - } -} + }; +}; /** * Curried compare function for sorting passed formatted dates in desired @@ -78,5 +78,5 @@ export const sortDateStr = (compareFn, locale = 'en-us') => { let date1 = SugarDate.create(dateStr1, locale); let date2 = SugarDate.create(dateStr2, locale); return compareFn(date1, date2); - } -} + }; +}; diff --git a/src/string.js b/src/string.js index da9da38d..55319545 100644 --- a/src/string.js +++ b/src/string.js @@ -14,7 +14,7 @@ export const trim = (text) => { return text.trim(); } return text.replace(/^\s*|\s*$/g, ''); -} +}; /** * Checks if passed string is empty @@ -32,7 +32,7 @@ export const rgxEsc = (text) => { let chars = /[-\/\\^$*+?.()|[\]{}]/g; let escMatch = '\\$&'; return String(text).replace(chars, escMatch); -} +}; /** * Returns passed string as lowercase if caseSensitive flag set false. By @@ -45,7 +45,7 @@ export const matchCase = (text, caseSensitive = false) => { return text.toLowerCase(); } return text; -} +}; /** * Checks if passed data contains the searched term @@ -73,4 +73,4 @@ export const contains = (term, data, exactMatch = false, caseSensitive = false, regexp = new RegExp(rgxEsc(term), modifier); } return regexp.test(data); -} +}; diff --git a/src/tablefilter.js b/src/tablefilter.js index cc10a8eb..5322e4cd 100644 --- a/src/tablefilter.js +++ b/src/tablefilter.js @@ -8,7 +8,7 @@ import {isEmpty as isEmptyString} from './string'; import { isArray, isEmpty, isFn, isNumber, isObj, isString, isUndef, EMPTY_FN } from './types'; -import {parse as parseNb} from './number' +import {parse as parseNb} from './number'; import {root} from './root'; import {Emitter} from './emitter'; diff --git a/test/test-active-columns.js b/test/test-active-columns.js index 4bab2f55..c5ea3764 100644 --- a/test/test-active-columns.js +++ b/test/test-active-columns.js @@ -138,7 +138,7 @@ // setup var clearActiveColumns = markActiveColumns.clearActiveColumns; var hit = 0; - markActiveColumns.clearActiveColumns = function() { hit++ }; + markActiveColumns.clearActiveColumns = function() { hit++; }; markActiveColumns.initialized = false; // act diff --git a/test/test-alternate-rows.js b/test/test-alternate-rows.js index cb86c955..a84379ab 100644 --- a/test/test-alternate-rows.js +++ b/test/test-alternate-rows.js @@ -110,7 +110,7 @@ test('Cannot init if initialised', function() { // setup var processAll = altRows.processAll; var hit = 0; - altRows.processAll = function() { hit++ }; + altRows.processAll = function() { hit++; }; altRows.initialized = true; // act @@ -126,7 +126,7 @@ test('Cannot processAll if not enabled', function() { // setup var setRowBg = altRows.setRowBg; var hit = 0; - altRows.setRowBg = function() { hit++ }; + altRows.setRowBg = function() { hit++; }; altRows.enabled = false; // act @@ -142,7 +142,7 @@ test('Cannot setRowBg if not enabled', function() { // setup var removeRowBg = altRows.removeRowBg; var hit = 0; - altRows.removeRowBg = function() { hit++ }; + altRows.removeRowBg = function() { hit++; }; altRows.enabled = false; // act @@ -171,7 +171,7 @@ test('Cannot destroy if not initialised', function() { // setup var getRowsNb = altRows.tf.getRowsNb; var hit = 0; - altRows.tf.getRowsNb = function() { hit++ }; + altRows.tf.getRowsNb = function() { hit++; }; altRows.initialized = false; // act diff --git a/test/test-cell-parser.js b/test/test-cell-parser.js index d4fad8ff..f4d55ffb 100644 --- a/test/test-cell-parser.js +++ b/test/test-cell-parser.js @@ -21,7 +21,7 @@ test('Sanity checks', function() { deepEqual(tf instanceof TableFilter, true, 'TableFilter instanciated'); deepEqual(tf.cellParser.cols.length, 1, - 'Columns implementing cell parser') + 'Columns implementing cell parser'); deepEqual(typeof tf.cellParser.parse, 'function', 'Parse function'); deepEqual( tf.getFilterElement(0).nodeName, 'SELECT', 'Expected filter type'); @@ -60,7 +60,7 @@ tf.cellParser.cols = []; tf.cellParser.parse = function() { hit++; - } + }; // act tf.getCellValue(cell); diff --git a/test/test-checklist.js b/test/test-checklist.js index 15120ddb..1971d964 100644 --- a/test/test-checklist.js +++ b/test/test-checklist.js @@ -41,7 +41,7 @@ test('Can refresh all drop-down filters', function() { tf.clearFilters(); var build = checkList.build; var hit = 0; - checkList.build = function() { hit++ }; + checkList.build = function() { hit++; }; //act checkList.refreshAll(); diff --git a/test/test-dropdown.js b/test/test-dropdown.js index 4f0773a0..fc6f515e 100644 --- a/test/test-dropdown.js +++ b/test/test-dropdown.js @@ -41,7 +41,7 @@ test('Can refresh all drop-down filters', function() { tf.clearFilters(); var build = dropdown.build; var hit = 0; - dropdown.build = function() { hit++ }; + dropdown.build = function() { hit++; }; //act dropdown.refreshAll(); diff --git a/test/test-hash.js b/test/test-hash.js index c331c6ec..f4527ea4 100644 --- a/test/test-hash.js +++ b/test/test-hash.js @@ -46,7 +46,7 @@ test('Can parse a URL hash', function() { // URL-encoded version of: // #{"page":2,"page_length":4,"col_2":{"flt":">500"}} var hashStr = '#%7B%22page%22%3A2%2C%22page_length%22%3A4'+ - '%2C%22col_2%22%3A%7B%22flt%22%3A%22%3E500%22%7D%7D' + '%2C%22col_2%22%3A%7B%22flt%22%3A%22%3E500%22%7D%7D'; // act var result = hash.parse(hashStr); diff --git a/test/test-loader.js b/test/test-loader.js index bd90c92f..4c88c112 100644 --- a/test/test-loader.js +++ b/test/test-loader.js @@ -18,7 +18,7 @@ test('Does not init if initialised', function() { var hit = 0; loader.show = function() { hit++; - } + }; // act loader.init(); diff --git a/test/test-no-rows.js b/test/test-no-rows.js index 642dc212..40ef963f 100644 --- a/test/test-no-rows.js +++ b/test/test-no-rows.js @@ -3,7 +3,7 @@ module('TableFilter with no rows'); test('throws when no rows', function() { throws( - function() { new TableFilter('demo') }, + function() { new TableFilter('demo'); }, Error, 'Throws Error when DOM table does not contain rows' ); diff --git a/test/test.js b/test/test.js index 6edbbba4..b0e4e951 100644 --- a/test/test.js +++ b/test/test.js @@ -78,7 +78,7 @@ // setup var importFile = tf1.import; var hit = 0; - tf1.import = function() { hit++ }; + tf1.import = function() { hit++; }; tf1.initialized = true; // act