Upgrade ESLint and fix issues

pull/265/head
Glen Cheney il y a 5 ans
Parent 0c8c350868
révision 4884e668d8

@ -1,4 +1,30 @@
module.exports = {
extends: '@odopod',
};
extends: 'airbnb-base',
env: {
node: true,
browser: true,
},
rules: {
// We like _private methods and variables. It's easier to refactor code
// when you know other components shouldn't be using private methods + props.
'no-underscore-dangle': 'off',
// Prefer template is nice, but tedious for things like: width + 'px'
'prefer-template': 'off',
// Allow + and - in the same line.
'no-mixed-operators': 'off',
// Shadowing is a nice language feature. Naming is hard.
'no-shadow': 'off',
// Make inheritance annoying sometimes.
'class-methods-use-this': 'off',
// Allow `i++` in loops.
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
// Allow reassigning properties of objects.
'no-param-reassign': ['error', { props: false }],
},
};

14
dist/shuffle.js vendored

@ -991,10 +991,16 @@
// If column width is a string, treat is as a selector and search for the
// sizer element within the outermost container
if (typeof option === 'string') {
return this.element.querySelector(option); // Check for an element
} else if (option && option.nodeType && option.nodeType === 1) {
return option; // Check for jQuery object
} else if (option && option.jquery) {
return this.element.querySelector(option);
} // Check for an element
if (option && option.nodeType && option.nodeType === 1) {
return option;
} // Check for jQuery object
if (option && option.jquery) {
return option[0];
}

Diff de fichier supprimé car une ou plusieurs lignes sont trop longues

Diff de fichier supprimé car une ou plusieurs lignes sont trop longues

@ -991,10 +991,16 @@
// If column width is a string, treat is as a selector and search for the
// sizer element within the outermost container
if (typeof option === 'string') {
return this.element.querySelector(option); // Check for an element
} else if (option && option.nodeType && option.nodeType === 1) {
return option; // Check for jQuery object
} else if (option && option.jquery) {
return this.element.querySelector(option);
} // Check for an element
if (option && option.nodeType && option.nodeType === 1) {
return option;
} // Check for jQuery object
if (option && option.jquery) {
return option[0];
}

Diff de fichier supprimé car une ou plusieurs lignes sont trop longues

Diff de fichier supprimé car une ou plusieurs lignes sont trop longues

@ -51,13 +51,14 @@
"devDependencies": {
"@babel/core": "^7.1.6",
"@babel/preset-env": "^7.1.6",
"@odopod/eslint-config": "^2.0.0",
"autoprefixer": "^9.1.2",
"chai": "^4.0.1",
"chai-dom": "^1.7.0",
"core-js": "^2.5.3",
"cssnano": "^4.0.5",
"eslint": "^4.11.0",
"eslint": "^5.9.0",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-plugin-import": "^2.14.0",
"gulp": "^4.0.0",
"gulp-mocha-phantomjs": "^0.12.2",
"gulp-postcss": "^8.0.0",

@ -19,15 +19,15 @@ export default function getNumberStyle(
// Support IE<=11 and W3C spec.
if (!testComputedSize() && style === 'width') {
value += getNumber(styles.paddingLeft) +
getNumber(styles.paddingRight) +
getNumber(styles.borderLeftWidth) +
getNumber(styles.borderRightWidth);
value += getNumber(styles.paddingLeft)
+ getNumber(styles.paddingRight)
+ getNumber(styles.borderLeftWidth)
+ getNumber(styles.borderRightWidth);
} else if (!testComputedSize() && style === 'height') {
value += getNumber(styles.paddingTop) +
getNumber(styles.paddingBottom) +
getNumber(styles.borderTopWidth) +
getNumber(styles.borderBottomWidth);
value += getNumber(styles.paddingTop)
+ getNumber(styles.paddingBottom)
+ getNumber(styles.borderTopWidth)
+ getNumber(styles.borderBottomWidth);
}
return value;

@ -33,7 +33,7 @@ export default class Rect {
*/
static intersects(a, b) {
return (
a.left < b.left + b.width && b.left < a.left + a.width &&
a.top < b.top + b.height && b.top < a.top + a.height);
a.left < b.left + b.width && b.left < a.left + a.width
&& a.top < b.top + b.height && b.top < a.top + a.height);
}
}

@ -125,9 +125,9 @@ class Shuffle extends TinyEmitter {
*/
_getResizeFunction() {
const resizeFunction = this._handleResize.bind(this);
return this.options.throttle ?
this.options.throttle(resizeFunction, this.options.throttleTime) :
resizeFunction;
return this.options.throttle
? this.options.throttle(resizeFunction, this.options.throttleTime)
: resizeFunction;
}
/**
@ -141,13 +141,15 @@ class Shuffle extends TinyEmitter {
// sizer element within the outermost container
if (typeof option === 'string') {
return this.element.querySelector(option);
}
// Check for an element
} else if (option && option.nodeType && option.nodeType === 1) {
if (option && option.nodeType && option.nodeType === 1) {
return option;
}
// Check for jQuery object
} else if (option && option.jquery) {
if (option && option.jquery) {
return option[0];
}
@ -245,9 +247,9 @@ class Shuffle extends TinyEmitter {
// Check each element's data-groups attribute against the given category.
const attr = element.getAttribute('data-' + Shuffle.FILTER_ATTRIBUTE_KEY);
const keys = this.options.delimiter ?
attr.split(this.options.delimiter) :
JSON.parse(attr);
const keys = this.options.delimiter
? attr.split(this.options.delimiter)
: JSON.parse(attr);
function testCategory(category) {
return keys.includes(category);
@ -428,8 +430,8 @@ class Shuffle extends TinyEmitter {
let calculatedColumns = (containerWidth + gutter) / columnWidth;
// Widths given from getStyles are not precise enough...
if (Math.abs(Math.round(calculatedColumns) - calculatedColumns) <
this.options.columnThreshold) {
if (Math.abs(Math.round(calculatedColumns) - calculatedColumns)
< this.options.columnThreshold) {
// e.g. calculatedColumns = 11.998876
calculatedColumns = Math.round(calculatedColumns);
}

Chargement…
Annuler
Enregistrer