I keep receiving the following error, and I am unable to find documentation on what it means. I know it involves strict javascript formatting, and I was wanting to resolve it by abiding by the formating.
JSCS: Operator / should stick to following expression.
//Slow Scroll
if ( window.addEventListener ) window.addEventListener('DOMMouseScroll', wheel, false);
window.onmousewheel = document.onmousewheel = wheel;
function wheel(event) {
var delta = 0;
if ( event.wheelDelta ) delta = event.wheelDelta / 120;
else if ( event.detail ) delta = -event.detail / 3;
handle ( delta );
if ( event.preventDefault ) event.preventDefault();
event.returnValue = false;
}
function handle(delta) {
var time = 500,
distance = 300;
$( 'html, body' ).stop().animate(
{
scrollTop: $( window ).scrollTop() - ( distance * delta )
},
time);
}
{
"disallowCommaBeforeLineBreak": null,
"disallowDanglingUnderscores": true,
"disallowEmptyBlocks": true,
"disallowImplicitTypeConversion": [ "string" ],
"disallowKeywordsOnNewLine": [ "else" ],
"disallowKeywords": [ "with" ],
"disallowMixedSpacesAndTabs": true,
"disallowMultipleLineBreaks": true,
"disallowMultipleLineStrings": true,
"disallowMultipleVarDecl": null,
"disallowPaddingNewlinesInBlocks": null,
"disallowQuotedKeysInObjects": true,
"disallowSpaceAfterBinaryOperators": true,
"disallowSpaceAfterKeywords": [ "for", "while", "do", "switch" ],
"disallowSpaceAfterLineComment": true,
"disallowSpaceAfterObjectKeys": null,
"disallowSpaceAfterPrefixUnaryOperators": true,
"disallowSpaceBeforeBinaryOperators": null,
"disallowSpaceBeforeBlockStatements": null,
"disallowSpaceBeforePostfixUnaryOperators": true,
"disallowSpacesInAnonymousFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInConditionalExpression": null,
"disallowSpacesInFunctionDeclaration": null,
"disallowSpacesInFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInNamedFunctionExpression": null,
"disallowSpacesInsideArrayBrackets": null,
"disallowSpacesInsideObjectBrackets": null,
"disallowSpacesInsideParentheses": null,
"disallowTrailingComma": null,
"disallowTrailingWhitespace": true,
"disallowYodaConditions": true,
"maximumLineLength": 120,
"requireAlignedObjectValues": "skipWithFunction",
"requireBlocksOnNewline": true,
"requireCamelCaseOrUpperCaseIdentifiers": "ignoreProperties",
"requireCapitalizedConstructors": true,
"requireCommaBeforeLineBreak": true,
"requireCurlyBraces": [ "if", "else", "for", "while", "do", "try", "catch" ],
"requireDotNotation": true,
"requireKeywordsOnNewLine": null,
"requireLineFeedAtFileEnd": true,
"requireMultipleVarDecl": true,
"requireOperatorBeforeLineBreak": true,
"requirePaddingNewlinesInBlocks": true,
"requireParenthesesAroundIIFE": true,
"requireSpaceAfterBinaryOperators": null,
"requireSpaceAfterKeywords": [ "if", "else", "return", "try", "catch" ],
"requireSpaceAfterLineComment": null,
"requireSpaceAfterObjectKeys": true,
"requireSpaceAfterPrefixUnaryOperators": null,
"requireSpaceBeforeBinaryOperators": true,
"requireSpaceBeforeBlockStatements": true,
"requireSpaceBeforePostfixUnaryOperators": null,
"requireSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"requireSpacesInConditionalExpression": true,
"requireSpacesInFunctionDeclaration": {
"beforeOpeningRoundBrace": true,
"beforeOpeningCurlyBrace": true
},
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"requireSpacesInNamedFunctionExpression": {
"beforeOpeningRoundBrace": true,
"beforeOpeningCurlyBrace": true
},
"requireSpacesInsideArrayBrackets": "all",
"requireSpacesInsideObjectBrackets": "allButNested",
"requireSpacesInsideParentheses": "all",
"requireTrailingComma": true,
"safeContextKeyword": true,
"validateIndentation": 4,
"validateJSDoc": {
"checkParamNames": true,
"requireParamTypes": true
},
"validateLineBreaks": "LF",
"validateQuoteMarks": true
}
To abide by the rule, you'll just need to rewrite event.wheelDelta / 120
and the following line so that the /
sticks to the following expression: event.wheelDelta /120
.
if ( event.wheelDelta ) delta = event.wheelDelta /120;
else if ( event.detail ) delta = -event.detail /3;
The disallowSpaceAfterBinaryOperators: true
line is causing this. You can see the docs here: disallowSpaceAfterBinaryOperators.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With