@bigbinary/neeto-commons-frontend 3.0.6 → 3.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/configs/babel.js +50 -0
- package/cjs/configs/eslint/globals.js +14 -0
- package/cjs/configs/eslint/helpers/index.js +74 -0
- package/cjs/configs/eslint/imports/enforced.js +29 -0
- package/cjs/configs/eslint/imports/order.js +65 -0
- package/cjs/configs/eslint/index.js +171 -0
- package/cjs/configs/eslint/overrides.js +30 -0
- package/cjs/configs/eslint/promise.js +8 -0
- package/cjs/configs/eslint/react.js +92 -0
- package/cjs/configs/nanos/eslint/imports/order.js +25 -0
- package/cjs/configs/nanos/eslint/index.js +28 -0
- package/cjs/configs/nanos/tailwind.js +11 -0
- package/cjs/configs/nanos/webpack/resolve.js +48 -0
- package/cjs/configs/nextjs/eslint/imports/order.js +25 -0
- package/cjs/configs/nextjs/eslint/index.js +22 -0
- package/cjs/configs/nextjs/webpack/resolve.js +1 -0
- package/cjs/configs/prettier.js +16 -0
- package/cjs/configs/scripts/dead-code-eliminator/constants.js +12 -0
- package/cjs/configs/scripts/dead-code-eliminator/index.js +266 -0
- package/cjs/configs/scripts/getPkgTranslations.js +45 -0
- package/cjs/configs/scripts/jsdoc-builder/constants.mjs +42 -0
- package/cjs/configs/scripts/jsdoc-builder/index.mjs +67 -0
- package/cjs/configs/scripts/jsdoc-builder/utils.mjs +219 -0
- package/cjs/configs/scripts/remove-unused-translation-keys/constants.js +11 -0
- package/cjs/configs/scripts/remove-unused-translation-keys/index.js +186 -0
- package/cjs/configs/tailwind.js +13 -0
- package/cjs/configs/webpack/helpers/customize-default-rules.js +54 -0
- package/cjs/configs/webpack/index.js +58 -0
- package/cjs/configs/webpack/resolve.js +53 -0
- package/cjs/configs/webpack/rules.js +34 -0
- package/{constants.cjs.js → cjs/constants/index.js} +11 -10
- package/cjs/constants/index.js.map +1 -0
- package/cjs/cypress-configs/initializer.js +32 -0
- package/cjs/cypress-configs/plugins.js +105 -0
- package/cjs/cypress-configs/resolve.js +17 -0
- package/cjs/cypress-configs/webpack.config.js +19 -0
- package/cjs/cypress-utils/commands.js +276 -0
- package/cjs/cypress-utils/commands.js.map +1 -0
- package/cjs/cypress-utils/constants/index.js +14 -0
- package/cjs/cypress-utils/constants/index.js.map +1 -0
- package/cjs/cypress-utils/constants/routes.js +40 -0
- package/cjs/cypress-utils/constants/routes.js.map +1 -0
- package/cjs/cypress-utils/constants/selectors/common.js +103 -0
- package/cjs/cypress-utils/constants/selectors/common.js.map +1 -0
- package/cjs/cypress-utils/constants/selectors/editor.js +29 -0
- package/cjs/cypress-utils/constants/selectors/editor.js.map +1 -0
- package/cjs/cypress-utils/constants/selectors/ipRestriction.js +19 -0
- package/cjs/cypress-utils/constants/selectors/ipRestriction.js.map +1 -0
- package/cjs/cypress-utils/constants/selectors/login.js +21 -0
- package/cjs/cypress-utils/constants/selectors/login.js.map +1 -0
- package/cjs/cypress-utils/constants/selectors/member.js +65 -0
- package/cjs/cypress-utils/constants/selectors/member.js.map +1 -0
- package/cjs/cypress-utils/constants/selectors/navigation.js +28 -0
- package/cjs/cypress-utils/constants/selectors/navigation.js.map +1 -0
- package/cjs/cypress-utils/constants/selectors/roles.js +24 -0
- package/cjs/cypress-utils/constants/selectors/roles.js.map +1 -0
- package/cjs/cypress-utils/constants/selectors/signUp.js +23 -0
- package/cjs/cypress-utils/constants/selectors/signUp.js.map +1 -0
- package/cjs/cypress-utils/constants/selectors/tags.js +31 -0
- package/cjs/cypress-utils/constants/selectors/tags.js.map +1 -0
- package/cjs/cypress-utils/constants/texts/common.js +40 -0
- package/cjs/cypress-utils/constants/texts/common.js.map +1 -0
- package/cjs/cypress-utils/constants/texts/member.js +68 -0
- package/cjs/cypress-utils/constants/texts/member.js.map +1 -0
- package/cjs/cypress-utils/constants/texts/navigation.js +24 -0
- package/cjs/cypress-utils/constants/texts/navigation.js.map +1 -0
- package/cjs/cypress-utils/constants/texts/roles.js +25 -0
- package/cjs/cypress-utils/constants/texts/roles.js.map +1 -0
- package/cjs/cypress-utils/constants/texts/signUp.js +14 -0
- package/cjs/cypress-utils/constants/texts/signUp.js.map +1 -0
- package/cjs/cypress-utils/constants/texts/tags.js +28 -0
- package/cjs/cypress-utils/constants/texts/tags.js.map +1 -0
- package/cjs/cypress-utils/fixtures/fake.js +177 -0
- package/cjs/cypress-utils/fixtures/fake.js.map +1 -0
- package/cjs/cypress-utils/index.js +226 -0
- package/cjs/cypress-utils/index.js.map +1 -0
- package/cjs/cypress-utils/utils/authentication.js +45 -0
- package/cjs/cypress-utils/utils/authentication.js.map +1 -0
- package/cjs/cypress-utils/utils/common.js +92 -0
- package/cjs/cypress-utils/utils/common.js.map +1 -0
- package/cjs/cypress-utils/utils/date.js +28 -0
- package/cjs/cypress-utils/utils/date.js.map +1 -0
- package/cjs/cypress-utils/utils/email.js +165 -0
- package/cjs/cypress-utils/utils/email.js.map +1 -0
- package/cjs/cypress-utils/utils/member.js +352 -0
- package/cjs/cypress-utils/utils/member.js.map +1 -0
- package/cjs/cypress-utils/utils/navigation.js +208 -0
- package/cjs/cypress-utils/utils/navigation.js.map +1 -0
- package/cjs/cypress-utils/utils/organization.js +109 -0
- package/cjs/cypress-utils/utils/organization.js.map +1 -0
- package/cjs/cypress-utils/utils/validation.js +17 -0
- package/cjs/cypress-utils/utils/validation.js.map +1 -0
- package/cjs/initializers/axios/index.js +199 -0
- package/cjs/initializers/axios/index.js.map +1 -0
- package/cjs/initializers/axios/paramsSerializer.js +27 -0
- package/cjs/initializers/axios/paramsSerializer.js.map +1 -0
- package/cjs/initializers/constants.js +23 -0
- package/cjs/initializers/constants.js.map +1 -0
- package/cjs/initializers/globalProps.js +15 -0
- package/cjs/initializers/globalProps.js.map +1 -0
- package/cjs/initializers/i18n.js +74 -0
- package/cjs/initializers/i18n.js.map +1 -0
- package/cjs/initializers/index.js +51 -0
- package/cjs/initializers/index.js.map +1 -0
- package/cjs/initializers/logger.js +17 -0
- package/cjs/initializers/logger.js.map +1 -0
- package/cjs/initializers/reactDevTools.js +26 -0
- package/cjs/initializers/reactDevTools.js.map +1 -0
- package/cjs/initializers/utils/customFormatters.js +52 -0
- package/cjs/initializers/utils/customFormatters.js.map +1 -0
- package/cjs/initializers/utils/customPostProcessors.js +21 -0
- package/cjs/initializers/utils/customPostProcessors.js.map +1 -0
- package/cjs/initializers/utils.js +37 -0
- package/cjs/initializers/utils.js.map +1 -0
- package/cjs/react-utils/BrowserPushNotifications/devices.js +26 -0
- package/cjs/react-utils/BrowserPushNotifications/devices.js.map +1 -0
- package/cjs/react-utils/BrowserPushNotifications/index.js +19 -0
- package/cjs/react-utils/BrowserPushNotifications/index.js.map +1 -0
- package/cjs/react-utils/BrowserPushNotifications/pushHelper.js +116 -0
- package/cjs/react-utils/BrowserPushNotifications/pushHelper.js.map +1 -0
- package/cjs/react-utils/BrowserPushNotifications/registerServiceWorker.js +146 -0
- package/cjs/react-utils/BrowserPushNotifications/registerServiceWorker.js.map +1 -0
- package/cjs/react-utils/HoneybadgerErrorBoundary/FallbackComponent.js +153 -0
- package/cjs/react-utils/HoneybadgerErrorBoundary/FallbackComponent.js.map +1 -0
- package/cjs/react-utils/HoneybadgerErrorBoundary/constants.js +9 -0
- package/cjs/react-utils/HoneybadgerErrorBoundary/constants.js.map +1 -0
- package/cjs/react-utils/HoneybadgerErrorBoundary/index.js +59 -0
- package/cjs/react-utils/HoneybadgerErrorBoundary/index.js.map +1 -0
- package/cjs/react-utils/HoneybadgerErrorBoundary/utils.js +17 -0
- package/cjs/react-utils/HoneybadgerErrorBoundary/utils.js.map +1 -0
- package/cjs/react-utils/PrivateRoute.js +80 -0
- package/cjs/react-utils/PrivateRoute.js.map +1 -0
- package/cjs/react-utils/constants/constants.js +11 -0
- package/cjs/react-utils/constants/constants.js.map +1 -0
- package/cjs/react-utils/constants/index.js +28 -0
- package/cjs/react-utils/constants/index.js.map +1 -0
- package/cjs/react-utils/constants/query.js +11 -0
- package/cjs/react-utils/constants/query.js.map +1 -0
- package/cjs/react-utils/index.js +242 -0
- package/cjs/react-utils/index.js.map +1 -0
- package/cjs/react-utils/metaClick.js +16 -0
- package/cjs/react-utils/metaClick.js.map +1 -0
- package/cjs/react-utils/useDebounce.js +28 -0
- package/cjs/react-utils/useDebounce.js.map +1 -0
- package/cjs/react-utils/useDisplayErrorPage.js +23 -0
- package/cjs/react-utils/useDisplayErrorPage.js.map +1 -0
- package/cjs/react-utils/useFetchNeetoApps/apis/neeto_apps.js +17 -0
- package/cjs/react-utils/useFetchNeetoApps/apis/neeto_apps.js.map +1 -0
- package/cjs/react-utils/useFetchNeetoApps/index.js +14 -0
- package/cjs/react-utils/useFetchNeetoApps/index.js.map +1 -0
- package/cjs/react-utils/useFetchNeetoApps/useFetchNeetoApps.js +27 -0
- package/cjs/react-utils/useFetchNeetoApps/useFetchNeetoApps.js.map +1 -0
- package/cjs/react-utils/useFieldSubmit.js +33 -0
- package/cjs/react-utils/useFieldSubmit.js.map +1 -0
- package/cjs/react-utils/useFuncDebounce.js +27 -0
- package/cjs/react-utils/useFuncDebounce.js.map +1 -0
- package/cjs/react-utils/useHotKeys/constants.js +36 -0
- package/cjs/react-utils/useHotKeys/constants.js.map +1 -0
- package/cjs/react-utils/useHotKeys/index.js +14 -0
- package/cjs/react-utils/useHotKeys/index.js.map +1 -0
- package/cjs/react-utils/useHotKeys/useHotKeys.js +65 -0
- package/cjs/react-utils/useHotKeys/useHotKeys.js.map +1 -0
- package/cjs/react-utils/useHotKeys/utils.js +37 -0
- package/cjs/react-utils/useHotKeys/utils.js.map +1 -0
- package/cjs/react-utils/useIsElementVisibleInDom/index.js +14 -0
- package/cjs/react-utils/useIsElementVisibleInDom/index.js.map +1 -0
- package/cjs/react-utils/useIsElementVisibleInDom/useForceUpdate.js +23 -0
- package/cjs/react-utils/useIsElementVisibleInDom/useForceUpdate.js.map +1 -0
- package/cjs/react-utils/useIsElementVisibleInDom/useIsElementVisibleInDom.js +34 -0
- package/cjs/react-utils/useIsElementVisibleInDom/useIsElementVisibleInDom.js.map +1 -0
- package/cjs/react-utils/useKeyboardShortcutsPaneState.js +36 -0
- package/cjs/react-utils/useKeyboardShortcutsPaneState.js.map +1 -0
- package/cjs/react-utils/useLocalStorage.js +39 -0
- package/cjs/react-utils/useLocalStorage.js.map +1 -0
- package/cjs/react-utils/useMutationWithInvalidation.js +33 -0
- package/cjs/react-utils/useMutationWithInvalidation.js.map +1 -0
- package/cjs/react-utils/useOnClickOutside.js +32 -0
- package/cjs/react-utils/useOnClickOutside.js.map +1 -0
- package/cjs/react-utils/usePersistedQuery.js +59 -0
- package/cjs/react-utils/usePersistedQuery.js.map +1 -0
- package/cjs/react-utils/usePrevious.js +17 -0
- package/cjs/react-utils/usePrevious.js.map +1 -0
- package/cjs/react-utils/useQueryParams.js +15 -0
- package/cjs/react-utils/useQueryParams.js.map +1 -0
- package/cjs/react-utils/useRegisterNavigationCheckpoint.js +43 -0
- package/cjs/react-utils/useRegisterNavigationCheckpoint.js.map +1 -0
- package/cjs/react-utils/useStateWithDependency.js +23 -0
- package/cjs/react-utils/useStateWithDependency.js.map +1 -0
- package/cjs/react-utils/useTimer.js +51 -0
- package/cjs/react-utils/useTimer.js.map +1 -0
- package/cjs/react-utils/useUpdateEffect.js +21 -0
- package/cjs/react-utils/useUpdateEffect.js.map +1 -0
- package/cjs/react-utils/withImmutableActions.js +29 -0
- package/cjs/react-utils/withImmutableActions.js.map +1 -0
- package/cjs/react-utils/withT.js +14 -0
- package/cjs/react-utils/withT.js.map +1 -0
- package/cjs/react-utils/withTitle.js +44 -0
- package/cjs/react-utils/withTitle.js.map +1 -0
- package/cjs/utils/axios.js +17 -0
- package/cjs/utils/axios.js.map +1 -0
- package/cjs/utils/createSubscription.js +22 -0
- package/cjs/utils/createSubscription.js.map +1 -0
- package/cjs/utils/currencyFormat.js +50 -0
- package/cjs/utils/currencyFormat.js.map +1 -0
- package/cjs/utils/datetime.js +69 -0
- package/cjs/utils/datetime.js.map +1 -0
- package/cjs/utils/general.js +193 -0
- package/cjs/utils/general.js.map +1 -0
- package/cjs/utils/index.js +72 -0
- package/cjs/utils/index.js.map +1 -0
- package/cjs/utils/permissions.js +25 -0
- package/cjs/utils/permissions.js.map +1 -0
- package/configs/scripts/getPkgTranslations.js +1 -1
- package/configs/scripts/jsdoc-builder/constants.mjs +1 -1
- package/configs/scripts/jsdoc-builder/index.mjs +1 -1
- package/configs/webpack/rules.js +2 -1
- package/constants/index.js +13 -0
- package/constants/index.js.map +1 -0
- package/cypress-utils/commands.js +268 -0
- package/cypress-utils/commands.js.map +1 -0
- package/cypress-utils/constants/index.js +7 -0
- package/cypress-utils/constants/index.js.map +1 -0
- package/cypress-utils/constants/routes.js +33 -0
- package/cypress-utils/constants/routes.js.map +1 -0
- package/cypress-utils/constants/selectors/common.js +94 -0
- package/cypress-utils/constants/selectors/common.js.map +1 -0
- package/cypress-utils/constants/selectors/editor.js +22 -0
- package/cypress-utils/constants/selectors/editor.js.map +1 -0
- package/cypress-utils/constants/selectors/ipRestriction.js +12 -0
- package/cypress-utils/constants/selectors/ipRestriction.js.map +1 -0
- package/cypress-utils/constants/selectors/login.js +14 -0
- package/cypress-utils/constants/selectors/login.js.map +1 -0
- package/cypress-utils/constants/selectors/member.js +56 -0
- package/cypress-utils/constants/selectors/member.js.map +1 -0
- package/cypress-utils/constants/selectors/navigation.js +20 -0
- package/cypress-utils/constants/selectors/navigation.js.map +1 -0
- package/cypress-utils/constants/selectors/roles.js +17 -0
- package/cypress-utils/constants/selectors/roles.js.map +1 -0
- package/cypress-utils/constants/selectors/signUp.js +16 -0
- package/cypress-utils/constants/selectors/signUp.js.map +1 -0
- package/cypress-utils/constants/selectors/tags.js +23 -0
- package/cypress-utils/constants/selectors/tags.js.map +1 -0
- package/cypress-utils/constants/texts/common.js +33 -0
- package/cypress-utils/constants/texts/common.js.map +1 -0
- package/cypress-utils/constants/texts/member.js +59 -0
- package/cypress-utils/constants/texts/member.js.map +1 -0
- package/cypress-utils/constants/texts/navigation.js +16 -0
- package/cypress-utils/constants/texts/navigation.js.map +1 -0
- package/cypress-utils/constants/texts/roles.js +18 -0
- package/cypress-utils/constants/texts/roles.js.map +1 -0
- package/cypress-utils/constants/texts/signUp.js +7 -0
- package/cypress-utils/constants/texts/signUp.js.map +1 -0
- package/cypress-utils/constants/texts/tags.js +21 -0
- package/cypress-utils/constants/texts/tags.js.map +1 -0
- package/cypress-utils/fixtures/fake.js +171 -0
- package/cypress-utils/fixtures/fake.js.map +1 -0
- package/cypress-utils/index.js +21 -0
- package/cypress-utils/index.js.map +1 -0
- package/cypress-utils/utils/authentication.js +38 -0
- package/cypress-utils/utils/authentication.js.map +1 -0
- package/cypress-utils/utils/common.js +75 -0
- package/cypress-utils/utils/common.js.map +1 -0
- package/cypress-utils/utils/date.js +20 -0
- package/cypress-utils/utils/date.js.map +1 -0
- package/cypress-utils/utils/email.js +156 -0
- package/cypress-utils/utils/email.js.map +1 -0
- package/cypress-utils/utils/member.js +344 -0
- package/cypress-utils/utils/member.js.map +1 -0
- package/cypress-utils/utils/navigation.js +200 -0
- package/cypress-utils/utils/navigation.js.map +1 -0
- package/cypress-utils/utils/organization.js +102 -0
- package/cypress-utils/utils/organization.js.map +1 -0
- package/cypress-utils/utils/validation.js +10 -0
- package/cypress-utils/utils/validation.js.map +1 -0
- package/initializers/axios/index.js +192 -0
- package/initializers/axios/index.js.map +1 -0
- package/initializers/axios/paramsSerializer.js +18 -0
- package/initializers/axios/paramsSerializer.js.map +1 -0
- package/initializers/constants.js +13 -0
- package/initializers/constants.js.map +1 -0
- package/initializers/globalProps.js +8 -0
- package/initializers/globalProps.js.map +1 -0
- package/initializers/i18n.js +67 -0
- package/initializers/i18n.js.map +1 -0
- package/initializers/index.js +28 -0
- package/initializers/index.js.map +1 -0
- package/initializers/logger.js +10 -0
- package/initializers/logger.js.map +1 -0
- package/initializers/reactDevTools.js +19 -0
- package/initializers/reactDevTools.js.map +1 -0
- package/initializers/utils/customFormatters.js +43 -0
- package/initializers/utils/customFormatters.js.map +1 -0
- package/initializers/utils/customPostProcessors.js +14 -0
- package/initializers/utils/customPostProcessors.js.map +1 -0
- package/initializers/utils.js +29 -0
- package/initializers/utils.js.map +1 -0
- package/package.json +51 -158
- package/pure.d.ts +384 -0
- package/react-utils/BrowserPushNotifications/devices.js +18 -0
- package/react-utils/BrowserPushNotifications/devices.js.map +1 -0
- package/react-utils/BrowserPushNotifications/index.js +1 -0
- package/react-utils/BrowserPushNotifications/index.js.map +1 -0
- package/react-utils/BrowserPushNotifications/pushHelper.js +107 -0
- package/react-utils/BrowserPushNotifications/pushHelper.js.map +1 -0
- package/react-utils/BrowserPushNotifications/registerServiceWorker.js +137 -0
- package/react-utils/BrowserPushNotifications/registerServiceWorker.js.map +1 -0
- package/react-utils/HoneybadgerErrorBoundary/FallbackComponent.js +144 -0
- package/react-utils/HoneybadgerErrorBoundary/FallbackComponent.js.map +1 -0
- package/react-utils/HoneybadgerErrorBoundary/constants.js +1 -0
- package/react-utils/HoneybadgerErrorBoundary/constants.js.map +1 -0
- package/react-utils/HoneybadgerErrorBoundary/index.js +52 -0
- package/react-utils/HoneybadgerErrorBoundary/index.js.map +1 -0
- package/react-utils/HoneybadgerErrorBoundary/utils.js +9 -0
- package/react-utils/HoneybadgerErrorBoundary/utils.js.map +1 -0
- package/react-utils/PrivateRoute.js +72 -0
- package/react-utils/PrivateRoute.js.map +1 -0
- package/react-utils/constants/constants.js +3 -0
- package/react-utils/constants/constants.js.map +1 -0
- package/react-utils/constants/index.js +3 -0
- package/react-utils/constants/index.js.map +1 -0
- package/react-utils/constants/query.js +4 -0
- package/react-utils/constants/query.js.map +1 -0
- package/react-utils/index.js +33 -0
- package/react-utils/index.js.map +1 -0
- package/react-utils/metaClick.js +8 -0
- package/react-utils/metaClick.js.map +1 -0
- package/react-utils/useDebounce.js +20 -0
- package/react-utils/useDebounce.js.map +1 -0
- package/react-utils/useDisplayErrorPage.js +15 -0
- package/react-utils/useDisplayErrorPage.js.map +1 -0
- package/react-utils/useFetchNeetoApps/apis/neeto_apps.js +9 -0
- package/react-utils/useFetchNeetoApps/apis/neeto_apps.js.map +1 -0
- package/react-utils/useFetchNeetoApps/index.js +1 -0
- package/react-utils/useFetchNeetoApps/index.js.map +1 -0
- package/react-utils/useFetchNeetoApps/useFetchNeetoApps.js +19 -0
- package/react-utils/useFetchNeetoApps/useFetchNeetoApps.js.map +1 -0
- package/react-utils/useFieldSubmit.js +26 -0
- package/react-utils/useFieldSubmit.js.map +1 -0
- package/react-utils/useFuncDebounce.js +20 -0
- package/react-utils/useFuncDebounce.js.map +1 -0
- package/react-utils/useHotKeys/constants.js +25 -0
- package/react-utils/useHotKeys/constants.js.map +1 -0
- package/react-utils/useHotKeys/index.js +1 -0
- package/react-utils/useHotKeys/index.js.map +1 -0
- package/react-utils/useHotKeys/useHotKeys.js +57 -0
- package/react-utils/useHotKeys/useHotKeys.js.map +1 -0
- package/react-utils/useHotKeys/utils.js +29 -0
- package/react-utils/useHotKeys/utils.js.map +1 -0
- package/react-utils/useIsElementVisibleInDom/index.js +1 -0
- package/react-utils/useIsElementVisibleInDom/index.js.map +1 -0
- package/react-utils/useIsElementVisibleInDom/useForceUpdate.js +15 -0
- package/react-utils/useIsElementVisibleInDom/useForceUpdate.js.map +1 -0
- package/react-utils/useIsElementVisibleInDom/useIsElementVisibleInDom.js +26 -0
- package/react-utils/useIsElementVisibleInDom/useIsElementVisibleInDom.js.map +1 -0
- package/react-utils/useKeyboardShortcutsPaneState.js +29 -0
- package/react-utils/useKeyboardShortcutsPaneState.js.map +1 -0
- package/react-utils/useLocalStorage.js +31 -0
- package/react-utils/useLocalStorage.js.map +1 -0
- package/react-utils/useMutationWithInvalidation.js +25 -0
- package/react-utils/useMutationWithInvalidation.js.map +1 -0
- package/react-utils/useOnClickOutside.js +25 -0
- package/react-utils/useOnClickOutside.js.map +1 -0
- package/react-utils/usePersistedQuery.js +51 -0
- package/react-utils/usePersistedQuery.js.map +1 -0
- package/react-utils/usePrevious.js +10 -0
- package/react-utils/usePrevious.js.map +1 -0
- package/react-utils/useQueryParams.js +8 -0
- package/react-utils/useQueryParams.js.map +1 -0
- package/react-utils/useRegisterNavigationCheckpoint.js +35 -0
- package/react-utils/useRegisterNavigationCheckpoint.js.map +1 -0
- package/react-utils/useStateWithDependency.js +15 -0
- package/react-utils/useStateWithDependency.js.map +1 -0
- package/react-utils/useTimer.js +43 -0
- package/react-utils/useTimer.js.map +1 -0
- package/react-utils/useUpdateEffect.js +14 -0
- package/react-utils/useUpdateEffect.js.map +1 -0
- package/react-utils/withImmutableActions.js +22 -0
- package/react-utils/withImmutableActions.js.map +1 -0
- package/react-utils/withT.js +7 -0
- package/react-utils/withT.js.map +1 -0
- package/react-utils/withTitle.js +36 -0
- package/react-utils/withTitle.js.map +1 -0
- package/react-utils.d.ts +14 -2
- package/translations/en.json +100 -0
- package/utils/axios.js +10 -0
- package/utils/axios.js.map +1 -0
- package/utils/createSubscription.js +15 -0
- package/utils/createSubscription.js.map +1 -0
- package/utils/currencyFormat.js +42 -0
- package/utils/currencyFormat.js.map +1 -0
- package/utils/datetime.js +60 -0
- package/utils/datetime.js.map +1 -0
- package/utils/general.js +172 -0
- package/utils/general.js.map +1 -0
- package/utils/index.js +7 -0
- package/utils/index.js.map +1 -0
- package/utils/permissions.js +16 -0
- package/utils/permissions.js.map +1 -0
- package/utils.d.ts +18 -2
- package/README.md +0 -173
- package/constants.cjs.js.map +0 -1
- package/constants.js +0 -15
- package/constants.js.map +0 -1
- package/cypress-utils.cjs.js +0 -1819
- package/cypress-utils.cjs.js.map +0 -1
- package/cypress-utils.js +0 -1773
- package/cypress-utils.js.map +0 -1
- package/initializers.cjs.js +0 -2648
- package/initializers.cjs.js.map +0 -1
- package/initializers.js +0 -2634
- package/initializers.js.map +0 -1
- package/react-utils.cjs.js +0 -4915
- package/react-utils.cjs.js.map +0 -1
- package/react-utils.js +0 -4860
- package/react-utils.js.map +0 -1
- package/utils.cjs.js +0 -1280
- package/utils.cjs.js.map +0 -1
- package/utils.js +0 -1248
- package/utils.js.map +0 -1
- /package/{src → cjs}/translations/en.json +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// eslint-disable-next-line @bigbinary/neeto/no-dangling-constants
|
|
2
|
+
const VALID_ENVIRONMENTS = ["development", "test", "production"];
|
|
3
|
+
|
|
4
|
+
module.exports = function (api) {
|
|
5
|
+
const currentEnv = api.env();
|
|
6
|
+
const isDevelopmentEnv = api.env("development");
|
|
7
|
+
const isProductionEnv = api.env("production");
|
|
8
|
+
const isTestEnv = api.env("test");
|
|
9
|
+
|
|
10
|
+
if (!VALID_ENVIRONMENTS.includes(currentEnv)) {
|
|
11
|
+
throw new Error(
|
|
12
|
+
"Please specify a valid `NODE_ENV` or `BABEL_ENV` environment variables. " +
|
|
13
|
+
'Valid values are "development", "test", and "production". ' +
|
|
14
|
+
`Instead, received: ${JSON.stringify(currentEnv)}.`
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
presets: [
|
|
20
|
+
isTestEnv
|
|
21
|
+
? [
|
|
22
|
+
"@babel/preset-env",
|
|
23
|
+
{ targets: { node: "current" }, modules: "commonjs" },
|
|
24
|
+
]
|
|
25
|
+
: [
|
|
26
|
+
"@babel/preset-env",
|
|
27
|
+
{
|
|
28
|
+
forceAllTransforms: isProductionEnv,
|
|
29
|
+
useBuiltIns: "entry",
|
|
30
|
+
corejs: "3.27.0",
|
|
31
|
+
modules: false,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
["@babel/preset-react", { development: isDevelopmentEnv || isTestEnv }],
|
|
35
|
+
"@bigbinary/neeto",
|
|
36
|
+
].filter(Boolean),
|
|
37
|
+
plugins: [
|
|
38
|
+
"preval",
|
|
39
|
+
"babel-plugin-macros",
|
|
40
|
+
"@babel/plugin-transform-runtime",
|
|
41
|
+
isTestEnv
|
|
42
|
+
? "babel-plugin-dynamic-import-node" // tests run in node environment
|
|
43
|
+
: "@babel/plugin-syntax-dynamic-import",
|
|
44
|
+
isProductionEnv && [
|
|
45
|
+
"babel-plugin-transform-react-remove-prop-types",
|
|
46
|
+
{ removeImport: true },
|
|
47
|
+
],
|
|
48
|
+
].filter(Boolean),
|
|
49
|
+
};
|
|
50
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
// Globals can be disabled with the string "off"
|
|
3
|
+
// "writable" to allow the variable to be overwritten or "readonly" to disallow overwriting.
|
|
4
|
+
globals: {
|
|
5
|
+
Atomics: "readonly",
|
|
6
|
+
SharedArrayBuffer: "readonly",
|
|
7
|
+
// Makes logger function available everywhere. Else eslint will complaint of undef-var.
|
|
8
|
+
logger: "readonly",
|
|
9
|
+
module: "writable",
|
|
10
|
+
// Makes props obtained from Rails backend available everywhere in this project.
|
|
11
|
+
globalProps: "readonly",
|
|
12
|
+
preval: "readonly",
|
|
13
|
+
},
|
|
14
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
|
|
4
|
+
const { mergeDeepLeft, mergeLeft, keys } = require("ramda");
|
|
5
|
+
|
|
6
|
+
const loadJS = jsPath => {
|
|
7
|
+
try {
|
|
8
|
+
return require(jsPath);
|
|
9
|
+
} catch {
|
|
10
|
+
return {};
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const doesFileExist = filePath =>
|
|
15
|
+
fs.existsSync(filePath) && fs.lstatSync(filePath).isFile();
|
|
16
|
+
|
|
17
|
+
const generateAllPathsInsideDir = dirPath => {
|
|
18
|
+
const files = fs.readdirSync(dirPath, { withFileTypes: true });
|
|
19
|
+
|
|
20
|
+
return files.flatMap(file => {
|
|
21
|
+
const filePath = path.join(dirPath, file.name);
|
|
22
|
+
|
|
23
|
+
return file.isDirectory() ? generateAllPathsInsideDir(filePath) : filePath;
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const generatePathGroupsFromAssets = assetsPath => {
|
|
28
|
+
if (!fs.existsSync(assetsPath)) return [];
|
|
29
|
+
|
|
30
|
+
return generateAllPathsInsideDir(assetsPath).map(absPath => ({
|
|
31
|
+
pattern: absPath.replace(assetsPath, "").split(".")[0],
|
|
32
|
+
group: "internal",
|
|
33
|
+
}));
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const buildPathGroupsBasedOnWebpackAliases = ({
|
|
37
|
+
customAliasPath = "config/webpack/resolve.js",
|
|
38
|
+
commonAliasPath = "node_modules/@bigbinary/neeto-commons-frontend/configs/webpack/resolve.js",
|
|
39
|
+
}) => {
|
|
40
|
+
const rootOfProject = path.join(__dirname, "../../../../../../");
|
|
41
|
+
const projectResolve = loadJS(path.join(rootOfProject, customAliasPath));
|
|
42
|
+
const commonResolve = loadJS(path.join(rootOfProject, commonAliasPath));
|
|
43
|
+
|
|
44
|
+
const { dependencies = [], devDependencies = [] } = loadJS(
|
|
45
|
+
path.join(rootOfProject, "package.json")
|
|
46
|
+
);
|
|
47
|
+
const packages = keys(mergeLeft(dependencies, devDependencies));
|
|
48
|
+
const { alias = {}, extensions = [] } = mergeDeepLeft(
|
|
49
|
+
projectResolve,
|
|
50
|
+
commonResolve
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const pathGroups = Object.entries(alias).flatMap(([pattern, aliasPath]) => {
|
|
54
|
+
const group = packages.includes(aliasPath) ? "external" : "internal";
|
|
55
|
+
const isFile = ["", ...extensions].some(extension =>
|
|
56
|
+
doesFileExist(`${aliasPath}${extension}`)
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
if (isFile) return { pattern, group };
|
|
60
|
+
|
|
61
|
+
return [
|
|
62
|
+
{ pattern, group },
|
|
63
|
+
{ pattern: `${pattern}/**`, group },
|
|
64
|
+
];
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const pathGroupsFromAssets = generatePathGroupsFromAssets(
|
|
68
|
+
path.join(rootOfProject, "app/assets/")
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
return pathGroups.concat(pathGroupsFromAssets);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
module.exports = { buildPathGroupsBasedOnWebpackAliases };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
rules: {
|
|
3
|
+
// not-auto-fixable: Prefer a default export if module exports a single name.
|
|
4
|
+
"import/prefer-default-export": "off",
|
|
5
|
+
// not-auto-fixable: Forbid a module from importing a module with a dependency path back to itself.
|
|
6
|
+
"import/no-cycle": ["warn", { maxDepth: 1, ignoreExternal: true }],
|
|
7
|
+
// not-auto-fixable: Prevent unnecessary path segments in import and require statements.
|
|
8
|
+
"import/no-useless-path-segments": ["error", { noUselessIndex: true }],
|
|
9
|
+
// not-auto-fixable: Report any invalid exports, i.e. re-export of the same name.
|
|
10
|
+
"import/export": "error",
|
|
11
|
+
// not-auto-fixable: Forbid the use of mutable exports with var or let.
|
|
12
|
+
"import/no-mutable-exports": "error",
|
|
13
|
+
// not-auto-fixable: Ensure all imports appear before other statements.
|
|
14
|
+
"import/first": "error",
|
|
15
|
+
// not-auto-fixable: Ensure all exports appear after other statements.
|
|
16
|
+
"import/exports-last": "error",
|
|
17
|
+
// auto-fixable: Enforce a newline after import statements.
|
|
18
|
+
"import/newline-after-import": ["error", { count: 1 }],
|
|
19
|
+
// auto-fixable: Remove file extensions for import statements.
|
|
20
|
+
"import/extensions": [
|
|
21
|
+
"error",
|
|
22
|
+
"never",
|
|
23
|
+
{
|
|
24
|
+
ignorePackages: true,
|
|
25
|
+
pattern: { json: "always", ico: "always", yml: "always" },
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const { buildPathGroupsBasedOnWebpackAliases } = require("../helpers");
|
|
2
|
+
|
|
3
|
+
const pathGroups = buildPathGroupsBasedOnWebpackAliases({});
|
|
4
|
+
|
|
5
|
+
const pathGroupForKeepingReactImportsAtTop = {
|
|
6
|
+
pattern: "react+(-native|)",
|
|
7
|
+
group: "external",
|
|
8
|
+
position: "before",
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
Example pathGroups structure. Adding this here
|
|
13
|
+
so that if anyone wants to add custom config,
|
|
14
|
+
they can make use of this:
|
|
15
|
+
[
|
|
16
|
+
{ pattern: 'apis/**', group: 'internal' },
|
|
17
|
+
{ pattern: 'common/**', group: 'internal' },
|
|
18
|
+
{ pattern: 'components/**', group: 'internal' },
|
|
19
|
+
{ pattern: 'constants/**', group: 'internal' },
|
|
20
|
+
{ pattern: 'contexts/**', group: 'internal' },
|
|
21
|
+
{ pattern: 'reducers/**', group: 'internal' },
|
|
22
|
+
{ pattern: 'Constants', group: 'internal' },
|
|
23
|
+
{ pattern: 'neetoui/**', group: 'external' },
|
|
24
|
+
{
|
|
25
|
+
pattern: 'react+(-native|)',
|
|
26
|
+
group: 'external',
|
|
27
|
+
position: 'before'
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
*/
|
|
31
|
+
pathGroups.push(pathGroupForKeepingReactImportsAtTop);
|
|
32
|
+
|
|
33
|
+
module.exports = {
|
|
34
|
+
rules: {
|
|
35
|
+
// auto-fixable: Enforce a convention in module import order - we enforce https://www.bigbinary.com/react-best-practices/sort-import-statements
|
|
36
|
+
"import/order": [
|
|
37
|
+
"error",
|
|
38
|
+
{
|
|
39
|
+
"newlines-between": "always",
|
|
40
|
+
alphabetize: { order: "asc", caseInsensitive: true },
|
|
41
|
+
warnOnUnassignedImports: true,
|
|
42
|
+
groups: [
|
|
43
|
+
"builtin",
|
|
44
|
+
"external",
|
|
45
|
+
"internal",
|
|
46
|
+
"index",
|
|
47
|
+
"sibling",
|
|
48
|
+
"parent",
|
|
49
|
+
"object",
|
|
50
|
+
"type",
|
|
51
|
+
],
|
|
52
|
+
/*
|
|
53
|
+
* Currently we check for existence of webpack alias
|
|
54
|
+
* config and then iterate over the aliases and create
|
|
55
|
+
* these pathGroups. Only caveat with this mechanism
|
|
56
|
+
* is that in VSCode eslint plugin won't dynamically
|
|
57
|
+
* read it. But eslint cli would!
|
|
58
|
+
*/
|
|
59
|
+
pathGroups,
|
|
60
|
+
// Ignore react imports so that they're always ordered to the top of the file.
|
|
61
|
+
pathGroupsExcludedImportTypes: ["react", "react-native"],
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
};
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
env: {
|
|
3
|
+
browser: true, // window object etc part of browser are made available globally.
|
|
4
|
+
es2020: true, // to include BigInt support
|
|
5
|
+
es6: true,
|
|
6
|
+
commonjs: true,
|
|
7
|
+
node: true,
|
|
8
|
+
},
|
|
9
|
+
/*
|
|
10
|
+
* The order of extending each plugin matters a LOT!!
|
|
11
|
+
* Thus don't change order of items in this array
|
|
12
|
+
* unless you're sure of it.
|
|
13
|
+
*/
|
|
14
|
+
extends: [
|
|
15
|
+
"plugin:@bigbinary/neeto/recommended",
|
|
16
|
+
"plugin:cypress/recommended",
|
|
17
|
+
"plugin:json/recommended",
|
|
18
|
+
"eslint:recommended",
|
|
19
|
+
"plugin:react/recommended",
|
|
20
|
+
"./node_modules/@bigbinary/neeto-commons-frontend/configs/eslint/globals",
|
|
21
|
+
"./node_modules/@bigbinary/neeto-commons-frontend/configs/eslint/imports/order",
|
|
22
|
+
"./node_modules/@bigbinary/neeto-commons-frontend/configs/eslint/overrides",
|
|
23
|
+
"./node_modules/@bigbinary/neeto-commons-frontend/configs/eslint/imports/enforced",
|
|
24
|
+
"./node_modules/@bigbinary/neeto-commons-frontend/configs/eslint/react",
|
|
25
|
+
"./node_modules/@bigbinary/neeto-commons-frontend/configs/eslint/promise",
|
|
26
|
+
"prettier",
|
|
27
|
+
],
|
|
28
|
+
settings: {
|
|
29
|
+
react: { version: "detect" },
|
|
30
|
+
// We need this for the import/extensions rule to work: https://github.com/import-js/eslint-plugin-import#importextensions
|
|
31
|
+
"import/resolver": {
|
|
32
|
+
node: {
|
|
33
|
+
extensions: [".js", ".jsx", ".ts", ".tsx", ".svg", ".json"],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
parserOptions: {
|
|
38
|
+
ecmaFeatures: { jsx: true },
|
|
39
|
+
ecmaVersion: 2018,
|
|
40
|
+
sourceType: "module",
|
|
41
|
+
},
|
|
42
|
+
// babel-eslint is deprecated now. This is the latest package.
|
|
43
|
+
parser: "@babel/eslint-parser",
|
|
44
|
+
plugins: [
|
|
45
|
+
"react",
|
|
46
|
+
"prettier",
|
|
47
|
+
"import",
|
|
48
|
+
"react-hooks",
|
|
49
|
+
"promise",
|
|
50
|
+
"jam3",
|
|
51
|
+
"unused-imports",
|
|
52
|
+
"sonarjs",
|
|
53
|
+
"security",
|
|
54
|
+
"xss",
|
|
55
|
+
"@bigbinary/neeto",
|
|
56
|
+
],
|
|
57
|
+
rules: {
|
|
58
|
+
// auto-fixable: Respect all Prettier rules and apply it.
|
|
59
|
+
"prettier/prettier": "error",
|
|
60
|
+
// not-auto-fixable: No unused variables allowed.
|
|
61
|
+
"no-unused-vars": [
|
|
62
|
+
"error",
|
|
63
|
+
{
|
|
64
|
+
args: "all",
|
|
65
|
+
argsIgnorePattern: "^_",
|
|
66
|
+
destructuredArrayIgnorePattern: "^_",
|
|
67
|
+
caughtErrors: "all",
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
// not-auto-fixable: No undefined variables allowed.
|
|
71
|
+
"no-undef": "error",
|
|
72
|
+
// not-auto-fixable: Dont use console statements. Use logger which babel will remove during bundling.
|
|
73
|
+
"no-console": "error",
|
|
74
|
+
// not-auto-fixable: require `return` statements to either always or never specify values.
|
|
75
|
+
"consistent-return": "error",
|
|
76
|
+
// auto-fixable: disallows repeating variable name when declaring object properties.
|
|
77
|
+
"object-shorthand": "error",
|
|
78
|
+
// auto-fixable: sadly this doesn't support guard clauses yet.
|
|
79
|
+
"padding-line-between-statements": [
|
|
80
|
+
"error",
|
|
81
|
+
{ blankLine: "always", prev: "if", next: ["if", "return"] },
|
|
82
|
+
// The newline-before-return rule is deprecated in favor of the following:
|
|
83
|
+
{ blankLine: "always", prev: "*", next: "return" },
|
|
84
|
+
// Add newline between function declarations
|
|
85
|
+
{
|
|
86
|
+
blankLine: "always",
|
|
87
|
+
prev: [
|
|
88
|
+
"block",
|
|
89
|
+
"multiline-block-like",
|
|
90
|
+
"function",
|
|
91
|
+
"iife",
|
|
92
|
+
"multiline-const",
|
|
93
|
+
"multiline-expression",
|
|
94
|
+
],
|
|
95
|
+
next: ["function", "iife", "multiline-const", "multiline-expression"],
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
// auto-fixable: Single line statements needn't have any braces. But in all other cases enforce curly braces.
|
|
99
|
+
curly: ["error", "multi-line"],
|
|
100
|
+
// auto-fixable: Remove the else part, if the "if" or "else-if" chain has a return statement
|
|
101
|
+
"no-else-return": "error",
|
|
102
|
+
// not-auto-fixable: Prevent un-sanitized dangerouslySetInnerHTML.
|
|
103
|
+
"jam3/no-sanitizer-with-danger": [
|
|
104
|
+
2,
|
|
105
|
+
{ wrapperName: ["dompurify", "sanitizer", "sanitize"] },
|
|
106
|
+
],
|
|
107
|
+
// auto-fixable: Requires trailing commas when the last element or property is in a different line than the closing ] or }
|
|
108
|
+
"comma-dangle": [
|
|
109
|
+
"error",
|
|
110
|
+
{
|
|
111
|
+
arrays: "always-multiline",
|
|
112
|
+
objects: "always-multiline",
|
|
113
|
+
imports: "always-multiline",
|
|
114
|
+
exports: "always-multiline",
|
|
115
|
+
functions: "never",
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
// auto-fixable: If a variable is never reassigned, using the const declaration is better.
|
|
119
|
+
"prefer-const": "error",
|
|
120
|
+
// auto-fixable: It is considered good practice to use the type-safe equality operators === and !==.
|
|
121
|
+
eqeqeq: "error",
|
|
122
|
+
// not-auto-fixable: Rule flags optional chaining expressions in positions where short-circuiting to undefined causes throwing a TypeError afterward.
|
|
123
|
+
"no-unsafe-optional-chaining": "error",
|
|
124
|
+
// auto-fixable: Remove all unused imports.
|
|
125
|
+
"unused-imports/no-unused-imports": "error",
|
|
126
|
+
// auto-fixable-1-level-deep: Using nested ternary operators make the code unreadable. Use if/else or switch with if/else. If it's JSX then move it out into a function or a variable. It's fine to use nestedTernary in JSX when it makes code more readable.
|
|
127
|
+
"no-nested-ternary": "warn",
|
|
128
|
+
// auto-fixable: Enforces no braces where they can be omitted.
|
|
129
|
+
"arrow-body-style": ["error", "as-needed"],
|
|
130
|
+
// auto-fixable: Suggests using template literals instead of string concatenation.
|
|
131
|
+
"prefer-template": "error",
|
|
132
|
+
// auto-fixable: Disallows ternary operators when simpler alternatives exist.
|
|
133
|
+
"no-unneeded-ternary": ["error", { defaultAssignment: false }],
|
|
134
|
+
// not-auto-fixable: Enforces declaring default params last
|
|
135
|
+
"default-param-last": "error",
|
|
136
|
+
// not-auto-fixable: Remove redundant async-awaits
|
|
137
|
+
"no-return-await": "warn",
|
|
138
|
+
// not-auto-fixable: Disallow empty block statements
|
|
139
|
+
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
140
|
+
// not-auto-fixable: Enforce return statements in callbacks of array methods.
|
|
141
|
+
"array-callback-return": ["error"],
|
|
142
|
+
// auto-fixable: Partially fixable. Unless there's a need to the this keyword, there's no advantage of using a plain function.
|
|
143
|
+
"prefer-arrow-callback": ["error", { allowUnboundThis: true }],
|
|
144
|
+
// not-auto-fixable: Convert multiple imports from same module into a single import.
|
|
145
|
+
"no-duplicate-imports": ["error", { includeExports: true }],
|
|
146
|
+
// auto-fixable: Partially fixable. In JavaScript, there are a lot of different ways to convert value types. Allow only readable coercions.
|
|
147
|
+
"no-implicit-coercion": ["error", { allow: ["!!"] }],
|
|
148
|
+
// auto-fixable: Require let or const instead of var.
|
|
149
|
+
"no-var": "error",
|
|
150
|
+
// auto-fixable: This rule conflicts with prettier rules. Thus we've NOT kept this rule in react file. This rule ensures we don't add blank lines in JSX.
|
|
151
|
+
"react/jsx-newline": ["error", { prevent: true }],
|
|
152
|
+
// not-auto-fixable: Disallow async functions which have no await expression
|
|
153
|
+
"require-await": "error",
|
|
154
|
+
// auto-fixable: This rule ensures immediate returns in functions where constants are declared and then directly returned.
|
|
155
|
+
"sonarjs/prefer-immediate-return": "error",
|
|
156
|
+
// not-auto-fixable: This rule enforces merging adjacent collapsible if statements.
|
|
157
|
+
"sonarjs/no-collapsible-if": "error",
|
|
158
|
+
// not-auto-fixable: This rule prevents identical conditions inside if-else statements.
|
|
159
|
+
"sonarjs/no-identical-conditions": "error",
|
|
160
|
+
// not-auto-fixable: This rule prevents using a function with no return as output, passing it to another function, or assigning its result to a variable.
|
|
161
|
+
"sonarjs/no-use-of-empty-return-value": "error",
|
|
162
|
+
// not-auto-fixable: This rule prevents using loops with at most one iteration.
|
|
163
|
+
"sonarjs/no-one-iteration-loop": "error",
|
|
164
|
+
// not-auto-fixable: This rule prevents using catch clause that only throws an error.
|
|
165
|
+
"sonarjs/no-useless-catch": "error",
|
|
166
|
+
// not-auto-fixable: This rule warns against "eval(variable)" which can allow an attacker to run arbitrary code inside your process.
|
|
167
|
+
"security/detect-eval-with-expression": "warn",
|
|
168
|
+
// not-auto-fixable: This rule ensures that you are calling escape function before location.href assignment.
|
|
169
|
+
"xss/no-location-href-assign": ["error", { escapeFunc: "sanitize" }],
|
|
170
|
+
},
|
|
171
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
// Currently we are using this section for excluding certain files from certain rules.
|
|
3
|
+
overrides: [
|
|
4
|
+
{
|
|
5
|
+
files: [
|
|
6
|
+
".eslintrc.js",
|
|
7
|
+
".prettierrc.js",
|
|
8
|
+
"app/assets/**/*",
|
|
9
|
+
"app/javascript/packs/**/*",
|
|
10
|
+
"*.json",
|
|
11
|
+
],
|
|
12
|
+
rules: {
|
|
13
|
+
"import/order": "off",
|
|
14
|
+
"react-hooks/rules-of-hooks": "off",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
files: ["app/javascript/packs/**/*.{js,jsx}"],
|
|
19
|
+
rules: {
|
|
20
|
+
"no-redeclare": "off",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
files: ["**/*.spec.js", "**/*.spec.jsx"],
|
|
25
|
+
env: {
|
|
26
|
+
jest: true,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
rules: {
|
|
3
|
+
// not-auto-fixable: ensure people use async/await promising chaining rather than using "then-catch-finally" statements
|
|
4
|
+
"promise/prefer-await-to-then": "error",
|
|
5
|
+
// auto-fixable: avoid calling "new" on a Promise static method like reject, resolve etc
|
|
6
|
+
"promise/no-new-statics": "error",
|
|
7
|
+
},
|
|
8
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
rules: {
|
|
3
|
+
// not-auto-fixable: Prevent missing props validation in a React component definition.
|
|
4
|
+
"react/prop-types": "off",
|
|
5
|
+
// not-auto-fixable: Detect unescaped HTML entities, which might represent malformed tags.
|
|
6
|
+
"react/no-unescaped-entities": "off",
|
|
7
|
+
// not-auto-fixable: Prevent missing displayName in a React component definition. Useful when using React extensions in browser and checking for component name.
|
|
8
|
+
"react/display-name": "error",
|
|
9
|
+
// not-auto-fixable: Reports when this.state is accessed within setState.
|
|
10
|
+
"react/no-access-state-in-setstate": "error",
|
|
11
|
+
// not-auto-fixable: Prevent usage of dangerous JSX props. Currently jam3 plugin will take care of handling this.
|
|
12
|
+
"react/no-danger": "off",
|
|
13
|
+
// not-auto-fixable: Report when a DOM element is using both children and dangerouslySetInnerHTML.
|
|
14
|
+
"react/no-danger-with-children": "warn",
|
|
15
|
+
// not-auto-fixable: Prevent definitions of unused prop types.
|
|
16
|
+
"react/no-unused-prop-types": "error",
|
|
17
|
+
// not-auto-fixable: Report missing key props in iterators/collection literals. Important rule!
|
|
18
|
+
"react/jsx-key": ["error", { checkFragmentShorthand: true }],
|
|
19
|
+
// not-auto-fixable: Enforce no duplicate props.
|
|
20
|
+
"react/jsx-no-duplicate-props": "error",
|
|
21
|
+
// not-auto-fixable: Disallow undeclared variables in JSX.
|
|
22
|
+
"react/jsx-no-undef": "error",
|
|
23
|
+
// not-auto-fixable: Enforce PascalCase for user-defined JSX components.
|
|
24
|
+
"react/jsx-pascal-case": ["error", { allowNamespace: true }],
|
|
25
|
+
// not-auto-fixable: Prevent React to be incorrectly marked as unused.
|
|
26
|
+
"react/jsx-uses-react": "error",
|
|
27
|
+
// not-auto-fixable: Prevent variables used in JSX to be marked as unused.
|
|
28
|
+
"react/jsx-uses-vars": "error",
|
|
29
|
+
// not-auto-fixable: Ensures https://reactjs.org/docs/hooks-rules.html.
|
|
30
|
+
"react-hooks/rules-of-hooks": "error",
|
|
31
|
+
// not-auto-fixable: Ensures https://reactjs.org/docs/hooks-rules.html - Checks effect dependencies.
|
|
32
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
33
|
+
// auto-fixable: A fragment is redundant if it contains only one child, or if it is the child of a html element, and is not a keyed fragment.
|
|
34
|
+
"react/jsx-no-useless-fragment": ["error", { allowExpressions: true }],
|
|
35
|
+
// auto-fixable: Prefer arrow function expressions for component declaration.
|
|
36
|
+
"react/function-component-definition": [
|
|
37
|
+
"error",
|
|
38
|
+
{
|
|
39
|
+
namedComponents: "arrow-function",
|
|
40
|
+
unnamedComponents: "arrow-function",
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
// auto-fixable: Components without children can be self-closed to avoid unnecessary extra closing tag.
|
|
44
|
+
"react/self-closing-comp": [
|
|
45
|
+
"error",
|
|
46
|
+
{
|
|
47
|
+
component: true,
|
|
48
|
+
html: true,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
// auto-fixable: Wrapping multiline JSX in parentheses can improve readability and/or convenience.
|
|
52
|
+
"react/jsx-wrap-multilines": [
|
|
53
|
+
"error",
|
|
54
|
+
{
|
|
55
|
+
declaration: "parens-new-line",
|
|
56
|
+
assignment: "parens-new-line",
|
|
57
|
+
return: "parens-new-line",
|
|
58
|
+
arrow: "parens-new-line",
|
|
59
|
+
condition: "parens-new-line",
|
|
60
|
+
logical: "parens-new-line",
|
|
61
|
+
prop: "ignore",
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
// not-auto-fixable: Make sure files containing JSX is having .jsx extension.
|
|
65
|
+
"react/jsx-filename-extension": ["error", { allow: "as-needed" }],
|
|
66
|
+
// auto-fixable: Omit mentioning the "true" value if it can be implicitly understood in props.
|
|
67
|
+
"react/jsx-boolean-value": "error",
|
|
68
|
+
// auto-fixable: Partially fixable. Make sure the state and setter have symmertic naming.
|
|
69
|
+
"react/hook-use-state": "error",
|
|
70
|
+
// auto-fixable: Shorthand notations should always be at the top and also enforce props alphabetical sorting.
|
|
71
|
+
"react/jsx-sort-props": [
|
|
72
|
+
"error",
|
|
73
|
+
{
|
|
74
|
+
callbacksLast: true,
|
|
75
|
+
shorthandFirst: true,
|
|
76
|
+
multiline: "last",
|
|
77
|
+
reservedFirst: false,
|
|
78
|
+
locale: "auto",
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
// auto-fixable: Disallow unnecessary curly braces in JSX props and/or children.
|
|
82
|
+
"react/jsx-curly-brace-presence": [
|
|
83
|
+
"error",
|
|
84
|
+
{
|
|
85
|
+
props: "never",
|
|
86
|
+
children: "never",
|
|
87
|
+
// JSX prop values that are JSX elements should be enclosed in braces.
|
|
88
|
+
propElementValues: "always",
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const { assocPath } = require("ramda");
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
buildPathGroupsBasedOnWebpackAliases,
|
|
5
|
+
} = require("../../../eslint/helpers");
|
|
6
|
+
const commonConfig = require("../../../eslint/imports/order");
|
|
7
|
+
|
|
8
|
+
const pathGroups = buildPathGroupsBasedOnWebpackAliases({
|
|
9
|
+
customAliasPath: "resolve.js",
|
|
10
|
+
commonAliasPath:
|
|
11
|
+
"node_modules/@bigbinary/neeto-commons-frontend/configs/nanos/webpack/resolve.js",
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const pathGroupForKeepingReactImportsAtTop = {
|
|
15
|
+
pattern: "react+(-native|)",
|
|
16
|
+
group: "external",
|
|
17
|
+
position: "before",
|
|
18
|
+
};
|
|
19
|
+
pathGroups.push(pathGroupForKeepingReactImportsAtTop);
|
|
20
|
+
|
|
21
|
+
module.exports = assocPath(
|
|
22
|
+
["rules", "import/order", 1, "pathGroups"],
|
|
23
|
+
pathGroups,
|
|
24
|
+
commonConfig
|
|
25
|
+
);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const { mergeLeft } = require("ramda");
|
|
2
|
+
|
|
3
|
+
const commonConfiguration = require("../../eslint");
|
|
4
|
+
|
|
5
|
+
const isCommonsFrontend = !__dirname.includes("node_modules");
|
|
6
|
+
|
|
7
|
+
const configsPath = isCommonsFrontend
|
|
8
|
+
? "./configs"
|
|
9
|
+
: "./node_modules/@bigbinary/neeto-commons-frontend/configs";
|
|
10
|
+
|
|
11
|
+
const nanosConfiguration = {
|
|
12
|
+
extends: [
|
|
13
|
+
"plugin:@bigbinary/neeto/nanos-recommended",
|
|
14
|
+
"plugin:cypress/recommended",
|
|
15
|
+
"plugin:json/recommended",
|
|
16
|
+
"eslint:recommended",
|
|
17
|
+
"plugin:react/recommended",
|
|
18
|
+
`${configsPath}/eslint/globals`,
|
|
19
|
+
`${configsPath}/nanos/eslint/imports/order`,
|
|
20
|
+
`${configsPath}/eslint/overrides`,
|
|
21
|
+
`${configsPath}/eslint/imports/enforced`,
|
|
22
|
+
`${configsPath}/eslint/react`,
|
|
23
|
+
`${configsPath}/eslint/promise`,
|
|
24
|
+
"prettier",
|
|
25
|
+
],
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
module.exports = mergeLeft(nanosConfiguration, commonConfiguration);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
important: true,
|
|
3
|
+
purge: {
|
|
4
|
+
enabled: process.env.NODE_ENV === "production",
|
|
5
|
+
content: [
|
|
6
|
+
"./{src,example,stories}/**/*.{js,jsx}",
|
|
7
|
+
"./node_modules/@bigbinary/**/*.js",
|
|
8
|
+
],
|
|
9
|
+
defaultExtractor: content => content.match(/[A-Za-z0-9-_:/]+/g) || [],
|
|
10
|
+
},
|
|
11
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
|
|
3
|
+
const isCommonsFrontend = !__dirname.includes("node_modules");
|
|
4
|
+
|
|
5
|
+
const absolutePath = basePath =>
|
|
6
|
+
isCommonsFrontend
|
|
7
|
+
? path.join(__dirname, "../../../", basePath)
|
|
8
|
+
: path.join(__dirname, "../../../../../../", basePath);
|
|
9
|
+
|
|
10
|
+
module.exports = {
|
|
11
|
+
alias: {
|
|
12
|
+
apis: absolutePath("src/apis"),
|
|
13
|
+
assets: absolutePath("src/assets"),
|
|
14
|
+
components: absolutePath("src/components"),
|
|
15
|
+
hooks: absolutePath("src/hooks"),
|
|
16
|
+
reducers: absolutePath("src/reducers"),
|
|
17
|
+
routes: absolutePath("src/routes"),
|
|
18
|
+
stores: absolutePath("src/stores"),
|
|
19
|
+
translations: absolutePath("src/translations"),
|
|
20
|
+
utils: absolutePath("src/utils"),
|
|
21
|
+
src: absolutePath("src"),
|
|
22
|
+
neetoui: "@bigbinary/neetoui",
|
|
23
|
+
neetocommons: "@bigbinary/neeto-commons-frontend",
|
|
24
|
+
neetoicons: "@bigbinary/neeto-icons",
|
|
25
|
+
neetoteam: "@bigbinary/neeto-team-members-frontend",
|
|
26
|
+
neetoeditor: "@bigbinary/neeto-editor",
|
|
27
|
+
neetofilters: "@bigbinary/neeto-filters-frontend",
|
|
28
|
+
neetomolecules: "@bigbinary/neeto-molecules",
|
|
29
|
+
neetocist: "@bigbinary/neeto-cist",
|
|
30
|
+
},
|
|
31
|
+
extensions: [
|
|
32
|
+
".ts",
|
|
33
|
+
".mjs",
|
|
34
|
+
".js",
|
|
35
|
+
".jsx",
|
|
36
|
+
".sass",
|
|
37
|
+
".scss",
|
|
38
|
+
".css",
|
|
39
|
+
".module.sass",
|
|
40
|
+
".module.scss",
|
|
41
|
+
".module.css",
|
|
42
|
+
".png",
|
|
43
|
+
".svg",
|
|
44
|
+
".gif",
|
|
45
|
+
".jpeg",
|
|
46
|
+
".jpg",
|
|
47
|
+
],
|
|
48
|
+
};
|