From 09808ca16de4b2e20f92a78572f079c9e87c2a73 Mon Sep 17 00:00:00 2001 From: hanakin Date: Tue, 24 Mar 2020 14:14:53 -1000 Subject: [PATCH 1/4] [ticket/15515] rebase on 16414 PHPBB3-15515 --- .jscsrc | 78 ---------------------------------------------- .jshintrc | 25 --------------- travis/check-js.sh | 22 +++++++++++++ 3 files changed, 22 insertions(+), 103 deletions(-) delete mode 100644 .jscsrc delete mode 100644 .jshintrc create mode 100755 travis/check-js.sh diff --git a/.jscsrc b/.jscsrc deleted file mode 100644 index 9dd5ab82e6..0000000000 --- a/.jscsrc +++ /dev/null @@ -1,78 +0,0 @@ - -{ - "excludeFiles": ["node_modules/**", "**/build/**"], - "requireCurlyBraces": [ - "if", "else", "for", "while", "do", "try", "catch" - ], - "requireSpaceBeforeKeywords": [ - "else", "while", "catch" - ], - "requireSpaceAfterKeywords": [ - "do", "for", "if", "else", "switch", "case", "try", "catch", "while", "return", "typeof" - ], - "requireSpaceBeforeBlockStatements": true, - "requireParenthesesAroundIIFE": true, - "requireSpacesInConditionalExpression": { - "afterTest": true, - "beforeConsequent": true, - "afterConsequent": true, - "beforeAlternate": true - }, - "requireSpacesInAnonymousFunctionExpression": { - "beforeOpeningCurlyBrace": true - }, - "disallowSpacesInNamedFunctionExpression": { - "beforeOpeningRoundBrace": true - }, - "requireSpacesInFunction": { - "beforeOpeningCurlyBrace": true - }, - "disallowSpacesInCallExpression": true, - "requireBlocksOnNewline": true, - "requirePaddingNewlinesBeforeKeywords": ["case"], - "disallowEmptyBlocks": true, - "disallowSpacesInsideArrayBrackets": "nested", - "disallowSpacesInsideParentheses": true, - "requireSpacesInsideObjectBrackets": "all", - "disallowQuotedKeysInObjects": "allButReserved", - "disallowSpaceAfterObjectKeys": true, - "requireSpaceBeforeObjectValues": true, - "requireCommaBeforeLineBreak": true, - "requireOperatorBeforeLineBreak": [ - "?", "=", "+", "-", "/", "*", "===", "!==", ">", ">=", "<", "<=" - ], - "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], - "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], - "requireSpaceBeforeBinaryOperators": [ - "=", "+", "+=", "-", "-=", "/", "/=", "*", "*=", "===", "!==", "<", "<=", ">", ">=" - ], - "requireSpaceAfterBinaryOperators": [ - "=", "+", "+=", "-", "-=", "/", "/=", "*", "*=", "===", "!==", "<", "<=", ">", ">=" - ], - "disallowKeywords": ["with"], - "disallowMultipleLineStrings": true, - "disallowMixedSpacesAndTabs": "smart", - "disallowTrailingWhitespace": true, - "disallowTrailingComma": true, - "disallowKeywordsOnNewLine": ["else"], - "requireLineFeedAtFileEnd": true, - "maximumLineLength": { - "value": 120, - "tabSize": 4, - "allowUrlComments": true, - "allowRegex": true - }, - "requireCapitalizedConstructors": true, - "requireDotNotation": true, - "disallowYodaConditions": true, - "requireSpaceAfterLineComment": { - "allExcept": ["#", "="] - }, - "disallowNewlineBeforeBlockStatements": true, - "validateQuoteMarks": { - "mark": "'", - "escape": true - }, - "validateParameterSeparator": ", ", - "safeContextKeyword": ["that"] -} diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index c1efecd573..0000000000 --- a/.jshintrc +++ /dev/null @@ -1,25 +0,0 @@ - -{ - "bitwise": true, - "curly": true, - "eqeqeq": true, - "es3": true, - "forin": false, - "freeze": true, - "newcap": true, - "noarg": true, - "noempty": true, - "nonbsp": true, - "undef": true, - "unused": true, - "strict": true, - - "browser": true, - "devel": true, - "jquery": true, - - "globals": { - "JSON": true, - "phpbb": true - } -} diff --git a/travis/check-js.sh b/travis/check-js.sh new file mode 100755 index 0000000000..7bd3a1765d --- /dev/null +++ b/travis/check-js.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# +# This file is part of the phpBB Forum Software package. +# +# @copyright (c) phpBB Limited +# @license GNU General Public License, version 2 (GPL-2.0) +# +# For full copyright and license information, please see +# the docs/CREDITS.txt file. +# +set -e +set +x + +NOTESTS=$1 + +if [ "$NOTESTS" == '1' ] +then + npm install -g > /dev/null + npm install > /dev/null + set -x + npm run xo +fi From 60692a9ebe3fe48249b0427f5eb053c7ca45502c Mon Sep 17 00:00:00 2001 From: hanakin Date: Tue, 21 Apr 2020 16:49:33 -1000 Subject: [PATCH 2/4] [ticket/15515] update xo and run as npm test PHPBB3-15515 --- travis/check-js.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/travis/check-js.sh b/travis/check-js.sh index 7bd3a1765d..860f0b49ab 100755 --- a/travis/check-js.sh +++ b/travis/check-js.sh @@ -18,5 +18,8 @@ then npm install -g > /dev/null npm install > /dev/null set -x - npm run xo + npm run xo "phpbb/adm/style/*.js" + npm run xo "phpbb/assets/javascript/*.js" + npm run xo "phpbb/style/all/js/*.js" + npm run xo "phpbb/style/prosilver/template/*.js" fi From bfe120ad005930d0e28167b974968371ac60db40 Mon Sep 17 00:00:00 2001 From: hanakin Date: Wed, 22 Apr 2020 17:20:23 -1000 Subject: [PATCH 3/4] [ticket/15515] calll xo explicitly PHPBB3-15515 --- travis/check-js.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/travis/check-js.sh b/travis/check-js.sh index 860f0b49ab..f0894ab280 100755 --- a/travis/check-js.sh +++ b/travis/check-js.sh @@ -18,8 +18,8 @@ then npm install -g > /dev/null npm install > /dev/null set -x - npm run xo "phpbb/adm/style/*.js" - npm run xo "phpbb/assets/javascript/*.js" - npm run xo "phpbb/style/all/js/*.js" - npm run xo "phpbb/style/prosilver/template/*.js" + node_modules/xo/cli.js "phpBB/adm/style/*.js" + node_modules/xo/cli.js "phpBB/assets/javascript/*.js" + node_modules/xo/cli.js "phpBB/style/all/js/*.js" + node_modules/xo/cli.js "phpBB/style/prosilver/template/*.js" fi From cbe6e90f5badcf38ef98b55463d092287985b86f Mon Sep 17 00:00:00 2001 From: hanakin Date: Fri, 26 Mar 2021 11:47:20 -1000 Subject: [PATCH 4/4] [ticket/15515] add admin.js to ignores PHPBB3-15515 --- phpBB/adm/style/admin.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/adm/style/admin.js b/phpBB/adm/style/admin.js index 74269e92e9..4f7f5a990b 100644 --- a/phpBB/adm/style/admin.js +++ b/phpBB/adm/style/admin.js @@ -7,12 +7,12 @@ /** * Parse document block */ -function parse_document(container) +function parse_document(container) { var test = document.createElement('div'), oldBrowser = (typeof test.style.borderRadius == 'undefined'); - delete test; + test.remove(); /** * Navigation @@ -92,7 +92,7 @@ function parse_document(container) } }); } - + headersLength = headers.length; // Add header text to each cell as @@ -159,7 +159,7 @@ function parse_document(container) if ($this.html() == ' ') { $this.addClass('responsive-hide'); } - + }); /**