From f24923a165e4ca3c0b9bd57f94190d221da61fca Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Thu, 7 Apr 2022 17:10:27 +0800 Subject: [PATCH 01/24] fixing dependency conflicts --- .eslintrc.js | 213 +++++++++++++++-------------- .husky/pre-commit | 2 +- .lintstagedrc.json | 5 + packages/account/package.json | 3 +- packages/appstore/package.json | 3 +- packages/bot-skeleton/package.json | 15 +- packages/bot-web-ui/package.json | 1 + packages/cashier/package.json | 5 +- packages/components/package.json | 1 + packages/core/package.json | 1 + packages/indicators/package.json | 7 +- packages/p2p/package.json | 1 + packages/publisher/package.json | 5 +- packages/shared/package.json | 3 +- packages/trader/package.json | 1 + packages/translations/package.json | 1 + 16 files changed, 148 insertions(+), 119 deletions(-) create mode 100644 .lintstagedrc.json diff --git a/.eslintrc.js b/.eslintrc.js index ac234da8ea55..036867519056 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,110 +1,119 @@ module.exports = { - root: true, - parser: 'babel-eslint', - plugins: ['prettier', 'testing-library'], - env: { - es6: true, - browser: true, - amd: true, - mocha: true, - jest: true, - jquery: true, - jasmine: true, - }, - globals: { - dataLayer: true, - texts_json: false, - }, - rules: { - camelcase: 0, - // semi : ['error', 'always'], - 'array-callback-return': 0, - 'arrow-body-style': 0, - 'brace-style': ['error', '1tbs', { allowSingleLine: true }], - curly: 0, - // 'comma-dangle' : ['error', 'always-multiline'], - 'eol-last': ['error', 'always'], - 'func-names': ['error', 'never'], - 'key-spacing': 0, - 'max-classes-per-file': ['warn', 2], - // 'keyword-spacing' : ['error', { after: true }], - 'lines-between-class-members': 0, - indent: 0, - // 'max-len' : ['error', { code: 120, 'ignoreComments': true }], - // 'no-extra-semi' : 'error', - 'no-console': 'error', - 'no-else-return': ['error', { allowElseIf: true }], - 'no-multi-assign': 0, - // 'no-multi-spaces' : [2, { exceptions: { 'BinaryExpression': true, 'VariableDeclarator': true, 'ImportDeclaration': true } }], - 'no-param-reassign': ['error', { props: false }], - 'no-restricted-globals': 0, - 'no-script-url': 0, - // 'no-trailing-spaces' : ['error', { skipBlankLines: true }], - // 'object-curly-spacing' : ['error', 'always', { arraysInObjects: true, objectsInObjects: true }], - 'one-var': ['error', { initialized: 'never', uninitialized: 'always' }], - 'prefer-destructuring': 0, - quotes: 0, - // 'space-in-parens' : ['error', 'never'], - 'space-infix-ops': 'error', - // 'space-unary-ops' : 'error', - // 'no-multiple-empty-lines' : ['error', { 'max': 1, 'maxEOF': 1 }], + root: true, + parser: '@babel/eslint-parser', + plugins: ['prettier'], + env: { + es6: true, + browser: true, + amd: true, + mocha: true, + jest: true, + jquery: true, + jasmine: true, + }, + globals: { + dataLayer: true, + texts_json: false, + }, + rules: { + camelcase: 0, + // semi : ['error', 'always'], + 'array-callback-return': 0, + 'arrow-body-style': 0, + 'brace-style': ['error', '1tbs', { allowSingleLine: true }], + curly: 0, + // 'comma-dangle' : ['error', 'always-multiline'], + 'eol-last': ['error', 'always'], + 'func-names': ['error', 'never'], + 'key-spacing': 0, + 'max-classes-per-file': ['warn', 2], + // 'keyword-spacing' : ['error', { after: true }], + 'lines-between-class-members': 0, + indent: 0, + // 'max-len' : ['error', { code: 120, 'ignoreComments': true }], + // 'no-extra-semi' : 'error', + 'no-console': 'error', + 'no-else-return': ['error', { allowElseIf: true }], + 'no-multi-assign': 0, + // 'no-multi-spaces' : [2, { exceptions: { 'BinaryExpression': true, 'VariableDeclarator': true, 'ImportDeclaration': true } }], + 'no-param-reassign': ['error', { props: false }], + 'no-restricted-globals': 0, + 'no-script-url': 0, + // 'no-trailing-spaces' : ['error', { skipBlankLines: true }], + // 'object-curly-spacing' : ['error', 'always', { arraysInObjects: true, objectsInObjects: true }], + 'one-var': ['error', { initialized: 'never', uninitialized: 'always' }], + 'prefer-destructuring': 0, + quotes: 0, + // 'space-in-parens' : ['error', 'never'], + 'space-infix-ops': 'error', + // 'space-unary-ops' : 'error', + // 'no-multiple-empty-lines' : ['error', { 'max': 1, 'maxEOF': 1 }], - // import rules - 'import/no-extraneous-dependencies': ['error', { 'devDependencies': ['**/__tests__/**/*.js', '**/test*.js', '**/*.test.js*', '**/*.spec.js', '**/*.spec.jsx'] }], + // import rules + 'import/no-extraneous-dependencies': [ + 'error', + { + devDependencies: [ + '**/__tests__/**/*.js', + '**/test*.js', + '**/*.test.js*', + '**/*.spec.js', + '**/*.spec.jsx', + ], + }, + ], - 'import/no-useless-path-segments': 'error', - 'import/order': [ - 0, // TODO: we should turn this to error after we sorted our import orders. - { - groups: [['builtin', 'external'], 'internal', 'sibling', 'parent'], - 'newlines-between': 'ignore', - }, - ], - 'import/prefer-default-export': 0, - 'import/extensions': ['warn', 'never', { jsx: 'always', json: 'always' }], - 'no-sequences': ['warn'], - 'import/no-unresolved': [ - 2, - { ignore: ['@deriv/components', '@deriv/shared'] }, - ], + 'import/no-useless-path-segments': 'error', + 'import/order': [ + 0, // TODO: we should turn this to error after we sorted our import orders. + { + groups: [['builtin', 'external'], 'internal', 'sibling', 'parent'], + 'newlines-between': 'ignore', + }, + ], + 'import/prefer-default-export': 0, + 'import/extensions': ['warn', 'never', { jsx: 'always', json: 'always' }], + 'no-sequences': ['warn'], + 'import/no-unresolved': [2, { ignore: ['@deriv/components', '@deriv/shared'] }], - // react rules - // 'jsx-quotes' : ['error', 'prefer-single'], - // 'react/jsx-closing-bracket-location': ['error', { selfClosing: 'line-aligned', nonEmpty: 'line-aligned' }], - // 'react/jsx-closing-tag-location' : 'error', - // 'react/jsx-first-prop-new-line' : ['error', 'multiline-multiprop'], - // 'react/jsx-indent' : ['error', 4], - // 'react/jsx-indent-props' : ['error', 4], - // 'react/jsx-max-props-per-line' : ['error', { when: 'multiline' }], - // 'react/jsx-tag-spacing' : ['error', { closingSlash: 'never', beforeSelfClosing: 'always' }], - 'react/prop-types': 0, - 'react/self-closing-comp': 'error', - // 'react/sort-prop-types' : ['error', { ignoreCase: true, sortShapeProp: true }], - }, - extends: [ - 'prettier', - 'prettier/react', - 'airbnb-base', - 'binary', - 'plugin:react/recommended', - 'plugin:react-hooks/recommended', - 'plugin:jest-dom/recommended', - ], - parserOptions: { - ecmaVersion: 6, - ecmaFeatures: { - jsx: true, + // react rules + // 'jsx-quotes' : ['error', 'prefer-single'], + // 'react/jsx-closing-bracket-location': ['error', { selfClosing: 'line-aligned', nonEmpty: 'line-aligned' }], + // 'react/jsx-closing-tag-location' : 'error', + // 'react/jsx-first-prop-new-line' : ['error', 'multiline-multiprop'], + // 'react/jsx-indent' : ['error', 4], + // 'react/jsx-indent-props' : ['error', 4], + // 'react/jsx-max-props-per-line' : ['error', { when: 'multiline' }], + // 'react/jsx-tag-spacing' : ['error', { closingSlash: 'never', beforeSelfClosing: 'always' }], + 'react/prop-types': 0, + 'react/self-closing-comp': 'error', + // 'react/sort-prop-types' : ['error', { ignoreCase: true, sortShapeProp: true }], }, - }, - settings: { - react: { - version: '16', + extends: [ + 'prettier', + 'prettier/react', + 'airbnb-base', + 'binary', + 'plugin:react/recommended', + 'plugin:react-hooks/recommended', + 'plugin:jest-dom/recommended', + ], + parserOptions: { + ecmaVersion: 8, + requireConfigFile: false, + ecmaFeatures: { + jsx: true, + }, }, - }, - overrides: [ - { - files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'], - extends: ['plugin:testing-library/react'], + settings: { + react: { + version: '16', + }, }, - ], + // overrides: [ + // { + // files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'], + // extends: ['plugin:testing-library/react'], + // }, + // ], }; diff --git a/.husky/pre-commit b/.husky/pre-commit index b6f9b5ae7168..36af219892fd 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -npm run prettify +npx lint-staged diff --git a/.lintstagedrc.json b/.lintstagedrc.json new file mode 100644 index 000000000000..228685f7f51b --- /dev/null +++ b/.lintstagedrc.json @@ -0,0 +1,5 @@ +{ + "*.{js,jsx,ts,tsx,md,html,css,scss}": "prettier --write", + "*.{js,jsx,ts,tsx}": "npx eslint --fix", + "*.{css,scss}": "npx stylelint --fix" +} \ No newline at end of file diff --git a/packages/account/package.json b/packages/account/package.json index 372ea891b947..ca0f6770f626 100644 --- a/packages/account/package.json +++ b/packages/account/package.json @@ -46,12 +46,14 @@ "react-router-dom": "^5.2.0" }, "devDependencies": { + "@babel/eslint-parser": "^7.17.0", "@jest/globals": "^26.5.3", "@testing-library/react": "^12.0.0", "babel-eslint": "^10.1.0", "babel-loader": "^8.1.0", "clean-webpack-plugin": "^3.0.0", "css-loader": "^5.0.1", + "css-minimizer-webpack-plugin": "^3.0.1", "eslint-config-airbnb-base": "^14.2.1", "eslint-config-binary": "^1.0.2", "eslint-config-prettier": "^7.2.0", @@ -65,7 +67,6 @@ "jest": "^26.4.2", "mini-css-extract-plugin": "^1.3.4", "node-sass": "^4.12.0", - "css-minimizer-webpack-plugin": "^3.0.1", "postcss-loader": "^6.2.1", "postcss-preset-env": "^7.4.3", "postcss-scss": "^4.0.3", diff --git a/packages/appstore/package.json b/packages/appstore/package.json index d5472d9693ff..e3bf6acd98f2 100644 --- a/packages/appstore/package.json +++ b/packages/appstore/package.json @@ -44,6 +44,7 @@ "react-router-dom": "^5.2.0" }, "devDependencies": { + "@babel/eslint-parser": "^7.17.0", "@deriv/publisher": "^0.0.1-beta4", "@types/classnames": "^2.2.11", "@types/object.fromentries": "^2.0.0", @@ -54,11 +55,11 @@ "concurrently": "^5.3.0", "cross-env": "^5.2.0", "css-loader": "^5.0.1", + "css-minimizer-webpack-plugin": "^3.0.1", "fork-ts-checker-webpack-plugin": "^6.5.0", "lint-staged": "^10.4.0", "mini-css-extract-plugin": "^1.3.4", "node-sass": "^4.12.0", - "css-minimizer-webpack-plugin": "^3.0.1", "postcss-loader": "^6.2.1", "postcss-preset-env": "^7.4.3", "postcss-scss": "^4.0.3", diff --git a/packages/bot-skeleton/package.json b/packages/bot-skeleton/package.json index a0db0e720350..acb6211184b5 100644 --- a/packages/bot-skeleton/package.json +++ b/packages/bot-skeleton/package.json @@ -22,27 +22,28 @@ "author": "Binary.com", "license": "MIT", "devDependencies": { + "@babel/eslint-parser": "^7.17.0", "babel-eslint": "^10.1.0", - "eslint-config-prettier": "^7.2.0", - "eslint-plugin-prettier": "^3.3.1", + "chai": "^4.2.0", + "deep-diff": "^1.0.2", "eslint-config-airbnb-base": "^14.2.1", "eslint-config-binary": "^1.0.2", - "eslint-plugin-react": "^7.22.0", - "eslint-plugin-react-hooks": "^4.2.0", + "eslint-config-prettier": "^7.2.0", "eslint-plugin-import": "^2.23.4", - "chai": "^4.2.0", - "deep-diff": "^1.0.2" + "eslint-plugin-prettier": "^3.3.1", + "eslint-plugin-react": "^7.22.0", + "eslint-plugin-react-hooks": "^4.2.0" }, "dependencies": { "@deriv/deriv-api": "^1.0.8", "@deriv/indicators": "^1.0.0", + "@deriv/js-interpreter": "^3.0.0", "@deriv/shared": "^1.0.0", "@deriv/translations": "^1.0.0", "binary-utils": "^4.23.0", "blockly": "3.20191014.4", "file-saver": "^2.0.2", "immutable": "^3.8.2", - "@deriv/js-interpreter": "^3.0.0", "localforage": "^1.9.0", "lz-string": "^1.4.4", "redux": "^4.0.1", diff --git a/packages/bot-web-ui/package.json b/packages/bot-web-ui/package.json index 5cf669cd58e2..a4c2069d40e7 100644 --- a/packages/bot-web-ui/package.json +++ b/packages/bot-web-ui/package.json @@ -35,6 +35,7 @@ "author": "Binary.com", "license": "MIT", "devDependencies": { + "@babel/eslint-parser": "^7.17.0", "babel-eslint": "^10.1.0", "babel-loader": "^8.1.0", "chai": "^4.2.0", diff --git a/packages/cashier/package.json b/packages/cashier/package.json index 83854eb6d71e..f717e6929942 100644 --- a/packages/cashier/package.json +++ b/packages/cashier/package.json @@ -58,6 +58,7 @@ }, "devDependencies": { "@babel/core": "^7.12.10", + "@babel/eslint-parser": "^7.17.0", "@babel/plugin-proposal-class-properties": "^7.12.1", "@babel/plugin-proposal-decorators": "^7.12.12", "@babel/plugin-proposal-export-default-from": "^7.12.1", @@ -68,14 +69,15 @@ "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/preset-env": "^7.12.11", "@babel/preset-react": "^7.12.10", + "@testing-library/react": "^12.0.0", "babel-loader": "^8.1.0", "clean-webpack-plugin": "^3.0.0", "copy-webpack-plugin": "^9.0.1", "css-loader": "^5.0.1", + "css-minimizer-webpack-plugin": "^3.0.1", "file-loader": "^6.2.0", "mini-css-extract-plugin": "^1.3.4", "node-sass": "^4.12.0", - "css-minimizer-webpack-plugin": "^3.0.1", "postcss-loader": "^6.2.1", "postcss-preset-env": "^7.4.3", "postcss-scss": "^4.0.3", @@ -83,7 +85,6 @@ "resolve-url-loader": "^3.1.2", "sass-loader": "^10.1.1", "sass-resources-loader": "^2.1.1", - "@testing-library/react": "^12.0.0", "webpack": "^5.46.0", "webpack-cli": "^4.7.2", "webpack-manifest-plugin": "^4.0.2", diff --git a/packages/components/package.json b/packages/components/package.json index b5fdc2d86466..edf6549f10aa 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -28,6 +28,7 @@ "author": "Deriv", "license": "Apache-2.0", "devDependencies": { + "@babel/eslint-parser": "^7.17.0", "@storybook/addon-actions": "^5.2.4", "@storybook/addon-info": "^5.2.4", "@storybook/addon-links": "^5.2.4", diff --git a/packages/core/package.json b/packages/core/package.json index 0cc10af96e3a..4bde333605a0 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -35,6 +35,7 @@ "homepage": "https://github.com/binary-com/deriv-app", "devDependencies": { "@babel/plugin-proposal-unicode-property-regex": "^7.16.7", + "@babel/eslint-parser": "^7.17.0", "babel-eslint": "^10.1.0", "babel-loader": "^8.1.0", "chai": "^4.2.0", diff --git a/packages/indicators/package.json b/packages/indicators/package.json index 0d7e6919b75f..8c40866ffab5 100644 --- a/packages/indicators/package.json +++ b/packages/indicators/package.json @@ -32,13 +32,14 @@ "url": "https://github.com/binary-com/deriv-app/issues" }, "devDependencies": { + "@babel/eslint-parser": "^7.17.0", "@babel/preset-env": "^7.12.11", "babel-eslint": "^10.1.0", - "eslint-plugin-prettier": "^3.3.1", - "eslint-config-prettier": "^7.2.0", "eslint-config-airbnb-base": "^14.2.1", "eslint-config-binary": "^1.0.2", - "eslint-plugin-import": "^2.23.4" + "eslint-config-prettier": "^7.2.0", + "eslint-plugin-import": "^2.23.4", + "eslint-plugin-prettier": "^3.3.1" }, "dependencies": { "@deriv/shared": "^1.0.0", diff --git a/packages/p2p/package.json b/packages/p2p/package.json index 49b4e0b25ad8..60a5134800f1 100644 --- a/packages/p2p/package.json +++ b/packages/p2p/package.json @@ -51,6 +51,7 @@ "sendbird": "~3.0.137" }, "devDependencies": { + "@babel/eslint-parser": "^7.17.0", "@babel/plugin-proposal-class-properties": "^7.12.1", "@babel/plugin-proposal-decorators": "^7.12.12", "@babel/plugin-proposal-export-default-from": "^7.12.1", diff --git a/packages/publisher/package.json b/packages/publisher/package.json index 8caaf6a75e3b..6abf1badafae 100644 --- a/packages/publisher/package.json +++ b/packages/publisher/package.json @@ -27,5 +27,8 @@ "publish_package": "node ./index.js prepublish && npm publish; node ./index.js postpublish" }, "author": "Deriv.com", - "license": "ISC" + "license": "ISC", + "devDependencies": { + "@babel/eslint-parser": "^7.17.0" + } } diff --git a/packages/shared/package.json b/packages/shared/package.json index 88b381a5e1f7..e8d979bf16ca 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -30,6 +30,7 @@ "url": "https://github.com/binary-com/deriv-app/issues" }, "devDependencies": { + "@babel/eslint-parser": "^7.17.0", "chai": "^4.2.0", "jsdom": "^16.2.1", "moment": "^2.24.0" @@ -38,9 +39,9 @@ "canvas-toBlob": "^1.0.0", "extend": "^3.0.2", "js-cookie": "^2.2.1", + "moment": "^2.24.0", "object.fromentries": "^2.0.0", "react": "^16.14.0", - "moment": "^2.24.0", "react-loadable": "^5.5.0" } } diff --git a/packages/trader/package.json b/packages/trader/package.json index b04d2a4dfbee..89007af2a4f6 100644 --- a/packages/trader/package.json +++ b/packages/trader/package.json @@ -35,6 +35,7 @@ }, "homepage": "https://github.com/binary-com/deriv-app", "devDependencies": { + "@babel/eslint-parser": "^7.17.0", "babel-eslint": "^10.1.0", "babel-loader": "^8.1.0", "chai": "^4.2.0", diff --git a/packages/translations/package.json b/packages/translations/package.json index 74317ae448f7..29b15f414a54 100644 --- a/packages/translations/package.json +++ b/packages/translations/package.json @@ -40,6 +40,7 @@ "react-i18next": "^11.11.0" }, "devDependencies": { + "@babel/eslint-parser": "^7.17.0", "chai": "^4.2.0", "cross-env": "^5.2.0", "mocha": "^7.1.1", From 5981532240c50e69fec33b1da74fc8440076c32d Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Thu, 7 Apr 2022 17:22:07 +0800 Subject: [PATCH 02/24] test linting on core package --- .../src/App/Components/Elements/CookieBanner/cookie-banner.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/App/Components/Elements/CookieBanner/cookie-banner.jsx b/packages/core/src/App/Components/Elements/CookieBanner/cookie-banner.jsx index c7810c30e0e3..b1ba1a87e288 100644 --- a/packages/core/src/App/Components/Elements/CookieBanner/cookie-banner.jsx +++ b/packages/core/src/App/Components/Elements/CookieBanner/cookie-banner.jsx @@ -28,7 +28,7 @@ const CookieBanner = ({ onAccept, onDecline, is_open, is_dark_mode }) => ( secondary onClick={onAccept} > - {localize('Accept')} + {localize('Accept')} Hello ); From e347a3537c6f69b3060f3653daa7dc30666f426c Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Thu, 7 Apr 2022 17:24:02 +0800 Subject: [PATCH 03/24] test linting on bot package --- packages/bot-skeleton/src/constants/save-type.js | 1 + .../src/App/Components/Elements/CookieBanner/cookie-banner.jsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/bot-skeleton/src/constants/save-type.js b/packages/bot-skeleton/src/constants/save-type.js index 6d8ce3aeeed1..dea65d6451a0 100644 --- a/packages/bot-skeleton/src/constants/save-type.js +++ b/packages/bot-skeleton/src/constants/save-type.js @@ -2,4 +2,5 @@ export const save_types = Object.freeze({ UNSAVED: 'unsaved', LOCAL: 'local', GOOGLE_DRIVE: 'google drive', + test: 'test', }); diff --git a/packages/core/src/App/Components/Elements/CookieBanner/cookie-banner.jsx b/packages/core/src/App/Components/Elements/CookieBanner/cookie-banner.jsx index b1ba1a87e288..c7810c30e0e3 100644 --- a/packages/core/src/App/Components/Elements/CookieBanner/cookie-banner.jsx +++ b/packages/core/src/App/Components/Elements/CookieBanner/cookie-banner.jsx @@ -28,7 +28,7 @@ const CookieBanner = ({ onAccept, onDecline, is_open, is_dark_mode }) => ( secondary onClick={onAccept} > - {localize('Accept')} Hello + {localize('Accept')} ); From d28800bf81bda240c4bb5882cc399bdc74b623c8 Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Fri, 8 Apr 2022 12:25:28 +0800 Subject: [PATCH 04/24] test linting on bot-ui package --- packages/bot-skeleton/src/constants/save-type.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/bot-skeleton/src/constants/save-type.js b/packages/bot-skeleton/src/constants/save-type.js index dea65d6451a0..6d8ce3aeeed1 100644 --- a/packages/bot-skeleton/src/constants/save-type.js +++ b/packages/bot-skeleton/src/constants/save-type.js @@ -2,5 +2,4 @@ export const save_types = Object.freeze({ UNSAVED: 'unsaved', LOCAL: 'local', GOOGLE_DRIVE: 'google drive', - test: 'test', }); From 6b54d977206b2e571e8d947d2d93e07560f953c3 Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Fri, 8 Apr 2022 12:31:48 +0800 Subject: [PATCH 05/24] test linting on account package --- packages/account/src/Configs/address-details-config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/account/src/Configs/address-details-config.js b/packages/account/src/Configs/address-details-config.js index a1fd7e33b581..c9b25277865c 100644 --- a/packages/account/src/Configs/address-details-config.js +++ b/packages/account/src/Configs/address-details-config.js @@ -7,6 +7,7 @@ const address_details_config = ({ account_settings, is_svg }) => { return {}; } + // console.log("Testing") const base_case = { address_line_1: { supported_in: ['svg', 'iom', 'malta', 'maltainvest'], From ba32091d77700e05ae82c0d0479a7e30dafefa09 Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Fri, 8 Apr 2022 12:44:31 +0800 Subject: [PATCH 06/24] test linting on appstore package --- packages/account/src/Configs/address-details-config.js | 1 - packages/appstore/src/services/websocket.ts | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/account/src/Configs/address-details-config.js b/packages/account/src/Configs/address-details-config.js index c9b25277865c..a1fd7e33b581 100644 --- a/packages/account/src/Configs/address-details-config.js +++ b/packages/account/src/Configs/address-details-config.js @@ -7,7 +7,6 @@ const address_details_config = ({ account_settings, is_svg }) => { return {}; } - // console.log("Testing") const base_case = { address_line_1: { supported_in: ['svg', 'iom', 'malta', 'maltainvest'], diff --git a/packages/appstore/src/services/websocket.ts b/packages/appstore/src/services/websocket.ts index b2ac6e22830e..bb38fb73090d 100644 --- a/packages/appstore/src/services/websocket.ts +++ b/packages/appstore/src/services/websocket.ts @@ -1,7 +1,7 @@ import { DerivWS } from 'Types'; let ws: DerivWS = null; - +// testing export const useWs = (): DerivWS => ws; export const initWs = (ws_instance: DerivWS): void => (ws = ws_instance); From c4956659390e1c4cd255614c7b812fd042233e8c Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Fri, 8 Apr 2022 13:07:45 +0800 Subject: [PATCH 07/24] test linting on ts file --- packages/appstore/src/services/websocket.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/appstore/src/services/websocket.ts b/packages/appstore/src/services/websocket.ts index bb38fb73090d..b2ac6e22830e 100644 --- a/packages/appstore/src/services/websocket.ts +++ b/packages/appstore/src/services/websocket.ts @@ -1,7 +1,7 @@ import { DerivWS } from 'Types'; let ws: DerivWS = null; -// testing + export const useWs = (): DerivWS => ws; export const initWs = (ws_instance: DerivWS): void => (ws = ws_instance); From 668e697603e524c78aa59acc4b71e532af8eafc5 Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Fri, 8 Apr 2022 13:09:40 +0800 Subject: [PATCH 08/24] test linting on jsx file and cashier package --- .../src/Components/Confirm/payment-agent-transfer-confirm.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cashier/src/Components/Confirm/payment-agent-transfer-confirm.jsx b/packages/cashier/src/Components/Confirm/payment-agent-transfer-confirm.jsx index 7a96deb0a8d3..23815e7e010e 100644 --- a/packages/cashier/src/Components/Confirm/payment-agent-transfer-confirm.jsx +++ b/packages/cashier/src/Components/Confirm/payment-agent-transfer-confirm.jsx @@ -53,7 +53,7 @@ PaymentAgentTransferConfirm.propTypes = { transfer_to: PropTypes.string, transfer_to_name: PropTypes.string, }; - +// test export default connect(({ client, modules }) => ({ currency: client.currency, loginid: client.loginid, From 3f63a7773a4cf87db290950520a97ace178d3bf2 Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Fri, 8 Apr 2022 14:28:04 +0800 Subject: [PATCH 09/24] test linting on components package --- .../src/Components/Confirm/payment-agent-transfer-confirm.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cashier/src/Components/Confirm/payment-agent-transfer-confirm.jsx b/packages/cashier/src/Components/Confirm/payment-agent-transfer-confirm.jsx index 23815e7e010e..7a96deb0a8d3 100644 --- a/packages/cashier/src/Components/Confirm/payment-agent-transfer-confirm.jsx +++ b/packages/cashier/src/Components/Confirm/payment-agent-transfer-confirm.jsx @@ -53,7 +53,7 @@ PaymentAgentTransferConfirm.propTypes = { transfer_to: PropTypes.string, transfer_to_name: PropTypes.string, }; -// test + export default connect(({ client, modules }) => ({ currency: client.currency, loginid: client.loginid, From e2b5fe747a5eda2c8392385116cea67b7244cca0 Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Fri, 8 Apr 2022 14:59:13 +0800 Subject: [PATCH 10/24] test linting on indicators package --- packages/indicators/src/indicators/bollinger-bands.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/indicators/src/indicators/bollinger-bands.js b/packages/indicators/src/indicators/bollinger-bands.js index eca146b540a2..e8be2c92c378 100644 --- a/packages/indicators/src/indicators/bollinger-bands.js +++ b/packages/indicators/src/indicators/bollinger-bands.js @@ -19,6 +19,7 @@ export const bollingerBands = (data, config) => { const vals = takeLast(data, periods, field); const middle = simpleMovingAverage(vals, { periods }); const std_dev = stddev(vals); + // testing const upper = middle + std_dev * stdDevUp; const lower = middle - std_dev * stdDevDown; From c5645fd07cb6cd3cf6e5c673c503e41ba7aeced5 Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Fri, 8 Apr 2022 15:02:11 +0800 Subject: [PATCH 11/24] test linting on p2p package --- packages/indicators/src/indicators/bollinger-bands.js | 1 - packages/p2p/src/components/buy-sell/buy-sell-header.jsx | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/indicators/src/indicators/bollinger-bands.js b/packages/indicators/src/indicators/bollinger-bands.js index e8be2c92c378..eca146b540a2 100644 --- a/packages/indicators/src/indicators/bollinger-bands.js +++ b/packages/indicators/src/indicators/bollinger-bands.js @@ -19,7 +19,6 @@ export const bollingerBands = (data, config) => { const vals = takeLast(data, periods, field); const middle = simpleMovingAverage(vals, { periods }); const std_dev = stddev(vals); - // testing const upper = middle + std_dev * stdDevUp; const lower = middle - std_dev * stdDevDown; diff --git a/packages/p2p/src/components/buy-sell/buy-sell-header.jsx b/packages/p2p/src/components/buy-sell/buy-sell-header.jsx index a526a07dd3b9..102acb068cf7 100644 --- a/packages/p2p/src/components/buy-sell/buy-sell-header.jsx +++ b/packages/p2p/src/components/buy-sell/buy-sell-header.jsx @@ -35,6 +35,7 @@ const BuySellHeader = ({ is_visible, table_type, setTableType }) => { buy_sell_store.setIsLoading(true); buy_sell_store.loadMoreItems({ startIndex: 0 }); }, + // testing // eslint-disable-next-line react-hooks/exhaustive-deps [] ); From 9723e39f5c299b82e56d1f7758a968a46c05f55d Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Fri, 8 Apr 2022 15:07:00 +0800 Subject: [PATCH 12/24] test linting on sass files --- packages/p2p/src/components/buy-sell/buy-sell-header.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/p2p/src/components/buy-sell/buy-sell-header.jsx b/packages/p2p/src/components/buy-sell/buy-sell-header.jsx index 102acb068cf7..a526a07dd3b9 100644 --- a/packages/p2p/src/components/buy-sell/buy-sell-header.jsx +++ b/packages/p2p/src/components/buy-sell/buy-sell-header.jsx @@ -35,7 +35,6 @@ const BuySellHeader = ({ is_visible, table_type, setTableType }) => { buy_sell_store.setIsLoading(true); buy_sell_store.loadMoreItems({ startIndex: 0 }); }, - // testing // eslint-disable-next-line react-hooks/exhaustive-deps [] ); From 79d24bb63f71327ec35724001d595ff0d0daacef Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Fri, 8 Apr 2022 15:51:51 +0800 Subject: [PATCH 13/24] test linting on publisher package --- packages/publisher/utils/shared.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/publisher/utils/shared.js b/packages/publisher/utils/shared.js index 0493988bda89..5da72046a0d5 100644 --- a/packages/publisher/utils/shared.js +++ b/packages/publisher/utils/shared.js @@ -15,12 +15,11 @@ const getLocalDerivDependencies = package_path => { if (fs.existsSync(deriv_node_modules_folder)) { // Below would only affect local development when npm linking a local @deriv/publisher. const ignore_packages = ['publisher']; - return getDirContents(deriv_node_modules_folder).reduce((packages, directory) => { if (directory.isSymbolicLink() && !ignore_packages.includes(directory.name)) { packages.push(`@deriv/${directory.name}`); } - + // console return packages; }, []); } From 96f7ac23091f6d7ecb1b192cd4c7ce1d501bb6f8 Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Fri, 8 Apr 2022 16:06:38 +0800 Subject: [PATCH 14/24] test linting on shared package --- packages/publisher/utils/shared.js | 2 +- packages/shared/src/services/trackjs.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/publisher/utils/shared.js b/packages/publisher/utils/shared.js index 5da72046a0d5..fac8eede4de6 100644 --- a/packages/publisher/utils/shared.js +++ b/packages/publisher/utils/shared.js @@ -19,7 +19,7 @@ const getLocalDerivDependencies = package_path => { if (directory.isSymbolicLink() && !ignore_packages.includes(directory.name)) { packages.push(`@deriv/${directory.name}`); } - // console + return packages; }, []); } diff --git a/packages/shared/src/services/trackjs.js b/packages/shared/src/services/trackjs.js index 9948e94ca983..b0ce86c16fc9 100644 --- a/packages/shared/src/services/trackjs.js +++ b/packages/shared/src/services/trackjs.js @@ -10,6 +10,7 @@ const getIgnoredResponseKeywords = () => { return window.ignored_responses_in_trackjs || []; }; +// console.log() class ResponseQueue { constructor() { this.list = []; From 57b67a719d698c4422bf494ad7488cb376b3d066 Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Fri, 8 Apr 2022 16:07:25 +0800 Subject: [PATCH 15/24] test linting on trader package --- packages/shared/src/services/trackjs.js | 1 - .../src/Assets/Trading/Categories/icon-trade-categories.jsx | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/shared/src/services/trackjs.js b/packages/shared/src/services/trackjs.js index b0ce86c16fc9..9948e94ca983 100644 --- a/packages/shared/src/services/trackjs.js +++ b/packages/shared/src/services/trackjs.js @@ -10,7 +10,6 @@ const getIgnoredResponseKeywords = () => { return window.ignored_responses_in_trackjs || []; }; -// console.log() class ResponseQueue { constructor() { this.list = []; diff --git a/packages/trader/src/Assets/Trading/Categories/icon-trade-categories.jsx b/packages/trader/src/Assets/Trading/Categories/icon-trade-categories.jsx index 184152291576..926f80ab37b0 100644 --- a/packages/trader/src/Assets/Trading/Categories/icon-trade-categories.jsx +++ b/packages/trader/src/Assets/Trading/Categories/icon-trade-categories.jsx @@ -5,6 +5,7 @@ import { Icon } from '@deriv/components'; const IconTradeCategory = ({ category, className }) => { let IconCategory; + // wdcw if (category) { switch (category) { case 'rise_fall': From 051b6e2095e55d6fd9b706309d4ab37abfbededc Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Fri, 8 Apr 2022 16:08:13 +0800 Subject: [PATCH 16/24] cleanup --- .../src/Assets/Trading/Categories/icon-trade-categories.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/trader/src/Assets/Trading/Categories/icon-trade-categories.jsx b/packages/trader/src/Assets/Trading/Categories/icon-trade-categories.jsx index 926f80ab37b0..184152291576 100644 --- a/packages/trader/src/Assets/Trading/Categories/icon-trade-categories.jsx +++ b/packages/trader/src/Assets/Trading/Categories/icon-trade-categories.jsx @@ -5,7 +5,6 @@ import { Icon } from '@deriv/components'; const IconTradeCategory = ({ category, className }) => { let IconCategory; - // wdcw if (category) { switch (category) { case 'rise_fall': From 4fc0d3b742e88b8f019ddd5e43594363f635c8f1 Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Mon, 11 Apr 2022 15:35:49 +0800 Subject: [PATCH 17/24] remove depracated babel-eslint --- .eslintrc.js | 19 +++--- package-lock.json | 100 ++++++++++++++--------------- package.json | 2 +- packages/account/package.json | 2 +- packages/appstore/package.json | 1 + packages/bot-skeleton/package.json | 2 +- packages/bot-web-ui/package.json | 2 +- packages/components/package.json | 2 +- packages/core/package.json | 2 +- packages/indicators/package.json | 2 +- packages/p2p/package.json | 1 - packages/publisher/package.json | 3 +- packages/publisher/utils/shared.js | 1 + packages/shared/package.json | 1 + packages/trader/package.json | 2 +- packages/translations/package.json | 1 + 16 files changed, 72 insertions(+), 71 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 036867519056..c8bec015b874 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,7 +1,7 @@ module.exports = { root: true, parser: '@babel/eslint-parser', - plugins: ['prettier'], + plugins: ['prettier', 'testing-library'], env: { es6: true, browser: true, @@ -99,8 +99,11 @@ module.exports = { 'plugin:jest-dom/recommended', ], parserOptions: { - ecmaVersion: 8, requireConfigFile: false, + ecmaVersion: 8, + babelOptions: { + presets: ['@babel/preset-react'], + }, ecmaFeatures: { jsx: true, }, @@ -110,10 +113,10 @@ module.exports = { version: '16', }, }, - // overrides: [ - // { - // files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'], - // extends: ['plugin:testing-library/react'], - // }, - // ], + overrides: [ + { + files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'], + extends: ['plugin:testing-library/react'], + }, + ], }; diff --git a/package-lock.json b/package-lock.json index a74da39ffb7c..3d792ae45ba4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ }, "devDependencies": { "@babel/core": "^7.12.10", + "@babel/eslint-parser": "^7.17.0", "@babel/plugin-proposal-class-properties": "^7.12.1", "@babel/plugin-proposal-decorators": "^7.12.12", "@babel/plugin-proposal-export-default-from": "^7.12.1", @@ -33,7 +34,6 @@ "@testing-library/react": "^12.0.0", "@typescript-eslint/eslint-plugin": "^5.8.0", "@typescript-eslint/parser": "^5.8.0", - "babel-eslint": "^10.1.0", "babel-polyfill": "^6.26.0", "chai": "^4.2.0", "eslint": "^7.18.0", @@ -129,6 +129,33 @@ "url": "https://opencollective.com/babel" } }, + "node_modules/@babel/eslint-parser": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.17.0.tgz", + "integrity": "sha512-PUEJ7ZBXbRkbq3qqM/jZ2nIuakUBqCYc7Qf52Lj7dlZ6zERnqisdHioL0l4wwQZnmskMeasqUNzLBFKs3nylXA==", + "dev": true, + "dependencies": { + "eslint-scope": "^5.1.1", + "eslint-visitor-keys": "^2.1.0", + "semver": "^6.3.0" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || >=14.0.0" + }, + "peerDependencies": { + "@babel/core": ">=7.11.0", + "eslint": "^7.5.0 || ^8.0.0" + } + }, + "node_modules/@babel/eslint-parser/node_modules/eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, "node_modules/@babel/generator": { "version": "7.17.0", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.17.0.tgz", @@ -6919,36 +6946,6 @@ "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==", "dev": true }, - "node_modules/babel-eslint": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.1.0.tgz", - "integrity": "sha512-ifWaTHQ0ce+448CYop8AdrQiBsGrnC+bMgfyKFdi6EsPLTAWG+QfyDeM6OH+FmWnKvEq5NnBMLvlBUPKQZoDSg==", - "deprecated": "babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.7.0", - "@babel/traverse": "^7.7.0", - "@babel/types": "^7.7.0", - "eslint-visitor-keys": "^1.0.0", - "resolve": "^1.12.0" - }, - "engines": { - "node": ">=6" - }, - "peerDependencies": { - "eslint": ">= 4.12.1" - } - }, - "node_modules/babel-eslint/node_modules/eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/babel-jest": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-27.5.1.tgz", @@ -24911,6 +24908,25 @@ "semver": "^6.3.0" } }, + "@babel/eslint-parser": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.17.0.tgz", + "integrity": "sha512-PUEJ7ZBXbRkbq3qqM/jZ2nIuakUBqCYc7Qf52Lj7dlZ6zERnqisdHioL0l4wwQZnmskMeasqUNzLBFKs3nylXA==", + "dev": true, + "requires": { + "eslint-scope": "^5.1.1", + "eslint-visitor-keys": "^2.1.0", + "semver": "^6.3.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true + } + } + }, "@babel/generator": { "version": "7.17.0", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.17.0.tgz", @@ -30201,28 +30217,6 @@ "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==", "dev": true }, - "babel-eslint": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.1.0.tgz", - "integrity": "sha512-ifWaTHQ0ce+448CYop8AdrQiBsGrnC+bMgfyKFdi6EsPLTAWG+QfyDeM6OH+FmWnKvEq5NnBMLvlBUPKQZoDSg==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.7.0", - "@babel/traverse": "^7.7.0", - "@babel/types": "^7.7.0", - "eslint-visitor-keys": "^1.0.0", - "resolve": "^1.12.0" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true - } - } - }, "babel-jest": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-27.5.1.tgz", diff --git a/package.json b/package.json index 9cdeca1511cc..b7df7972107f 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ }, "devDependencies": { "@babel/core": "^7.12.10", + "@babel/eslint-parser": "^7.17.0", "@babel/plugin-proposal-class-properties": "^7.12.1", "@babel/plugin-proposal-decorators": "^7.12.12", "@babel/plugin-proposal-export-default-from": "^7.12.1", @@ -21,7 +22,6 @@ "@testing-library/react": "^12.0.0", "@typescript-eslint/eslint-plugin": "^5.8.0", "@typescript-eslint/parser": "^5.8.0", - "babel-eslint": "^10.1.0", "babel-polyfill": "^6.26.0", "chai": "^4.2.0", "eslint": "^7.18.0", diff --git a/packages/account/package.json b/packages/account/package.json index ca0f6770f626..febcc542374d 100644 --- a/packages/account/package.json +++ b/packages/account/package.json @@ -47,9 +47,9 @@ }, "devDependencies": { "@babel/eslint-parser": "^7.17.0", + "@babel/preset-react": "^7.16.7", "@jest/globals": "^26.5.3", "@testing-library/react": "^12.0.0", - "babel-eslint": "^10.1.0", "babel-loader": "^8.1.0", "clean-webpack-plugin": "^3.0.0", "css-loader": "^5.0.1", diff --git a/packages/appstore/package.json b/packages/appstore/package.json index e3bf6acd98f2..06a91abe8637 100644 --- a/packages/appstore/package.json +++ b/packages/appstore/package.json @@ -45,6 +45,7 @@ }, "devDependencies": { "@babel/eslint-parser": "^7.17.0", + "@babel/preset-react": "^7.16.7", "@deriv/publisher": "^0.0.1-beta4", "@types/classnames": "^2.2.11", "@types/object.fromentries": "^2.0.0", diff --git a/packages/bot-skeleton/package.json b/packages/bot-skeleton/package.json index acb6211184b5..15193a21bd86 100644 --- a/packages/bot-skeleton/package.json +++ b/packages/bot-skeleton/package.json @@ -23,7 +23,7 @@ "license": "MIT", "devDependencies": { "@babel/eslint-parser": "^7.17.0", - "babel-eslint": "^10.1.0", + "@babel/preset-react": "^7.16.7", "chai": "^4.2.0", "deep-diff": "^1.0.2", "eslint-config-airbnb-base": "^14.2.1", diff --git a/packages/bot-web-ui/package.json b/packages/bot-web-ui/package.json index a4c2069d40e7..241298438bb2 100644 --- a/packages/bot-web-ui/package.json +++ b/packages/bot-web-ui/package.json @@ -36,7 +36,7 @@ "license": "MIT", "devDependencies": { "@babel/eslint-parser": "^7.17.0", - "babel-eslint": "^10.1.0", + "@babel/preset-react": "^7.16.7", "babel-loader": "^8.1.0", "chai": "^4.2.0", "clean-webpack-plugin": "^3.0.0", diff --git a/packages/components/package.json b/packages/components/package.json index edf6549f10aa..15db8733e283 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -29,6 +29,7 @@ "license": "Apache-2.0", "devDependencies": { "@babel/eslint-parser": "^7.17.0", + "@babel/preset-react": "^7.16.7", "@storybook/addon-actions": "^5.2.4", "@storybook/addon-info": "^5.2.4", "@storybook/addon-links": "^5.2.4", @@ -39,7 +40,6 @@ "@storybook/source-loader": "^5.2.4", "@storybook/storybook-deployer": "^2.8.1", "@testing-library/react": "^12.0.0", - "babel-eslint": "^10.1.0", "babel-loader": "^8.1.0", "copy-webpack-plugin": "^9.0.1", "copy-webpack-plugin-v6": "npm:copy-webpack-plugin@6", diff --git a/packages/core/package.json b/packages/core/package.json index 4bde333605a0..b935d25a6615 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -36,7 +36,7 @@ "devDependencies": { "@babel/plugin-proposal-unicode-property-regex": "^7.16.7", "@babel/eslint-parser": "^7.17.0", - "babel-eslint": "^10.1.0", + "@babel/preset-react": "^7.16.7", "babel-loader": "^8.1.0", "chai": "^4.2.0", "circular-dependency-plugin": "^5.2.2", diff --git a/packages/indicators/package.json b/packages/indicators/package.json index 8c40866ffab5..fc2376c01d7b 100644 --- a/packages/indicators/package.json +++ b/packages/indicators/package.json @@ -34,7 +34,7 @@ "devDependencies": { "@babel/eslint-parser": "^7.17.0", "@babel/preset-env": "^7.12.11", - "babel-eslint": "^10.1.0", + "@babel/preset-react": "^7.16.7", "eslint-config-airbnb-base": "^14.2.1", "eslint-config-binary": "^1.0.2", "eslint-config-prettier": "^7.2.0", diff --git a/packages/p2p/package.json b/packages/p2p/package.json index 60a5134800f1..4b55ee1e7d85 100644 --- a/packages/p2p/package.json +++ b/packages/p2p/package.json @@ -65,7 +65,6 @@ "@babel/preset-react": "^7.12.10", "@deriv/publisher": "0.0.1-beta4", "babel-core": "^6.26.3", - "babel-eslint": "^10.1.0", "babel-loader": "^8.1.0", "chai": "^4.2.0", "commander": "^3.0.2", diff --git a/packages/publisher/package.json b/packages/publisher/package.json index 6abf1badafae..48e903d80c6e 100644 --- a/packages/publisher/package.json +++ b/packages/publisher/package.json @@ -29,6 +29,7 @@ "author": "Deriv.com", "license": "ISC", "devDependencies": { - "@babel/eslint-parser": "^7.17.0" + "@babel/eslint-parser": "^7.17.0", + "@babel/preset-react": "^7.16.7" } } diff --git a/packages/publisher/utils/shared.js b/packages/publisher/utils/shared.js index fac8eede4de6..0493988bda89 100644 --- a/packages/publisher/utils/shared.js +++ b/packages/publisher/utils/shared.js @@ -15,6 +15,7 @@ const getLocalDerivDependencies = package_path => { if (fs.existsSync(deriv_node_modules_folder)) { // Below would only affect local development when npm linking a local @deriv/publisher. const ignore_packages = ['publisher']; + return getDirContents(deriv_node_modules_folder).reduce((packages, directory) => { if (directory.isSymbolicLink() && !ignore_packages.includes(directory.name)) { packages.push(`@deriv/${directory.name}`); diff --git a/packages/shared/package.json b/packages/shared/package.json index e8d979bf16ca..a6629244c835 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -31,6 +31,7 @@ }, "devDependencies": { "@babel/eslint-parser": "^7.17.0", + "@babel/preset-react": "^7.16.7", "chai": "^4.2.0", "jsdom": "^16.2.1", "moment": "^2.24.0" diff --git a/packages/trader/package.json b/packages/trader/package.json index 89007af2a4f6..5db096cf9a88 100644 --- a/packages/trader/package.json +++ b/packages/trader/package.json @@ -36,7 +36,7 @@ "homepage": "https://github.com/binary-com/deriv-app", "devDependencies": { "@babel/eslint-parser": "^7.17.0", - "babel-eslint": "^10.1.0", + "@babel/preset-react": "^7.16.7", "babel-loader": "^8.1.0", "chai": "^4.2.0", "circular-dependency-plugin": "^5.2.2", diff --git a/packages/translations/package.json b/packages/translations/package.json index 29b15f414a54..7c24a3ecce19 100644 --- a/packages/translations/package.json +++ b/packages/translations/package.json @@ -41,6 +41,7 @@ }, "devDependencies": { "@babel/eslint-parser": "^7.17.0", + "@babel/preset-react": "^7.16.7", "chai": "^4.2.0", "cross-env": "^5.2.0", "mocha": "^7.1.1", From 3f8058d1bd20ea415262598b88ef47111832fc94 Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Mon, 11 Apr 2022 15:36:26 +0800 Subject: [PATCH 18/24] testing without babel-eslint --- packages/bot-web-ui/src/app/app.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/bot-web-ui/src/app/app.jsx b/packages/bot-web-ui/src/app/app.jsx index e7cb64512773..79747be8557d 100644 --- a/packages/bot-web-ui/src/app/app.jsx +++ b/packages/bot-web-ui/src/app/app.jsx @@ -25,6 +25,7 @@ const App = ({ passthrough }) => { const { app, common, core } = root_store_instance.current; const { onMount, onUnmount, showDigitalOptionsMaltainvestError } = app; + // console.log React.useEffect(() => { showDigitalOptionsMaltainvestError(core.client, common); // eslint-disable-next-line react-hooks/exhaustive-deps From 9457bb937cf79462d7b283ef5e85cb3ce5fd8471 Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Mon, 11 Apr 2022 15:37:09 +0800 Subject: [PATCH 19/24] testing with added overrides --- packages/bot-web-ui/src/app/app.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/bot-web-ui/src/app/app.jsx b/packages/bot-web-ui/src/app/app.jsx index 79747be8557d..e7cb64512773 100644 --- a/packages/bot-web-ui/src/app/app.jsx +++ b/packages/bot-web-ui/src/app/app.jsx @@ -25,7 +25,6 @@ const App = ({ passthrough }) => { const { app, common, core } = root_store_instance.current; const { onMount, onUnmount, showDigitalOptionsMaltainvestError } = app; - // console.log React.useEffect(() => { showDigitalOptionsMaltainvestError(core.client, common); // eslint-disable-next-line react-hooks/exhaustive-deps From 4e40422f8f6c71893315408d1ff87de049260b47 Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Mon, 11 Apr 2022 16:51:59 +0800 Subject: [PATCH 20/24] fix dependancy version conflicts --- package.json | 2 +- packages/cashier/package.json | 2 +- packages/p2p/package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index b7df7972107f..2d16162b0e7f 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "@babel/plugin-proposal-unicode-property-regex": "^7.16.7", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/preset-env": "^7.12.11", - "@babel/preset-react": "^7.12.10", + "@babel/preset-react": "^7.16.7", "@jest/globals": "^26.5.3", "@testing-library/react": "^12.0.0", "@typescript-eslint/eslint-plugin": "^5.8.0", diff --git a/packages/cashier/package.json b/packages/cashier/package.json index f717e6929942..a34b41aeddcb 100644 --- a/packages/cashier/package.json +++ b/packages/cashier/package.json @@ -68,7 +68,7 @@ "@babel/plugin-proposal-optional-chaining": "^7.12.7", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/preset-env": "^7.12.11", - "@babel/preset-react": "^7.12.10", + "@babel/preset-react": "^7.16.7", "@testing-library/react": "^12.0.0", "babel-loader": "^8.1.0", "clean-webpack-plugin": "^3.0.0", diff --git a/packages/p2p/package.json b/packages/p2p/package.json index 4b55ee1e7d85..60b0d805ffca 100644 --- a/packages/p2p/package.json +++ b/packages/p2p/package.json @@ -62,7 +62,7 @@ "@babel/plugin-proposal-unicode-property-regex": "^7.16.7", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/preset-env": "^7.12.11", - "@babel/preset-react": "^7.12.10", + "@babel/preset-react": "^7.16.7", "@deriv/publisher": "0.0.1-beta4", "babel-core": "^6.26.3", "babel-loader": "^8.1.0", From 7cd1e46fbe357ca978d6d403090104da5d759fa3 Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Wed, 13 Apr 2022 13:20:16 +0800 Subject: [PATCH 21/24] fix eslintrc to load babel plugins --- .eslintrc.js | 12 +++++++++++- .../src/components/toolbox/toolbox-items.jsx | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index c8bec015b874..3f7e1c565e54 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -102,7 +102,17 @@ module.exports = { requireConfigFile: false, ecmaVersion: 8, babelOptions: { - presets: ['@babel/preset-react'], + presets: ['@babel/preset-react', '@babel/preset-typescript'], + plugins: [ + ['@babel/plugin-proposal-decorators', { legacy: true }], + ['@babel/plugin-proposal-class-properties', { loose: true }], + '@babel/plugin-proposal-export-default-from', + '@babel/plugin-proposal-object-rest-spread', + '@babel/plugin-proposal-export-namespace-from', + '@babel/plugin-syntax-dynamic-import', + '@babel/plugin-proposal-optional-chaining', + '@babel/plugin-proposal-nullish-coalescing-operator', + ], }, ecmaFeatures: { jsx: true, diff --git a/packages/bot-web-ui/src/components/toolbox/toolbox-items.jsx b/packages/bot-web-ui/src/components/toolbox/toolbox-items.jsx index 08d2f4cb39cb..2732bf1b7139 100644 --- a/packages/bot-web-ui/src/components/toolbox/toolbox-items.jsx +++ b/packages/bot-web-ui/src/components/toolbox/toolbox-items.jsx @@ -459,7 +459,7 @@ export const ToolboxItems = ReactDomServer.renderToStaticMarkup( - yyyy-mm-dd hh:mm:ss + yyyy-mm-dd hh:mm:ss From 9992a9bc648910b24514f538f1fe5514415b91a4 Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Fri, 22 Apr 2022 12:41:53 +0800 Subject: [PATCH 22/24] test From 21c944f4b7eda57e9ab5017792bb075dc54f384a Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Fri, 22 Apr 2022 12:45:16 +0800 Subject: [PATCH 23/24] allow empty commits --- .husky/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 36af219892fd..146c0dfd0def 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -npx lint-staged +npx lint-staged --allow-empty From 9af16fb411526f44a002c7a3521a0a83fca3f528 Mon Sep 17 00:00:00 2001 From: Khalid Ibrahim Date: Fri, 22 Apr 2022 12:45:35 +0800 Subject: [PATCH 24/24] test