diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index c8ff0a1e..23fa6a53 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -1,7 +1,7 @@ name: Deploy Documentation on: push: - branches: ["main", "2.*"] + branches: ['main', '2.*'] paths: - website/** @@ -16,7 +16,7 @@ permissions: id-token: write concurrency: - group: "pages" + group: 'pages' cancel-in-progress: false jobs: diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 00000000..72c8d15c --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +yarn test && yarn lint-staged diff --git a/.prettierrc b/.prettierrc index e9c9f029..8296facc 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,11 +1,8 @@ { "semi": false, "singleQuote": true, - "trailingComma": "es5", - "printWidth": 80, - "tabWidth": 2, - "jsxSingleQuote": false, - "jsxBracketSameLine": false, - "arrowParens": "always", - "endOfLine": "lf" + "plugins": ["@trivago/prettier-plugin-sort-imports"], + "importOrder": ["^react$", "^@/(.*)$", "^[./]"], + "importOrderSeparation": true, + "importOrderSortSpecifiers": true } diff --git a/build/remote-env.cjs b/build/remote-env.cjs index cb7c8230..e9e0aff4 100644 --- a/build/remote-env.cjs +++ b/build/remote-env.cjs @@ -13,7 +13,7 @@ log.blue(`MFE manage env for remote (micro-frontend)`) const nameOfMfeEnv = 'swEnv.js' const entryScriptPath = path.resolve( - `${process.cwd()}/dist/assets/${process.argv[2]}` + `${process.cwd()}/dist/assets/${process.argv[2]}`, ) const swEnvScriptPath = path.resolve(`${process.cwd()}/dist/${nameOfMfeEnv}`) @@ -27,6 +27,6 @@ if (isSwEnvScriptExists && isEntryScriptExists) { log.green(`✓ Added env file inside ${entryScriptPath}`) } else { log.red( - `x Nothing to do. Are you using vite-envs and federation plugin in your configuration vite.config.ts ?` + `x Nothing to do. Are you using vite-envs and federation plugin in your configuration vite.config.ts ?`, ) } diff --git a/eslint.config.js b/eslint.config.js index fa3faf3a..3e55efcd 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,30 +1,45 @@ +import js from '@eslint/js' +import reactHooks from 'eslint-plugin-react-hooks' +import reactRefresh from 'eslint-plugin-react-refresh' import globals from 'globals' -import pluginJs from '@eslint/js' import tseslint from 'typescript-eslint' -import pluginReact from 'eslint-plugin-react' -import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended' -export default [ - { files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'] }, - { languageOptions: { globals: globals.browser } }, - pluginJs.configs.recommended, - ...tseslint.configs.recommended, - pluginReact.configs.flat['jsx-runtime'], - eslintPluginPrettierRecommended, +export default tseslint.config( { - settings: { react: { version: '18.3' } }, - rules: { - '@typescript-eslint/no-explicit-any': 'off', - '@typescript-eslint/no-namespace': 'off', - '@typescript-eslint/no-unused-expressions': 'off', - '@typescript-eslint/no-unused-vars': 'off', - '@typescript-eslint/no-empty-object-type': 'off', - }, + ignores: ['dist', 'src/vite-env.d.ts'], + }, + { + extends: [js.configs.recommended, ...tseslint.configs.recommended], + files: ['src/**/*.{ts,tsx}'], languageOptions: { + ecmaVersion: 2020, globals: { + ...globals.browser, + ...globals.worker, importScripts: 'readonly', workbox: 'readonly', }, + parserOptions: { + project: './tsconfig.json', + }, + }, + plugins: { + 'react-hooks': reactHooks, + 'react-refresh': reactRefresh, + }, + rules: { + ...reactHooks.configs.recommended.rules, + // see https://typescript-eslint.netlify.app/rules/no-unused-vars/ + '@typescript-eslint/no-unused-vars': [ + 'error', + { argsIgnorePattern: '^_' }, + ], + '@typescript-eslint/no-explicit-any': ['off'], + '@typescript-eslint/no-namespace': ['off'], + 'react-refresh/only-export-components': [ + 'warn', + { allowConstantExport: true }, + ], }, }, -] +) diff --git a/index.html b/index.html index 904abf66..261380a4 100644 --- a/index.html +++ b/index.html @@ -1,23 +1,23 @@ - + +
+ + + + + + + + - - - - - - - - - +