From 46dc96b026c014b26d0bb45bfac39e5e87fbd74d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Vanvelthem?= Date: Sun, 10 Apr 2022 14:44:42 +0200 Subject: [PATCH 01/22] feat: new centralized custom eslint configs --- tools/eslint-config-bases/.eslintrc.js | 5 + tools/eslint-config-bases/README.md | 11 ++ .../eslint-config-bases/lint-staged.config.js | 36 ++++ tools/eslint-config-bases/package.json | 98 ++++++++++ .../src/bases/graphql-schema.js | 15 ++ tools/eslint-config-bases/src/bases/jest.js | 18 ++ .../src/bases/playwright.js | 19 ++ .../src/bases/react-testing-library.js | 26 +++ tools/eslint-config-bases/src/bases/react.js | 48 +++++ tools/eslint-config-bases/src/bases/sonar.js | 26 +++ .../src/bases/storybook.js | 12 ++ .../src/bases/typescript.js | 168 ++++++++++++++++++ tools/eslint-config-bases/src/index.js | 14 ++ tools/eslint-config-bases/tsconfig.json | 11 ++ 14 files changed, 507 insertions(+) create mode 100644 tools/eslint-config-bases/.eslintrc.js create mode 100644 tools/eslint-config-bases/README.md create mode 100644 tools/eslint-config-bases/lint-staged.config.js create mode 100644 tools/eslint-config-bases/package.json create mode 100644 tools/eslint-config-bases/src/bases/graphql-schema.js create mode 100644 tools/eslint-config-bases/src/bases/jest.js create mode 100644 tools/eslint-config-bases/src/bases/playwright.js create mode 100644 tools/eslint-config-bases/src/bases/react-testing-library.js create mode 100644 tools/eslint-config-bases/src/bases/react.js create mode 100644 tools/eslint-config-bases/src/bases/sonar.js create mode 100644 tools/eslint-config-bases/src/bases/storybook.js create mode 100644 tools/eslint-config-bases/src/bases/typescript.js create mode 100644 tools/eslint-config-bases/src/index.js create mode 100644 tools/eslint-config-bases/tsconfig.json diff --git a/tools/eslint-config-bases/.eslintrc.js b/tools/eslint-config-bases/.eslintrc.js new file mode 100644 index 00000000000..aa11bbf6fcc --- /dev/null +++ b/tools/eslint-config-bases/.eslintrc.js @@ -0,0 +1,5 @@ +module.exports = { + root: true, + ignorePatterns: ['**/node_modules/**', '**/dist/**'], + extends: ['./src/bases/typescript'], +}; diff --git a/tools/eslint-config-bases/README.md b/tools/eslint-config-bases/README.md new file mode 100644 index 00000000000..c5c3672b4d9 --- /dev/null +++ b/tools/eslint-config-bases/README.md @@ -0,0 +1,11 @@ +# @your-org/eslint-config + +

+ + build + +

+ +## Intro + +WIP diff --git a/tools/eslint-config-bases/lint-staged.config.js b/tools/eslint-config-bases/lint-staged.config.js new file mode 100644 index 00000000000..b00a6d80ae4 --- /dev/null +++ b/tools/eslint-config-bases/lint-staged.config.js @@ -0,0 +1,36 @@ +// @ts-check + +/** + * This files overrides the base lint-staged.config.js present in the root directory. + * It allows to run eslint based the package specific requirements. + * {@link https://github.com/okonet/lint-staged#how-to-use-lint-staged-in-a-multi-package-monorepo} + * {@link https://github.com/belgattitude/nextjs-monorepo-example/blob/main/docs/about-lint-staged.md} + */ + +const { + concatFilesForPrettier, + getEslintFixCmd, +} = require('../../lint-staged.common.js'); + +/** + * @type {Record string | string[] | Promise>} + */ +const rules = { + '**/*.{js,jsx,ts,tsx}': (filenames) => { + return getEslintFixCmd({ + cwd: __dirname, + fix: true, + cache: true, + // when autofixing staged-files a good tip is to disable react-hooks/exhaustive-deps, cause + // a change here can potentially break things without proper visibility. + rules: ['react-hooks/exhaustive-deps: off'], + maxWarnings: 25, + files: filenames, + }); + }, + '**/*.{json,md,mdx,css,html,yml,yaml,scss}': (filenames) => { + return [`prettier --write ${concatFilesForPrettier(filenames)}`]; + }, +}; + +module.exports = rules; diff --git a/tools/eslint-config-bases/package.json b/tools/eslint-config-bases/package.json new file mode 100644 index 00000000000..abd5dd8b64c --- /dev/null +++ b/tools/eslint-config-bases/package.json @@ -0,0 +1,98 @@ +{ + "name": "@your-org/eslint-config-bases", + "version": "1.0.0", + "license": "MIT", + "private": true, + "homepage": "https://github.com/belgattitude/nextjs-monorepo-example", + "repository": { + "type": "git", + "url": "https://github.com/belgattitude/nextjs-monorepo-example", + "directory": "tools/eslint-config-bases" + }, + "author": { + "name": "Vanvelthem Sébastien", + "url": "https://github.com/belgattitude" + }, + "main": "./index.js", + "exports": { + ".": { + "require": "./src/index.js" + }, + "./graphql-schema": { + "require": "./src/bases/graphql-schema.js" + }, + "./jest": { + "require": "./src/bases/jest.js" + }, + "./playwright": { + "require": "./src/bases/playwright.js" + }, + "./react": { + "require": "./src/bases/react.js" + }, + "./react-testing-library": { + "require": "./src/bases/react-testing-library.js" + }, + "./sonar": { + "require": "./src/bases/sonar.js" + }, + "./storybook": { + "require": "./src/bases/react.js" + }, + "./typescript": { + "require": "./src/bases/typescript.js" + } + }, + "scripts": { + "clean": "rimraf --no-glob ./dist ./coverage ./tsconfig.tsbuildinfo ./.eslintcache && jest --clear-cache", + "lint": "eslint . --ext .ts,.js", + "typecheck": "tsc --project ./tsconfig.json --noEmit", + "fix-all-files": "eslint . --ext .ts,.tsx,.js,.jsx --fix" + }, + "dependencies": { + "@testing-library/jest-dom": "5.16.4", + "@testing-library/react": "13.0.0", + "@testing-library/react-hooks": "7.0.2", + "@types/jest": "27.4.1", + "@types/node": "17.0.23", + "@types/react": "17.0.44", + "@types/react-dom": "17.0.15", + "@typescript-eslint/eslint-plugin": "5.18.0", + "@typescript-eslint/parser": "5.18.0", + "eslint": "8.13.0", + "eslint-config-prettier": "8.5.0", + "eslint-import-resolver-typescript": "2.7.1", + "eslint-plugin-import": "2.26.0", + "eslint-plugin-jest": "26.1.4", + "eslint-plugin-jest-formatting": "3.1.0", + "eslint-plugin-jsx-a11y": "6.5.1", + "eslint-plugin-playwright": "0.8.0", + "eslint-plugin-prettier": "4.0.0", + "eslint-plugin-react": "7.29.4", + "eslint-plugin-react-hooks": "4.4.0", + "eslint-plugin-regexp": "1.6.0", + "eslint-plugin-sonarjs": "0.13.0", + "eslint-plugin-testing-library": "5.2.1", + "prettier": "2.6.2", + "rimraf": "3.0.2" + }, + "peerDependencies": { + "react": "^17.0.2 || ^18.0.0", + "react-dom": "^17.0.2 || ^18.0.0", + "typescript": "^4.5.0" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + }, + "react-dom": { + "optional": true + } + }, + "devDependencies": { + "@graphql-eslint/eslint-plugin": "3.10.2", + "react": "^18.0.0", + "react-dom": "^18.0.0", + "typescript": "4.6.3" + } +} diff --git a/tools/eslint-config-bases/src/bases/graphql-schema.js b/tools/eslint-config-bases/src/bases/graphql-schema.js new file mode 100644 index 00000000000..640b369dbe2 --- /dev/null +++ b/tools/eslint-config-bases/src/bases/graphql-schema.js @@ -0,0 +1,15 @@ +/** + * Custom config base for projects using graphql schemas (*.graphql) + * @see https://github.com/B2o5T/graphql-eslint + */ +module.exports = { + overrides: [ + { + files: ['*.graphql'], + extends: 'plugin:@graphql-eslint/schema-recommended', + rules: { + '@graphql-eslint/known-type-names': 'error', + }, + }, + ], +}; diff --git a/tools/eslint-config-bases/src/bases/jest.js b/tools/eslint-config-bases/src/bases/jest.js new file mode 100644 index 00000000000..e8c2b75c534 --- /dev/null +++ b/tools/eslint-config-bases/src/bases/jest.js @@ -0,0 +1,18 @@ +/** + * Custom config base for projects using jest. + * @see https://github.com/jest-community/eslint-plugin-jest + */ +module.exports = { + overrides: [ + { + // Perf: To ensure best performance enable eslint-plugin-jest for test files only. + files: ['**/?(*.)+(test).{js,jsx,ts,tsx}'], + extends: ['plugin:jest/recommended'], + rules: { + '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/no-object-literal-type-assertion': 'off', + '@typescript-eslint/no-empty-function': 'off', + }, + }, + ], +}; diff --git a/tools/eslint-config-bases/src/bases/playwright.js b/tools/eslint-config-bases/src/bases/playwright.js new file mode 100644 index 00000000000..93452ec3de0 --- /dev/null +++ b/tools/eslint-config-bases/src/bases/playwright.js @@ -0,0 +1,19 @@ +/** + * Custom config base for projects using playwright. + * @see https://github.com/playwright-community/eslint-plugin-playwright + */ +module.exports = { + overrides: [ + { + // To ensure best performance enable jest/recommended only on test files + // PS: *.e2e.ts convention is used to disambiguate from regular *.test.[jt]sx? files + files: ['*.e2e.ts'], + extends: ['plugin:playwright/recommended'], + rules: { + '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/no-object-literal-type-assertion': 'off', + '@typescript-eslint/no-empty-function': 'off', + }, + }, + ], +}; diff --git a/tools/eslint-config-bases/src/bases/react-testing-library.js b/tools/eslint-config-bases/src/bases/react-testing-library.js new file mode 100644 index 00000000000..d9935af149b --- /dev/null +++ b/tools/eslint-config-bases/src/bases/react-testing-library.js @@ -0,0 +1,26 @@ +/** + * Custom config base for projects using react-testing-library + */ +module.exports = { + overrides: [ + { + // For performance enable jest/recommended only on test files + files: ['**/__tests__/**/*.{ts,tsx}'], + extends: ['plugin:testing-library/react'], + }, + { + files: ['**/test-utils.tsx'], + rules: { + '@typescript-eslint/explicit-module-boundary-types': 'off', + 'import/export': 'off', + }, + }, + { + files: ['**/test-utils.tsx'], + rules: { + '@typescript-eslint/explicit-module-boundary-types': 'off', + 'import/export': 'off', + }, + }, + ], +}; diff --git a/tools/eslint-config-bases/src/bases/react.js b/tools/eslint-config-bases/src/bases/react.js new file mode 100644 index 00000000000..e9e2a4fe1de --- /dev/null +++ b/tools/eslint-config-bases/src/bases/react.js @@ -0,0 +1,48 @@ +module.exports = { + env: { + browser: true, + es6: true, + }, + settings: { + react: { + version: 'detect', + }, + }, + overrides: [ + { + files: ['*.tsx', '*.jsx'], + extends: [ + // @see https://github.com/yannickcr/eslint-plugin-react + 'plugin:react/recommended', + // @see https://www.npmjs.com/package/eslint-plugin-react-hooks + 'plugin:react-hooks/recommended', + // @see https://github.com/jsx-eslint/eslint-plugin-jsx-a11y + 'plugin:jsx-a11y/recommended', + ], + rules: { + // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unescaped-entities.md + 'react/no-unescaped-entities': ['error', { forbid: ['>'] }], + 'react/prop-types': 'off', + 'react/react-in-jsx-scope': 'off', + // Fine-tune naming convention react typescript jsx (function components) + // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/naming-convention.md + '@typescript-eslint/naming-convention': [ + 'warn', + { + selector: 'variable', + format: ['camelCase', 'PascalCase'], + }, + { + selector: ['function'], + format: ['camelCase', 'PascalCase'], + }, + { + selector: 'parameter', + format: ['camelCase', 'PascalCase'], + leadingUnderscore: 'allow', + }, + ], + }, + }, + ], +}; diff --git a/tools/eslint-config-bases/src/bases/sonar.js b/tools/eslint-config-bases/src/bases/sonar.js new file mode 100644 index 00000000000..c91f0a177e0 --- /dev/null +++ b/tools/eslint-config-bases/src/bases/sonar.js @@ -0,0 +1,26 @@ +/** + * Custom config base for projects that want to enable sonar-js + */ +module.exports = { + overrides: [ + { + files: ['**/*.{js,jsx,ts,tsx}'], + excludedFiles: ['**/__tests__/**/*.{js,jsx,ts,tsx}'], + extends: ['plugin:sonarjs/recommended'], + rules: { + 'sonarjs/no-nested-template-literals': 'off', + }, + }, + { + files: ['*.js', '*.cjs'], + parser: 'espree', + parserOptions: { + ecmaVersion: 2020, + }, + rules: { + 'sonarjs/no-duplicate-string': 'off', + 'sonarjs/no-all-duplicated-branches': 'off', + }, + }, + ], +}; diff --git a/tools/eslint-config-bases/src/bases/storybook.js b/tools/eslint-config-bases/src/bases/storybook.js new file mode 100644 index 00000000000..f299f6b6cdc --- /dev/null +++ b/tools/eslint-config-bases/src/bases/storybook.js @@ -0,0 +1,12 @@ +/** + * Custom config base for projects using storybook. + */ +module.exports = { + overrides: [ + { + // For performance run storybook/recommended on test files, not regular code + files: ['**/*.stories.{ts,tsx,mdx}'], + extends: ['plugin:storybook/recommended'], + }, + ], +}; diff --git a/tools/eslint-config-bases/src/bases/typescript.js b/tools/eslint-config-bases/src/bases/typescript.js new file mode 100644 index 00000000000..ab2f2001dc8 --- /dev/null +++ b/tools/eslint-config-bases/src/bases/typescript.js @@ -0,0 +1,168 @@ +/** + * Custom config base for projects using typescript / javascript. + */ +module.exports = { + env: { + node: true, + es6: true, + }, + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaFeatures: { + jsx: true, + globalReturn: false, + }, + ecmaVersion: 2020, + project: ['tsconfig.json'], + sourceType: 'module', + }, + settings: { + 'import/resolver': { + typescript: {}, + }, + }, + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:import/recommended', + 'plugin:import/typescript', + 'plugin:regexp/recommended', + 'plugin:prettier/recommended', + ], + rules: { + 'spaced-comment': [ + 'error', + 'always', + { + line: { + markers: ['/'], + exceptions: ['-', '+'], + }, + block: { + markers: ['!'], + exceptions: ['*'], + balanced: true, + }, + }, + ], + 'linebreak-style': ['error', 'unix'], + 'no-empty-function': 'off', + 'import/default': 'off', + 'import/no-named-as-default-member': 'off', + 'import/no-named-as-default': 'off', + 'import/order': [ + 'error', + { + groups: [ + 'builtin', + 'external', + 'internal', + 'parent', + 'sibling', + 'index', + 'object', + ], + alphabetize: { order: 'asc', caseInsensitive: true }, + }, + ], + '@typescript-eslint/ban-tslint-comment': ['error'], + '@typescript-eslint/ban-ts-comment': [ + 'error', + { + 'ts-expect-error': 'allow-with-description', + minimumDescriptionLength: 10, + 'ts-ignore': true, + 'ts-nocheck': true, + 'ts-check': false, + }, + ], + '@typescript-eslint/no-explicit-any': ['error', { ignoreRestArgs: false }], + '@typescript-eslint/no-empty-function': [ + 'error', + { allow: ['private-constructors'] }, + ], + '@typescript-eslint/no-unused-vars': [ + 'warn', + { argsIgnorePattern: '^_', ignoreRestSiblings: true }, + ], + '@typescript-eslint/consistent-type-exports': 'error', + '@typescript-eslint/consistent-type-imports': [ + 'error', + { prefer: 'type-imports' }, + ], + '@typescript-eslint/naming-convention': [ + 'error', + { + selector: 'default', + format: ['camelCase'], + leadingUnderscore: 'forbid', + trailingUnderscore: 'forbid', + }, + { + selector: 'variable', + format: ['camelCase'], + leadingUnderscore: 'allow', + }, + { + selector: ['function'], + format: ['camelCase'], + }, + { + selector: 'parameter', + format: ['camelCase'], + leadingUnderscore: 'allow', + }, + { + selector: 'class', + format: ['PascalCase'], + }, + { + selector: 'classProperty', + format: ['camelCase'], + }, + { + selector: 'objectLiteralProperty', + format: [ + 'camelCase', + // Some external libraries use snake_case for params + 'snake_case', + // Env variables are generally uppercase + 'UPPER_CASE', + ], + }, + { + selector: ['typeAlias', 'interface'], + format: ['PascalCase'], + }, + { + selector: ['typeProperty'], + format: ['camelCase'], + }, + { + selector: ['typeParameter'], + format: ['PascalCase'], + }, + ], + }, + overrides: [ + { + files: ['*.js', '*.cjs'], + parser: 'espree', + parserOptions: { + ecmaVersion: 2020, + }, + rules: { + '@typescript-eslint/naming-convention': 'off', + '@typescript-eslint/ban-ts-comment': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + 'sonarjs/no-duplicate-string': 'off', + 'sonarjs/no-all-duplicated-branches': 'off', + '@typescript-eslint/consistent-type-exports': 'off', + '@typescript-eslint/consistent-type-imports': 'off', + 'import/order': 'off', + }, + }, + ], +}; diff --git a/tools/eslint-config-bases/src/index.js b/tools/eslint-config-bases/src/index.js new file mode 100644 index 00000000000..e01aa3226b5 --- /dev/null +++ b/tools/eslint-config-bases/src/index.js @@ -0,0 +1,14 @@ +const bases = { + graphqlSchema: require('./bases/graphql-schema'), + jest: require('./bases/jest'), + playwright: require('./bases/playwright'), + react: require('./bases/react'), + reactTestingLibrary: require('./bases/react-testing-library'), + storybook: require('./bases/storybook'), + typescript: require('./bases/typescript'), + sonar: require('./bases/sonar'), +}; + +module.exports = { + bases, +}; diff --git a/tools/eslint-config-bases/tsconfig.json b/tools/eslint-config-bases/tsconfig.json new file mode 100644 index 00000000000..ba6c34dd31b --- /dev/null +++ b/tools/eslint-config-bases/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "strict": true, + "skipLibCheck": true, + "noEmit": true, + "incremental": true, + "allowJs": true, + "checkJs": true + }, + "exclude": ["**/node_modules", "**/.*/", "dist"] +} From c172cfbfc96398ff65a92b6d4dcf6a2a4f581a4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Vanvelthem?= Date: Sun, 10 Apr 2022 14:45:22 +0200 Subject: [PATCH 02/22] chore: use centralized linter config --- apps/nextjs-app/.eslintrc.js | 38 ++++++++-------------------- apps/nextjs-app/package.json | 20 +++------------ apps/remix-app/.eslintrc.js | 30 +++++----------------- apps/remix-app/package.json | 20 +++------------ apps/vite-app/.eslintrc.js | 27 +++++--------------- apps/vite-app/package.json | 14 +--------- packages/core-lib/.eslintrc.js | 28 ++++++-------------- packages/core-lib/package.json | 18 ------------- packages/db-main-prisma/.eslintrc.js | 14 ++++++---- packages/db-main-prisma/package.json | 11 +------- packages/ui-lib/.eslintrc.js | 32 ++++++----------------- packages/ui-lib/package.json | 17 +------------ 12 files changed, 57 insertions(+), 212 deletions(-) diff --git a/apps/nextjs-app/.eslintrc.js b/apps/nextjs-app/.eslintrc.js index 4148ec2124d..f183e3749fb 100644 --- a/apps/nextjs-app/.eslintrc.js +++ b/apps/nextjs-app/.eslintrc.js @@ -7,35 +7,24 @@ module.exports = { root: true, ignorePatterns: ['.next', '**/.out'], extends: [ - // Extend the monorepo default configuration - '../../.eslintrc.base.js', - // Add specific rules for react - 'plugin:react/recommended', - 'plugin:react-hooks/recommended', - 'plugin:jsx-a11y/recommended', + '@your-org/eslint-config-bases/typescript', + '@your-org/eslint-config-bases/sonar', + '@your-org/eslint-config-bases/jest', + '@your-org/eslint-config-bases/storybook', + '@your-org/eslint-config-bases/react', + '@your-org/eslint-config-bases/react-testing-library', + '@your-org/eslint-config-bases/graphql-schema', // Add specific rules for nextjs 'plugin:@next/next/core-web-vitals', ], - env: { - browser: true, - es6: true, - node: true, - }, rules: { - 'react/prop-types': 'off', - 'react/react-in-jsx-scope': 'off', - 'jsx-a11y/anchor-is-valid': 'off', - 'react/no-unescaped-entities': 'off', - // next/image might not be yet a good move as of NextJs v11. // https://github.com/vercel/next.js/discussions/16832 '@next/next/no-img-element': 'off', + // For the sake of example + // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/anchor-is-valid.md + 'jsx-a11y/anchor-is-valid': 'off', }, overrides: [ - { - // For performance run jest/recommended on test files, not regular code - files: ['**/*.test.{ts,tsx}'], - extends: ['plugin:testing-library/react'], - }, { files: ['src/pages/**/*.{ts,tsx}'], rules: { @@ -62,12 +51,5 @@ module.exports = { '@typescript-eslint/explicit-module-boundary-types': 'off', }, }, - { - files: ['config/jest/test-utils.tsx'], - rules: { - '@typescript-eslint/explicit-module-boundary-types': 'off', - 'import/export': 'off', - }, - }, ], }; diff --git a/apps/nextjs-app/package.json b/apps/nextjs-app/package.json index 07eee0341b4..34c2c247124 100644 --- a/apps/nextjs-app/package.json +++ b/apps/nextjs-app/package.json @@ -44,8 +44,8 @@ "test-unit": "jest --config jest.config.js", "test-e2e": "cross-env E2E_WEBSERVER_MODE=BUILD_AND_START playwright test", "typecheck": "tsc --project ./tsconfig.json --noEmit", - "lint": "eslint . --ext .ts,.tsx,.js,.jsx --cache", - "fix-all-files": "eslint . --ext .ts,.tsx,.js,.jsx --fix", + "lint": "eslint . --ext .ts,.tsx,.js,.jsx,.mdx,.graphql --cache", + "fix-all-files": "eslint . --ext .ts,.tsx,.js,.jsx,.mdx,.graphql --fix", "?postinstall": "@todo: the prisma generate seems to be required, but is installed at the root", "postinstall": "test -n \"$SKIP_POSTINSTALL\" || yarn workspace @your-org/db-main-prisma run prisma generate" }, @@ -69,27 +69,13 @@ "@types/node": "17.0.23", "@types/react": "17.0.44", "@types/react-dom": "17.0.15", - "@typescript-eslint/eslint-plugin": "5.18.0", - "@typescript-eslint/parser": "5.18.0", + "@your-org/eslint-config-bases": "workspace:^", "autoprefixer": "10.4.4", "cross-env": "7.0.3", "dotenv-flow": "3.2.0", "dotenv-flow-cli": "1.0.0", "es-check": "6.2.1", - "eslint": "8.13.0", "eslint-config-next": "12.1.4", - "eslint-config-prettier": "8.5.0", - "eslint-import-resolver-typescript": "2.7.1", - "eslint-plugin-import": "2.26.0", - "eslint-plugin-jest": "26.1.4", - "eslint-plugin-jest-formatting": "3.1.0", - "eslint-plugin-jsx-a11y": "6.5.1", - "eslint-plugin-prettier": "4.0.0", - "eslint-plugin-react": "7.29.4", - "eslint-plugin-react-hooks": "4.4.0", - "eslint-plugin-regexp": "1.6.0", - "eslint-plugin-sonarjs": "0.13.0", - "eslint-plugin-testing-library": "5.2.1", "jest": "27.5.1", "jest-css-modules-transform": "4.3.0", "npm-run-all": "4.1.5", diff --git a/apps/remix-app/.eslintrc.js b/apps/remix-app/.eslintrc.js index 0c6d529b164..9ac720f6421 100644 --- a/apps/remix-app/.eslintrc.js +++ b/apps/remix-app/.eslintrc.js @@ -7,12 +7,12 @@ module.exports = { root: true, ignorePatterns: ['public/build', 'api/build', '.cache'], extends: [ - // Extend the monorepo default configuration - '../../.eslintrc.base.js', - // Add specific rules for react - 'plugin:react/recommended', - 'plugin:react-hooks/recommended', - 'plugin:jsx-a11y/recommended', + '@your-org/eslint-config-bases/typescript', + '@your-org/eslint-config-bases/sonar', + '@your-org/eslint-config-bases/jest', + '@your-org/eslint-config-bases/react', + '@your-org/eslint-config-bases/react-testing-library', + '@your-org/eslint-config-bases/graphql-schema', // Specific rules for remix '@remix-run/eslint-config', ], @@ -22,23 +22,7 @@ module.exports = { node: true, }, rules: { - 'react/prop-types': 'off', - 'react/react-in-jsx-scope': 'off', 'jsx-a11y/anchor-is-valid': 'off', - 'react/no-unescaped-entities': 'off', - 'react/jsx-no-target-blank': 'off', }, - overrides: [ - { - // For performance run jest/recommended on test files, not regular code - files: ['**/*.test.{ts,tsx}'], - extends: ['plugin:testing-library/react'], - }, - { - files: ['config/jest/test-utils.tsx'], - rules: { - 'import/export': 'off', - }, - }, - ], + overrides: [], }; diff --git a/apps/remix-app/package.json b/apps/remix-app/package.json index 330ef6f3c92..0d2f1214e77 100644 --- a/apps/remix-app/package.json +++ b/apps/remix-app/package.json @@ -28,9 +28,9 @@ "test": "yarn test-unit", "test-unit": "jest --config jest.config.js", "typecheck": "tsc --project ./tsconfig.json --noEmit", - "lint": "eslint . --ext .ts,.tsx,.js,.jsx --cache", + "lint": "eslint . --ext .ts,.tsx,.js,.jsx,.mdx,.graphql --cache", "lint-styles": "stylelint 'src/**/*.css'", - "fix-all-files": "eslint . --ext .ts,.tsx,.js,.jsx --fix" + "fix-all-files": "eslint . --ext .ts,.tsx,.js,.jsx,.mdx,.graphql --fix" }, "dependencies": { "@emotion/cache": "11.7.1", @@ -59,23 +59,9 @@ "@testing-library/react-hooks": "7.0.2", "@types/react": "17.0.44", "@types/react-dom": "17.0.15", - "@typescript-eslint/eslint-plugin": "5.18.0", - "@typescript-eslint/parser": "5.18.0", "@vercel/node": "1.14.0", + "@your-org/eslint-config-bases": "workspace:^", "autoprefixer": "10.4.4", - "eslint": "8.13.0", - "eslint-config-prettier": "8.5.0", - "eslint-import-resolver-typescript": "2.7.1", - "eslint-plugin-import": "2.26.0", - "eslint-plugin-jest": "26.1.4", - "eslint-plugin-jest-formatting": "3.1.0", - "eslint-plugin-jsx-a11y": "6.5.1", - "eslint-plugin-prettier": "4.0.0", - "eslint-plugin-react": "7.29.4", - "eslint-plugin-react-hooks": "4.4.0", - "eslint-plugin-regexp": "1.6.0", - "eslint-plugin-sonarjs": "0.13.0", - "eslint-plugin-testing-library": "5.2.1", "jest": "27.5.1", "jest-css-modules-transform": "4.3.0", "npm-run-all": "4.1.5", diff --git a/apps/vite-app/.eslintrc.js b/apps/vite-app/.eslintrc.js index 42ad7304f35..a35af06ea42 100644 --- a/apps/vite-app/.eslintrc.js +++ b/apps/vite-app/.eslintrc.js @@ -7,29 +7,14 @@ module.exports = { root: true, ignorePatterns: ['dist'], extends: [ - // Extend the monorepo default configuration - '../../.eslintrc.base.js', - // Add specific rules for react - 'plugin:react/recommended', - 'plugin:react-hooks/recommended', - 'plugin:jsx-a11y/recommended', + '@your-org/eslint-config-bases/typescript', + '@your-org/eslint-config-bases/sonar', + '@your-org/eslint-config-bases/jest', + '@your-org/eslint-config-bases/react', + '@your-org/eslint-config-bases/react-testing-library', ], - env: { - browser: true, - es6: true, - node: true, - }, rules: { - 'react/prop-types': 'off', - 'react/react-in-jsx-scope': 'off', 'jsx-a11y/anchor-is-valid': 'off', - 'react/no-unescaped-entities': 'off', }, - overrides: [ - { - // For performance run jest/recommended on test files, not regular code - files: ['**/*.test.{ts,tsx}'], - extends: ['plugin:testing-library/react'], - }, - ], + overrides: [], }; diff --git a/apps/vite-app/package.json b/apps/vite-app/package.json index 8f75a1888cf..5c4f3f2b02e 100644 --- a/apps/vite-app/package.json +++ b/apps/vite-app/package.json @@ -29,19 +29,7 @@ "@types/react": "17.0.44", "@types/react-dom": "17.0.15", "@vitejs/plugin-react": "1.3.0", - "eslint": "8.13.0", - "eslint-config-prettier": "8.5.0", - "eslint-import-resolver-typescript": "2.7.1", - "eslint-plugin-import": "2.26.0", - "eslint-plugin-jest": "26.1.4", - "eslint-plugin-jest-formatting": "3.1.0", - "eslint-plugin-jsx-a11y": "6.5.1", - "eslint-plugin-prettier": "4.0.0", - "eslint-plugin-react": "7.29.4", - "eslint-plugin-react-hooks": "4.4.0", - "eslint-plugin-regexp": "1.6.0", - "eslint-plugin-sonarjs": "0.13.0", - "eslint-plugin-testing-library": "5.2.1", + "@your-org/eslint-config-bases": "workspace:^", "prettier": "2.6.2", "rimraf": "3.0.2", "typescript": "4.6.3", diff --git a/packages/core-lib/.eslintrc.js b/packages/core-lib/.eslintrc.js index eed79b3f472..9b26b204be0 100644 --- a/packages/core-lib/.eslintrc.js +++ b/packages/core-lib/.eslintrc.js @@ -5,30 +5,18 @@ module.exports = { root: true, - // ignorePatterns: ['dist', 'build'], + ignorePatterns: ['node_modules/**', 'dist', 'build'], extends: [ - // Extend the monorepo default configuration - '../../.eslintrc.base.js', - // Add specific rules for react - 'plugin:react/recommended', - 'plugin:react-hooks/recommended', - 'plugin:jsx-a11y/recommended', + '@your-org/eslint-config-bases/typescript', + '@your-org/eslint-config-bases/sonar', + '@your-org/eslint-config-bases/jest', + '@your-org/eslint-config-bases/react-testing-library', + '@your-org/eslint-config-bases/react', ], - env: { - browser: true, - es6: true, - node: true, - }, rules: { - 'react/prop-types': 'off', - 'react/react-in-jsx-scope': 'off', - 'jsx-a11y/anchor-is-valid': 'off', + // optional overrides per project }, overrides: [ - { - // For performance run jest/recommended on test files, not regular code - files: ['**/__tests__/**/*.{ts,tsx}'], - extends: ['plugin:testing-library/react'], - }, + // optional overrides per project file match ], }; diff --git a/packages/core-lib/package.json b/packages/core-lib/package.json index 51884425dce..8073d92ebc6 100644 --- a/packages/core-lib/package.json +++ b/packages/core-lib/package.json @@ -46,29 +46,11 @@ } }, "devDependencies": { - "@testing-library/jest-dom": "5.16.4", - "@testing-library/react": "13.0.0", - "@testing-library/react-hooks": "7.0.2", "@types/jest": "27.4.1", "@types/node": "17.0.23", "@types/react": "17.0.44", "@types/react-dom": "17.0.15", - "@typescript-eslint/eslint-plugin": "5.18.0", - "@typescript-eslint/parser": "5.18.0", "cross-env": "7.0.3", - "eslint": "8.13.0", - "eslint-config-prettier": "8.5.0", - "eslint-import-resolver-typescript": "2.7.1", - "eslint-plugin-import": "2.26.0", - "eslint-plugin-jest": "26.1.4", - "eslint-plugin-jest-formatting": "3.1.0", - "eslint-plugin-jsx-a11y": "6.5.1", - "eslint-plugin-prettier": "4.0.0", - "eslint-plugin-react": "7.29.4", - "eslint-plugin-react-hooks": "4.4.0", - "eslint-plugin-regexp": "1.6.0", - "eslint-plugin-sonarjs": "0.13.0", - "eslint-plugin-testing-library": "5.2.1", "jest": "27.5.1", "microbundle": "0.14.2", "npm-run-all": "4.1.5", diff --git a/packages/db-main-prisma/.eslintrc.js b/packages/db-main-prisma/.eslintrc.js index e8b5a737d0e..e299124a5d1 100644 --- a/packages/db-main-prisma/.eslintrc.js +++ b/packages/db-main-prisma/.eslintrc.js @@ -6,10 +6,14 @@ module.exports = { root: true, ignorePatterns: ['dist', 'build', 'src/generated'], - extends: ['../../.eslintrc.base.js'], - env: { - browser: false, - es6: true, - node: true, + extends: [ + '@your-org/eslint-config-bases/typescript', + '@your-org/eslint-config-bases/sonar', + ], + rules: { + // optional overrides per project }, + overrides: [ + // optional overrides per project file match + ], }; diff --git a/packages/db-main-prisma/package.json b/packages/db-main-prisma/package.json index b2d4d24ba04..7035a016095 100644 --- a/packages/db-main-prisma/package.json +++ b/packages/db-main-prisma/package.json @@ -40,21 +40,12 @@ "@soluble/dsn-parser": "1.3.5", "@types/jest": "27.4.1", "@types/node": "17.0.23", - "@typescript-eslint/eslint-plugin": "5.18.0", - "@typescript-eslint/parser": "5.18.0", + "@your-org/eslint-config-bases": "workspace:^", "camelcase": "6.3.0", "cross-env": "7.0.3", "dotenv-flow": "3.2.0", "dotenv-flow-cli": "1.0.0", "eslint": "8.13.0", - "eslint-config-prettier": "8.5.0", - "eslint-import-resolver-typescript": "2.7.1", - "eslint-plugin-import": "2.26.0", - "eslint-plugin-jest": "26.1.4", - "eslint-plugin-jest-formatting": "3.1.0", - "eslint-plugin-prettier": "4.0.0", - "eslint-plugin-regexp": "1.6.0", - "eslint-plugin-sonarjs": "0.13.0", "esno": "0.14.1", "execa": "5.1.1", "is-port-reachable": "3.1.0", diff --git a/packages/ui-lib/.eslintrc.js b/packages/ui-lib/.eslintrc.js index 47592721de8..397d66c75be 100644 --- a/packages/ui-lib/.eslintrc.js +++ b/packages/ui-lib/.eslintrc.js @@ -6,33 +6,17 @@ module.exports = { root: true, extends: [ - // Extend the monorepo default configuration - '../../.eslintrc.base.js', - // Add specific rules for react - 'plugin:react/recommended', - 'plugin:react-hooks/recommended', - 'plugin:jsx-a11y/recommended', + '@your-org/eslint-config-bases/typescript', + '@your-org/eslint-config-bases/sonar', + '@your-org/eslint-config-bases/jest', + '@your-org/eslint-config-bases/react-testing-library', + '@your-org/eslint-config-bases/storybook', + '@your-org/eslint-config-bases/react', ], - env: { - browser: true, - es6: true, - node: true, - }, rules: { - 'react/prop-types': 'off', - 'react/react-in-jsx-scope': 'off', - 'jsx-a11y/anchor-is-valid': 'off', + // optional overrides per project }, overrides: [ - { - // For performance run jest/recommended on test files, not regular code - files: ['**/__tests__/**/*.{ts,tsx}'], - extends: ['plugin:testing-library/react'], - }, - { - // For performance run storybook/recommended on test files, not regular code - files: ['**/*.stories.{ts,tsx,mdx}'], - extends: ['plugin:storybook/recommended'], - }, + // optional overrides per project file match ], }; diff --git a/packages/ui-lib/package.json b/packages/ui-lib/package.json index e0449819339..de10c33fdf0 100644 --- a/packages/ui-lib/package.json +++ b/packages/ui-lib/package.json @@ -71,28 +71,13 @@ "@types/node": "17.0.23", "@types/react": "17.0.44", "@types/react-dom": "17.0.15", - "@typescript-eslint/eslint-plugin": "5.18.0", - "@typescript-eslint/parser": "5.18.0", + "@your-org/eslint-config-bases": "workspace:^", "autoprefixer": "10.4.4", "babel-loader": "8.2.4", "babel-plugin-macros": "3.1.0", "babel-plugin-polyfill-corejs3": "0.5.2", "core-js": "3.21.1", "cross-env": "7.0.3", - "eslint": "8.13.0", - "eslint-config-prettier": "8.5.0", - "eslint-import-resolver-typescript": "2.7.1", - "eslint-plugin-import": "2.26.0", - "eslint-plugin-jest": "26.1.4", - "eslint-plugin-jest-formatting": "3.1.0", - "eslint-plugin-jsx-a11y": "6.5.1", - "eslint-plugin-prettier": "4.0.0", - "eslint-plugin-react": "7.29.4", - "eslint-plugin-react-hooks": "4.4.0", - "eslint-plugin-regexp": "1.6.0", - "eslint-plugin-sonarjs": "0.13.0", - "eslint-plugin-storybook": "0.5.8", - "eslint-plugin-testing-library": "5.2.1", "jest": "27.5.1", "microbundle": "0.14.2", "npm-run-all": "4.1.5", From 9080d6f94eb79726d04d6e0b2855db1142d69c9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Vanvelthem?= Date: Sun, 10 Apr 2022 14:45:48 +0200 Subject: [PATCH 03/22] chore(nvm): upgrade to gallium latest lts --- .nvmrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.nvmrc b/.nvmrc index 7480d3c8562..112a2eaed3e 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -lts/fermium \ No newline at end of file +lts/gallium \ No newline at end of file From f01cfb7bb285375d066edb11b5dca9ba0a6fda64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Vanvelthem?= Date: Sun, 10 Apr 2022 14:46:02 +0200 Subject: [PATCH 04/22] fix: remove unused variable --- apps/remix-app/src/root.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-app/src/root.tsx b/apps/remix-app/src/root.tsx index b263077ffc5..599a4644b7b 100644 --- a/apps/remix-app/src/root.tsx +++ b/apps/remix-app/src/root.tsx @@ -99,7 +99,7 @@ export default function App() { } export function CatchBoundary() { - const { status, statusText, data: _data } = useCatch(); + const { status, statusText } = useCatch(); const Content = () => status === 404 ? ( From b2451696cdd8412cf2e12a5310ea999ee92e9ad9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Vanvelthem?= Date: Sun, 10 Apr 2022 14:46:21 +0200 Subject: [PATCH 05/22] chore: update monorepo --- package.json | 11 +- yarn.lock | 894 +++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 656 insertions(+), 249 deletions(-) diff --git a/package.json b/package.json index eb78e047682..3044d756508 100644 --- a/package.json +++ b/package.json @@ -13,13 +13,20 @@ }, "keywords": [ "example", + "monorepo", "workspace", "nextjs", - "next-transpile-modules" + "vite", + "remix", + "eslint-plugin", + "playwright", + "storybook", + "prisma" ], "workspaces": [ "apps/*", - "packages/*" + "packages/*", + "tools/*" ], "scripts": { "g:clean": "rimraf '.cache/*' && yarn workspaces foreach -ptv run clean", diff --git a/yarn.lock b/yarn.lock index 57e6a81b264..fc35b135254 100644 --- a/yarn.lock +++ b/yarn.lock @@ -499,7 +499,7 @@ __metadata: languageName: node linkType: hard -"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.12.11, @babel/parser@npm:^7.12.7, @babel/parser@npm:^7.13.16, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.16.12, @babel/parser@npm:^7.16.7, @babel/parser@npm:^7.17.8, @babel/parser@npm:^7.17.9, @babel/parser@npm:^7.3.3": +"@babel/parser@npm:^7.1.0, @babel/parser@npm:^7.12.11, @babel/parser@npm:^7.12.7, @babel/parser@npm:^7.13.16, @babel/parser@npm:^7.14.7, @babel/parser@npm:^7.16.12, @babel/parser@npm:^7.16.7, @babel/parser@npm:^7.16.8, @babel/parser@npm:^7.17.8, @babel/parser@npm:^7.17.9, @babel/parser@npm:^7.3.3": version: 7.17.9 resolution: "@babel/parser@npm:7.17.9" bin: @@ -1683,7 +1683,7 @@ __metadata: languageName: node linkType: hard -"@babel/traverse@npm:^7.1.6, @babel/traverse@npm:^7.12.11, @babel/traverse@npm:^7.12.9, @babel/traverse@npm:^7.13.0, @babel/traverse@npm:^7.15.4, @babel/traverse@npm:^7.16.10, @babel/traverse@npm:^7.16.7, @babel/traverse@npm:^7.17.3, @babel/traverse@npm:^7.17.9, @babel/traverse@npm:^7.7.2": +"@babel/traverse@npm:^7.1.6, @babel/traverse@npm:^7.12.11, @babel/traverse@npm:^7.12.9, @babel/traverse@npm:^7.13.0, @babel/traverse@npm:^7.15.4, @babel/traverse@npm:^7.16.10, @babel/traverse@npm:^7.16.7, @babel/traverse@npm:^7.16.8, @babel/traverse@npm:^7.17.3, @babel/traverse@npm:^7.17.9, @babel/traverse@npm:^7.7.2": version: 7.17.9 resolution: "@babel/traverse@npm:7.17.9" dependencies: @@ -2632,6 +2632,20 @@ __metadata: languageName: node linkType: hard +"@endemolshinegroup/cosmiconfig-typescript-loader@npm:3.0.2": + version: 3.0.2 + resolution: "@endemolshinegroup/cosmiconfig-typescript-loader@npm:3.0.2" + dependencies: + lodash.get: ^4 + make-error: ^1 + ts-node: ^9 + tslib: ^2 + peerDependencies: + cosmiconfig: ">=6" + checksum: 7fe0198622b1063c40572034df7e8ba867865a1b4815afe230795929abcf785758b34d7806a8e2100ba8ab4e92c5a1c3e11a980c466c4406df6e7ec6e50df8b6 + languageName: node + linkType: hard + "@esbuild-plugins/node-modules-polyfill@npm:^0.1.4": version: 0.1.4 resolution: "@esbuild-plugins/node-modules-polyfill@npm:0.1.4" @@ -2675,15 +2689,152 @@ __metadata: languageName: node linkType: hard -"@graphql-tools/merge@npm:^8.2.1": - version: 8.2.1 - resolution: "@graphql-tools/merge@npm:8.2.1" +"@graphql-eslint/eslint-plugin@npm:3.10.2": + version: 3.10.2 + resolution: "@graphql-eslint/eslint-plugin@npm:3.10.2" dependencies: - "@graphql-tools/utils": ^8.5.1 + "@babel/code-frame": 7.16.7 + "@graphql-tools/code-file-loader": ^7.2.8 + "@graphql-tools/graphql-tag-pluck": ^7.2.0 + "@graphql-tools/utils": ^8.6.5 + chalk: 4.1.2 + debug: 4.3.4 + fast-glob: 3.2.11 + graphql-config: ^4.3.0 + graphql-depth-limit: 1.1.0 + lodash.lowercase: 4.3.0 + peerDependencies: + graphql: ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 + checksum: beddb1ca9a1cadf7090dfbde83221da900d4adf3f4e47067c76577518f411f029f5104ff6ed5a32b858ea3af535565173bbcb124dccd73a345d14d33d99da24d + languageName: node + linkType: hard + +"@graphql-tools/batch-execute@npm:8.4.2": + version: 8.4.2 + resolution: "@graphql-tools/batch-execute@npm:8.4.2" + dependencies: + "@graphql-tools/utils": 8.6.6 + dataloader: 2.0.0 + tslib: ~2.3.0 + value-or-promise: 1.0.11 + peerDependencies: + graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 + checksum: 75d58f6c73a3f88698ae2f79a9a65f506dcf502edef6a593e238bf6a633d0181b5c9ff41dfb351857d518bc161c61c5fddbaec3e3f53a31ba3e34f77ebc8f236 + languageName: node + linkType: hard + +"@graphql-tools/code-file-loader@npm:^7.2.8": + version: 7.2.11 + resolution: "@graphql-tools/code-file-loader@npm:7.2.11" + dependencies: + "@graphql-tools/graphql-tag-pluck": 7.2.3 + "@graphql-tools/utils": 8.6.6 + globby: ^11.0.3 + tslib: ~2.3.0 + unixify: ^1.0.0 + peerDependencies: + graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 + checksum: c379189519c0df9b16fcd5faa633a449cf53a796ec5f033ca8a3ab5b673c8f08dccfd56a99f951338dfac5aa757353c096a929230ca3ea08fcecdfa246633058 + languageName: node + linkType: hard + +"@graphql-tools/delegate@npm:8.7.2": + version: 8.7.2 + resolution: "@graphql-tools/delegate@npm:8.7.2" + dependencies: + "@graphql-tools/batch-execute": 8.4.2 + "@graphql-tools/schema": 8.3.7 + "@graphql-tools/utils": 8.6.6 + dataloader: 2.0.0 + graphql-executor: 0.0.22 + tslib: ~2.3.0 + value-or-promise: 1.0.11 + peerDependencies: + graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 + checksum: 5e2ff3f66d64d46ebf038ccdcea9e942e7b7c101080a585c1f3348790cc9e67ffd6efd566e2c2798a4e41c9a036cbe3302c3fbe2a7a14040c64325e8374e48a4 + languageName: node + linkType: hard + +"@graphql-tools/graphql-file-loader@npm:^7.3.7": + version: 7.3.8 + resolution: "@graphql-tools/graphql-file-loader@npm:7.3.8" + dependencies: + "@graphql-tools/import": 6.6.10 + "@graphql-tools/utils": 8.6.6 + globby: ^11.0.3 + tslib: ~2.3.0 + unixify: ^1.0.0 + peerDependencies: + graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 + checksum: ee9a4928198be3e1495d8eec0fdd56d3fc53baaeb991b58d827cdabd9161fe16187cfa11a8ecb85d549280efea541070b972c30afef5012e87b65cb9d1bab989 + languageName: node + linkType: hard + +"@graphql-tools/graphql-tag-pluck@npm:7.2.3, @graphql-tools/graphql-tag-pluck@npm:^7.2.0": + version: 7.2.3 + resolution: "@graphql-tools/graphql-tag-pluck@npm:7.2.3" + dependencies: + "@babel/parser": ^7.16.8 + "@babel/traverse": ^7.16.8 + "@babel/types": ^7.16.8 + "@graphql-tools/utils": 8.6.6 + tslib: ~2.3.0 + peerDependencies: + graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 + checksum: c814e65a3eaa49e90144e4af1c6a2d39257f853781c4aef1969a7d71860b8d37e03247c2b67b3c6b2aaae7ae1e235e74b38b67205c9b91a194351ebf38ddfad9 + languageName: node + linkType: hard + +"@graphql-tools/import@npm:6.6.10": + version: 6.6.10 + resolution: "@graphql-tools/import@npm:6.6.10" + dependencies: + "@graphql-tools/utils": 8.6.6 + resolve-from: 5.0.0 + tslib: ~2.3.0 + peerDependencies: + graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 + checksum: 8d05990fa425d6f755bdd2e98be37fe055956be3a86c86ced6f6fcb4c7b62c4196defe2e568eae0ff20a2807d056f699dd0ec9ba1cccbd6b971d95f53b4ffaae + languageName: node + linkType: hard + +"@graphql-tools/json-file-loader@npm:^7.3.7": + version: 7.3.8 + resolution: "@graphql-tools/json-file-loader@npm:7.3.8" + dependencies: + "@graphql-tools/utils": 8.6.6 + globby: ^11.0.3 + tslib: ~2.3.0 + unixify: ^1.0.0 + peerDependencies: + graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 + checksum: e66107129717efb42677a725cdfc5bc49190f26c8e071087cc451a18bbf3a7458d84a33d460ba8e06d4aab382a5b73f9deaf05c13057273aedefcc2f0eb82b47 + languageName: node + linkType: hard + +"@graphql-tools/load@npm:^7.5.5": + version: 7.5.7 + resolution: "@graphql-tools/load@npm:7.5.7" + dependencies: + "@graphql-tools/schema": 8.3.7 + "@graphql-tools/utils": 8.6.6 + p-limit: 3.1.0 + tslib: ~2.3.0 + peerDependencies: + graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 + checksum: d8da6cb28c4637f92ccff574235f6177fe3769ebc5b52c3cec28415c38a2549ae518856b0b523d2166fd81f53b309e2176af2e6ea73caa04f90008250e1bdefb + languageName: node + linkType: hard + +"@graphql-tools/merge@npm:8.2.7, @graphql-tools/merge@npm:^8.2.6": + version: 8.2.7 + resolution: "@graphql-tools/merge@npm:8.2.7" + dependencies: + "@graphql-tools/utils": 8.6.6 tslib: ~2.3.0 peerDependencies: graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 - checksum: b2c126fc697ad1cf0fb2c09d3766d791ba6243a318edfa24932b558628244f822b9454bd47cd98f5a7eee90caca264573695c582e10730b7a67785fea21c346c + checksum: 9561cfdfa9ed430e593d0524052854bd0f7a3ac1c39111e2690170e84f40f7afdee9001cf71284b78af0a83f44b03549046e191683e77c3a9c0b2b9bc8fa247a languageName: node linkType: hard @@ -2701,28 +2852,71 @@ __metadata: languageName: node linkType: hard -"@graphql-tools/schema@npm:^8.0.0, @graphql-tools/schema@npm:^8.3.1": - version: 8.3.1 - resolution: "@graphql-tools/schema@npm:8.3.1" +"@graphql-tools/schema@npm:8.3.7, @graphql-tools/schema@npm:^8.0.0, @graphql-tools/schema@npm:^8.3.1": + version: 8.3.7 + resolution: "@graphql-tools/schema@npm:8.3.7" dependencies: - "@graphql-tools/merge": ^8.2.1 - "@graphql-tools/utils": ^8.5.1 + "@graphql-tools/merge": 8.2.7 + "@graphql-tools/utils": 8.6.6 tslib: ~2.3.0 value-or-promise: 1.0.11 peerDependencies: graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 - checksum: 5fd6dbd3f4e92fd1b9a627e04b339bf2a4564768299e45576f79df70e167c3ec6c822576c37b3ba6537e2dd561b3b445b322bc90b205389260b7084fe777f5d4 + checksum: a6105d5e403e91fa853bdaee729ff0cc41623ccad100f6373c9b8210256afc2b2564ff70246f3df2ca3114b19d5325ada50bc87446e625800d907ee6ff4bdcb9 + languageName: node + linkType: hard + +"@graphql-tools/url-loader@npm:^7.9.7": + version: 7.9.9 + resolution: "@graphql-tools/url-loader@npm:7.9.9" + dependencies: + "@graphql-tools/delegate": 8.7.2 + "@graphql-tools/utils": 8.6.6 + "@graphql-tools/wrap": 8.4.11 + "@n1ru4l/graphql-live-query": ^0.9.0 + "@types/websocket": ^1.0.4 + "@types/ws": ^8.0.0 + cross-undici-fetch: ^0.1.19 + dset: ^3.1.0 + extract-files: ^11.0.0 + graphql-sse: ^1.0.1 + graphql-ws: ^5.4.1 + isomorphic-ws: ^4.0.1 + meros: ^1.1.4 + subscriptions-transport-ws: ^0.11.0 + sync-fetch: ^0.3.1 + tslib: ^2.3.0 + value-or-promise: ^1.0.11 + ws: ^8.3.0 + peerDependencies: + graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 + checksum: 5a91b42d2a460a38d7f72870683dcf8fe5ec39b5482e608f464459376eccfd9c3829e7a21e87c705662cf7619e4525aeff6a6bd7fae960857fcba0a2ae925eb8 languageName: node linkType: hard -"@graphql-tools/utils@npm:^8.5.1": - version: 8.5.1 - resolution: "@graphql-tools/utils@npm:8.5.1" +"@graphql-tools/utils@npm:8.6.6, @graphql-tools/utils@npm:^8.5.1, @graphql-tools/utils@npm:^8.6.5": + version: 8.6.6 + resolution: "@graphql-tools/utils@npm:8.6.6" dependencies: tslib: ~2.3.0 peerDependencies: graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 - checksum: 518c0bcfc853a8f77e9f7f426f434cc2c1c9501ff66e5a1d2cc5d833a6b6ad75205bfb58da1c475936ab1aa0696d1ceaf362517d07246aaf8f5842126fe6285a + checksum: fe9d81ba59efb0fc7e08ff0367f907b5e57dbabcd4131ad3bb5f4f0744c005ff498005d8a4f4f93957cd210020f6085ebb8154db059f1ab87a5686eb0e43c5fd + languageName: node + linkType: hard + +"@graphql-tools/wrap@npm:8.4.11": + version: 8.4.11 + resolution: "@graphql-tools/wrap@npm:8.4.11" + dependencies: + "@graphql-tools/delegate": 8.7.2 + "@graphql-tools/schema": 8.3.7 + "@graphql-tools/utils": 8.6.6 + tslib: ~2.3.0 + value-or-promise: 1.0.11 + peerDependencies: + graphql: ^14.0.0 || ^15.0.0 || ^16.0.0 + checksum: 34550e863f5510b30e6b4991520e86f85760abe19754d73b4b38b11d631d01d2fe80999debf0befed96b183006eaacc65215e4069152eaa2c7b4f26253cb9a3c languageName: node linkType: hard @@ -2780,6 +2974,13 @@ __metadata: languageName: node linkType: hard +"@iarna/toml@npm:^2.2.5": + version: 2.2.5 + resolution: "@iarna/toml@npm:2.2.5" + checksum: b63b2b2c4fd67969a6291543ada0303d45593801ee744b60f5390f183c03d9192bc67a217abb24be945158f1935f02840d9ffff40c0142aa171b5d3b6b6a3ea5 + languageName: node + linkType: hard + "@ioredis/commands@npm:^1.1.1": version: 1.1.1 resolution: "@ioredis/commands@npm:1.1.1" @@ -3341,6 +3542,15 @@ __metadata: languageName: node linkType: hard +"@n1ru4l/graphql-live-query@npm:^0.9.0": + version: 0.9.0 + resolution: "@n1ru4l/graphql-live-query@npm:0.9.0" + peerDependencies: + graphql: ^15.4.0 || ^16.0.0 + checksum: 746c7a2b23440a2daee5737aece454c756bf9f3e77decd53feed921f88907743301b569209d124afde63271b3f9db59a1fb997c0c280205662a7622992057e4a + languageName: node + linkType: hard + "@next/bundle-analyzer@npm:12.1.4": version: 12.1.4 resolution: "@next/bundle-analyzer@npm:12.1.4" @@ -5096,15 +5306,6 @@ __metadata: languageName: node linkType: hard -"@storybook/csf@npm:^0.0.1": - version: 0.0.1 - resolution: "@storybook/csf@npm:0.0.1" - dependencies: - lodash: ^4.17.15 - checksum: fb57fa028b08a51edf44e1a2bf4be40a4607f5c6ccb58aae8924f476a42b9bbd61a0ad521cfc82196f23e6a912caae0a615e70a755e6800b284c91c509fd2de6 - languageName: node - linkType: hard - "@storybook/manager-webpack4@npm:6.4.21": version: 6.4.21 resolution: "@storybook/manager-webpack4@npm:6.4.21" @@ -6419,6 +6620,15 @@ __metadata: languageName: node linkType: hard +"@types/websocket@npm:^1.0.4": + version: 1.0.5 + resolution: "@types/websocket@npm:1.0.5" + dependencies: + "@types/node": "*" + checksum: 41c7a620f877a0165ff36e713455d888b7f5df9c51e71b5d0f47994f98cf22ccd339b8c6cfdc6bb417e950d40f405693974d393bd916971490553cc5e9e67a9d + languageName: node + linkType: hard + "@types/wrap-ansi@npm:^3.0.0": version: 3.0.0 resolution: "@types/wrap-ansi@npm:3.0.0" @@ -6426,6 +6636,15 @@ __metadata: languageName: node linkType: hard +"@types/ws@npm:^8.0.0": + version: 8.5.3 + resolution: "@types/ws@npm:8.5.3" + dependencies: + "@types/node": "*" + checksum: 0ce46f850d41383fcdc2149bcacc86d7232fa7a233f903d2246dff86e31701a02f8566f40af5f8b56d1834779255c04ec6ec78660fe0f9b2a69cf3d71937e4ae + languageName: node + linkType: hard + "@types/yargs-parser@npm:*": version: 20.2.1 resolution: "@types/yargs-parser@npm:20.2.1" @@ -6483,17 +6702,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/experimental-utils@npm:^5.3.0": - version: 5.12.1 - resolution: "@typescript-eslint/experimental-utils@npm:5.12.1" - dependencies: - "@typescript-eslint/utils": 5.12.1 - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - checksum: 04f5c610d60753f247511e936d49878094a7e50cbbf97a66203999e4a1956c906a57989587ccadc9cd374fb1aa72da214c69d1aa268b1dc0ae1c35732b8b1349 - languageName: node - linkType: hard - "@typescript-eslint/parser@npm:5.10.1": version: 5.10.1 resolution: "@typescript-eslint/parser@npm:5.10.1" @@ -6538,16 +6746,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:5.12.1": - version: 5.12.1 - resolution: "@typescript-eslint/scope-manager@npm:5.12.1" - dependencies: - "@typescript-eslint/types": 5.12.1 - "@typescript-eslint/visitor-keys": 5.12.1 - checksum: b6e7f45b4fe39397430149ad005f7d28aa75a063dacfc947514abd52ba5235fecf937784416dfb7e8c168025b1bc74611332ceb214045cc362922e4b311bcb11 - languageName: node - linkType: hard - "@typescript-eslint/scope-manager@npm:5.18.0": version: 5.18.0 resolution: "@typescript-eslint/scope-manager@npm:5.18.0" @@ -6581,13 +6779,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/types@npm:5.12.1": - version: 5.12.1 - resolution: "@typescript-eslint/types@npm:5.12.1" - checksum: 753cb4b0f266500298f07c0386d72e7d9570f26e2deb7017fd677d21bb8bca7f2ca01d3f4b43d86fbb7337a76f0c9da86657de96f107dba92632d726b4e7797e - languageName: node - linkType: hard - "@typescript-eslint/types@npm:5.18.0": version: 5.18.0 resolution: "@typescript-eslint/types@npm:5.18.0" @@ -6613,24 +6804,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:5.12.1": - version: 5.12.1 - resolution: "@typescript-eslint/typescript-estree@npm:5.12.1" - dependencies: - "@typescript-eslint/types": 5.12.1 - "@typescript-eslint/visitor-keys": 5.12.1 - debug: ^4.3.2 - globby: ^11.0.4 - is-glob: ^4.0.3 - semver: ^7.3.5 - tsutils: ^3.21.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: 5677f5550fdc24879b51b3bc4c7551a5b241f70cf8f4cfe0fa2dc270dcd858c6d5085bf784c0bd471bb71da5abbbcf1ec44dc84a688ce61107d5ddba21d235ae - languageName: node - linkType: hard - "@typescript-eslint/typescript-estree@npm:5.18.0": version: 5.18.0 resolution: "@typescript-eslint/typescript-estree@npm:5.18.0" @@ -6649,22 +6822,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/utils@npm:5.12.1": - version: 5.12.1 - resolution: "@typescript-eslint/utils@npm:5.12.1" - dependencies: - "@types/json-schema": ^7.0.9 - "@typescript-eslint/scope-manager": 5.12.1 - "@typescript-eslint/types": 5.12.1 - "@typescript-eslint/typescript-estree": 5.12.1 - eslint-scope: ^5.1.1 - eslint-utils: ^3.0.0 - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - checksum: 0eb277ad4e60fa46b586d5df8e05be6e0d3963a59cf409a348e2c512d5e88d657a56026754ee10c31ee1333794e145f7ffe33e08d28aa1bed4b4ab4b02a95712 - languageName: node - linkType: hard - "@typescript-eslint/utils@npm:5.18.0, @typescript-eslint/utils@npm:^5.10.0, @typescript-eslint/utils@npm:^5.13.0": version: 5.18.0 resolution: "@typescript-eslint/utils@npm:5.18.0" @@ -6691,16 +6848,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:5.12.1": - version: 5.12.1 - resolution: "@typescript-eslint/visitor-keys@npm:5.12.1" - dependencies: - "@typescript-eslint/types": 5.12.1 - eslint-visitor-keys: ^3.0.0 - checksum: ada52c77dc42d055a6cefb294b9a893d680d125eb0fc5cc0daf2f85007c603ef688f4f5a865893758e00e89739850409bb748e26bb8c834372409d24ea820677 - languageName: node - linkType: hard - "@typescript-eslint/visitor-keys@npm:5.18.0": version: 5.18.0 resolution: "@typescript-eslint/visitor-keys@npm:5.18.0" @@ -7124,31 +7271,13 @@ __metadata: version: 0.0.0-use.local resolution: "@your-org/core-lib@workspace:packages/core-lib" dependencies: - "@testing-library/jest-dom": 5.16.4 - "@testing-library/react": 13.0.0 - "@testing-library/react-hooks": 7.0.2 "@tsed/exceptions": ^6.100.3 "@types/jest": 27.4.1 "@types/node": 17.0.23 "@types/react": 17.0.44 "@types/react-dom": 17.0.15 - "@typescript-eslint/eslint-plugin": 5.18.0 - "@typescript-eslint/parser": 5.18.0 cross-env: 7.0.3 dequal: ^2.0.0 - eslint: 8.13.0 - eslint-config-prettier: 8.5.0 - eslint-import-resolver-typescript: 2.7.1 - eslint-plugin-import: 2.26.0 - eslint-plugin-jest: 26.1.4 - eslint-plugin-jest-formatting: 3.1.0 - eslint-plugin-jsx-a11y: 6.5.1 - eslint-plugin-prettier: 4.0.0 - eslint-plugin-react: 7.29.4 - eslint-plugin-react-hooks: 4.4.0 - eslint-plugin-regexp: 1.6.0 - eslint-plugin-sonarjs: 0.13.0 - eslint-plugin-testing-library: 5.2.1 jest: 27.5.1 microbundle: 0.14.2 npm-run-all: 4.1.5 @@ -7177,21 +7306,12 @@ __metadata: "@soluble/dsn-parser": 1.3.5 "@types/jest": 27.4.1 "@types/node": 17.0.23 - "@typescript-eslint/eslint-plugin": 5.18.0 - "@typescript-eslint/parser": 5.18.0 + "@your-org/eslint-config-bases": "workspace:^" camelcase: 6.3.0 cross-env: 7.0.3 dotenv-flow: 3.2.0 dotenv-flow-cli: 1.0.0 eslint: 8.13.0 - eslint-config-prettier: 8.5.0 - eslint-import-resolver-typescript: 2.7.1 - eslint-plugin-import: 2.26.0 - eslint-plugin-jest: 26.1.4 - eslint-plugin-jest-formatting: 3.1.0 - eslint-plugin-prettier: 4.0.0 - eslint-plugin-regexp: 1.6.0 - eslint-plugin-sonarjs: 0.13.0 esno: 0.14.1 execa: 5.1.1 is-port-reachable: 3.1.0 @@ -7208,6 +7328,51 @@ __metadata: languageName: unknown linkType: soft +"@your-org/eslint-config-bases@workspace:^, @your-org/eslint-config-bases@workspace:tools/eslint-config-bases": + version: 0.0.0-use.local + resolution: "@your-org/eslint-config-bases@workspace:tools/eslint-config-bases" + dependencies: + "@graphql-eslint/eslint-plugin": 3.10.2 + "@testing-library/jest-dom": 5.16.4 + "@testing-library/react": 13.0.0 + "@testing-library/react-hooks": 7.0.2 + "@types/jest": 27.4.1 + "@types/node": 17.0.23 + "@types/react": 17.0.44 + "@types/react-dom": 17.0.15 + "@typescript-eslint/eslint-plugin": 5.18.0 + "@typescript-eslint/parser": 5.18.0 + eslint: 8.13.0 + eslint-config-prettier: 8.5.0 + eslint-import-resolver-typescript: 2.7.1 + eslint-plugin-import: 2.26.0 + eslint-plugin-jest: 26.1.4 + eslint-plugin-jest-formatting: 3.1.0 + eslint-plugin-jsx-a11y: 6.5.1 + eslint-plugin-playwright: 0.8.0 + eslint-plugin-prettier: 4.0.0 + eslint-plugin-react: 7.29.4 + eslint-plugin-react-hooks: 4.4.0 + eslint-plugin-regexp: 1.6.0 + eslint-plugin-sonarjs: 0.13.0 + eslint-plugin-testing-library: 5.2.1 + prettier: 2.6.2 + react: ^18.0.0 + react-dom: ^18.0.0 + rimraf: 3.0.2 + typescript: 4.6.3 + peerDependencies: + react: ^17.0.2 || ^18.0.0 + react-dom: ^17.0.2 || ^18.0.0 + typescript: ^4.5.0 + peerDependenciesMeta: + react: + optional: true + react-dom: + optional: true + languageName: unknown + linkType: soft + "@your-org/ui-lib@workspace:^, @your-org/ui-lib@workspace:packages/ui-lib": version: 0.0.0-use.local resolution: "@your-org/ui-lib@workspace:packages/ui-lib" @@ -7234,29 +7399,14 @@ __metadata: "@types/node": 17.0.23 "@types/react": 17.0.44 "@types/react-dom": 17.0.15 - "@typescript-eslint/eslint-plugin": 5.18.0 - "@typescript-eslint/parser": 5.18.0 "@your-org/core-lib": "workspace:^" + "@your-org/eslint-config-bases": "workspace:^" autoprefixer: 10.4.4 babel-loader: 8.2.4 babel-plugin-macros: 3.1.0 babel-plugin-polyfill-corejs3: 0.5.2 core-js: 3.21.1 cross-env: 7.0.3 - eslint: 8.13.0 - eslint-config-prettier: 8.5.0 - eslint-import-resolver-typescript: 2.7.1 - eslint-plugin-import: 2.26.0 - eslint-plugin-jest: 26.1.4 - eslint-plugin-jest-formatting: 3.1.0 - eslint-plugin-jsx-a11y: 6.5.1 - eslint-plugin-prettier: 4.0.0 - eslint-plugin-react: 7.29.4 - eslint-plugin-react-hooks: 4.4.0 - eslint-plugin-regexp: 1.6.0 - eslint-plugin-sonarjs: 0.13.0 - eslint-plugin-storybook: 0.5.8 - eslint-plugin-testing-library: 5.2.1 jest: 27.5.1 microbundle: 0.14.2 npm-run-all: 4.1.5 @@ -8507,6 +8657,13 @@ __metadata: languageName: node linkType: hard +"backo2@npm:^1.0.2": + version: 1.0.2 + resolution: "backo2@npm:1.0.2" + checksum: fda8d0a0f4810068d23715f2f45153146d6ee8f62dd827ce1e0b6cc3c8328e84ad61e11399a83931705cef702fe7cbb457856bf99b9bd10c4ed57b0786252385 + languageName: node + linkType: hard + "bail@npm:^1.0.0": version: 1.0.5 resolution: "bail@npm:1.0.5" @@ -8956,7 +9113,7 @@ __metadata: languageName: node linkType: hard -"buffer@npm:^5.5.0": +"buffer@npm:^5.5.0, buffer@npm:^5.7.0": version: 5.7.1 resolution: "buffer@npm:5.7.1" dependencies: @@ -9289,6 +9446,16 @@ __metadata: languageName: node linkType: hard +"chalk@npm:4.1.2, chalk@npm:^4.0.0, chalk@npm:^4.1.0, chalk@npm:^4.1.1, chalk@npm:^4.1.2": + version: 4.1.2 + resolution: "chalk@npm:4.1.2" + dependencies: + ansi-styles: ^4.1.0 + supports-color: ^7.1.0 + checksum: fe75c9d5c76a7a98d45495b91b2172fa3b7a09e0cc9370e5c8feb1c567b85c4288e2b3fded7cfdd7359ac28d6b3844feb8b82b8686842e93d23c827c417e83fc + languageName: node + linkType: hard + "chalk@npm:^1.0.0, chalk@npm:^1.1.3": version: 1.1.3 resolution: "chalk@npm:1.1.3" @@ -9313,16 +9480,6 @@ __metadata: languageName: node linkType: hard -"chalk@npm:^4.0.0, chalk@npm:^4.1.0, chalk@npm:^4.1.1, chalk@npm:^4.1.2": - version: 4.1.2 - resolution: "chalk@npm:4.1.2" - dependencies: - ansi-styles: ^4.1.0 - supports-color: ^7.1.0 - checksum: fe75c9d5c76a7a98d45495b91b2172fa3b7a09e0cc9370e5c8feb1c567b85c4288e2b3fded7cfdd7359ac28d6b3844feb8b82b8686842e93d23c827c417e83fc - languageName: node - linkType: hard - "change-case@npm:4.1.2": version: 4.1.2 resolution: "change-case@npm:4.1.2" @@ -10174,6 +10331,15 @@ __metadata: languageName: node linkType: hard +"cosmiconfig-toml-loader@npm:1.0.0": + version: 1.0.0 + resolution: "cosmiconfig-toml-loader@npm:1.0.0" + dependencies: + "@iarna/toml": ^2.2.5 + checksum: 00836a57c3c029a0d23f4eeeafc59a0be45cdf2707c5a6859020f545d50f939bfb01bc047fa41118faa92e69e25001f34d7687b05a97a469ed59fc870528b875 + languageName: node + linkType: hard + "cosmiconfig-typescript-loader@npm:^1.0.0": version: 1.0.2 resolution: "cosmiconfig-typescript-loader@npm:1.0.2" @@ -10188,29 +10354,29 @@ __metadata: languageName: node linkType: hard -"cosmiconfig@npm:^6.0.0": - version: 6.0.0 - resolution: "cosmiconfig@npm:6.0.0" +"cosmiconfig@npm:7.0.1, cosmiconfig@npm:^7, cosmiconfig@npm:^7.0.0, cosmiconfig@npm:^7.0.1": + version: 7.0.1 + resolution: "cosmiconfig@npm:7.0.1" dependencies: "@types/parse-json": ^4.0.0 - import-fresh: ^3.1.0 + import-fresh: ^3.2.1 parse-json: ^5.0.0 path-type: ^4.0.0 - yaml: ^1.7.2 - checksum: 8eed7c854b91643ecb820767d0deb038b50780ecc3d53b0b19e03ed8aabed4ae77271198d1ae3d49c3b110867edf679f5faad924820a8d1774144a87cb6f98fc + yaml: ^1.10.0 + checksum: 4be63e7117955fd88333d7460e4c466a90f556df6ef34efd59034d2463484e339666c41f02b523d574a797ec61f4a91918c5b89a316db2ea2f834e0d2d09465b languageName: node linkType: hard -"cosmiconfig@npm:^7, cosmiconfig@npm:^7.0.0, cosmiconfig@npm:^7.0.1": - version: 7.0.1 - resolution: "cosmiconfig@npm:7.0.1" +"cosmiconfig@npm:^6.0.0": + version: 6.0.0 + resolution: "cosmiconfig@npm:6.0.0" dependencies: "@types/parse-json": ^4.0.0 - import-fresh: ^3.2.1 + import-fresh: ^3.1.0 parse-json: ^5.0.0 path-type: ^4.0.0 - yaml: ^1.10.0 - checksum: 4be63e7117955fd88333d7460e4c466a90f556df6ef34efd59034d2463484e339666c41f02b523d574a797ec61f4a91918c5b89a316db2ea2f834e0d2d09465b + yaml: ^1.7.2 + checksum: 8eed7c854b91643ecb820767d0deb038b50780ecc3d53b0b19e03ed8aabed4ae77271198d1ae3d49c3b110867edf679f5faad924820a8d1774144a87cb6f98fc languageName: node linkType: hard @@ -10334,6 +10500,20 @@ __metadata: languageName: node linkType: hard +"cross-undici-fetch@npm:^0.1.19": + version: 0.1.28 + resolution: "cross-undici-fetch@npm:0.1.28" + dependencies: + abort-controller: ^3.0.0 + form-data-encoder: ^1.7.1 + formdata-node: ^4.3.1 + node-fetch: ^2.6.7 + undici: ^5.0.0 + web-streams-polyfill: ^3.2.0 + checksum: 2415a0aaeba05abbe464b8043f8442fca54fb41c54e7b6b7e2b8cf071004aca270f78062c40f12e3b58e96a891cd3edbb6ef27b306bfd228df306f16ddb7ba10 + languageName: node + linkType: hard + "crypto-browserify@npm:^3.11.0": version: 3.12.0 resolution: "crypto-browserify@npm:3.12.0" @@ -10691,6 +10871,13 @@ __metadata: languageName: node linkType: hard +"dataloader@npm:2.0.0": + version: 2.0.0 + resolution: "dataloader@npm:2.0.0" + checksum: 9f10b9d2e35225b08a72435facfe40c0c124e329f43bd0fe4d67411ee667d12145f7ce63f9b74f73af8556dc6a98bae59147a5cca2171315dc1de509d4db04c0 + languageName: node + linkType: hard + "dataloader@npm:^1.4.0": version: 1.4.0 resolution: "dataloader@npm:1.4.0" @@ -10717,7 +10904,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:4, debug@npm:^4.0.0, debug@npm:^4.0.1, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4": +"debug@npm:4, debug@npm:4.3.4, debug@npm:^4.0.0, debug@npm:^4.0.1, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4": version: 4.3.4 resolution: "debug@npm:4.3.4" dependencies: @@ -11316,6 +11503,13 @@ __metadata: languageName: node linkType: hard +"dset@npm:^3.1.0": + version: 3.1.1 + resolution: "dset@npm:3.1.1" + checksum: db9aeb64c28eea35f9392b4a304375415ac19e66f4afd1816f6b8e05b76355375aef075f2b737d720022c938e640220f4a27b5c9892b1d08942b3638bf0760e8 + languageName: node + linkType: hard + "duplexer2@npm:^0.1.2": version: 0.1.4 resolution: "duplexer2@npm:0.1.4" @@ -12424,6 +12618,19 @@ __metadata: languageName: node linkType: hard +"eslint-plugin-playwright@npm:0.8.0": + version: 0.8.0 + resolution: "eslint-plugin-playwright@npm:0.8.0" + peerDependencies: + eslint: ">=7" + eslint-plugin-jest: ">=24" + peerDependenciesMeta: + eslint-plugin-jest: + optional: true + checksum: 438bda1611dcee8388c2ea0c5d1871fb5cba9b84ee9b21aacb5e23d75f4c88acda1feb0c03eee9a9fa181a062e9350dd77a325517edab05d4a07029fccaa09b9 + languageName: node + linkType: hard + "eslint-plugin-prettier@npm:4.0.0": version: 4.0.0 resolution: "eslint-plugin-prettier@npm:4.0.0" @@ -12532,19 +12739,6 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-storybook@npm:0.5.8": - version: 0.5.8 - resolution: "eslint-plugin-storybook@npm:0.5.8" - dependencies: - "@storybook/csf": ^0.0.1 - "@typescript-eslint/experimental-utils": ^5.3.0 - requireindex: ^1.1.0 - peerDependencies: - eslint: ">=6" - checksum: 21359f65391fc4a33b0aa85414ed84595cb7c552e8bc923b734fe1bcce500376127a7873a0e46f619ce2c6d4677fe31286a68ce4b96b412bc279a6c0f23bbc43 - languageName: node - linkType: hard - "eslint-plugin-testing-library@npm:5.2.1, eslint-plugin-testing-library@npm:^5.0.5": version: 5.2.1 resolution: "eslint-plugin-testing-library@npm:5.2.1" @@ -12854,6 +13048,13 @@ __metadata: languageName: node linkType: hard +"eventemitter3@npm:^3.1.0": + version: 3.1.2 + resolution: "eventemitter3@npm:3.1.2" + checksum: 81e4e82b8418f5cfd986d2b4a2fa5397ac4eb8134e09bcb47005545e22fdf8e9e61d5c053d34651112245aae411bdfe6d0ad5511da0400743fef5fc38bfcfbe3 + languageName: node + linkType: hard + "eventemitter3@npm:^4.0.4": version: 4.0.7 resolution: "eventemitter3@npm:4.0.7" @@ -13087,6 +13288,13 @@ __metadata: languageName: node linkType: hard +"extract-files@npm:^11.0.0": + version: 11.0.0 + resolution: "extract-files@npm:11.0.0" + checksum: 39ebd92772e9a1e30d1e3112fb7db85d353c8243640635668b615ac1d605ceb79fbb13d17829dd308993ef37bb189ad99817f79ab164ae95c9bb3df9f440bd16 + languageName: node + linkType: hard + "extract-zip@npm:2.0.1": version: 2.0.1 resolution: "extract-zip@npm:2.0.1" @@ -13542,6 +13750,13 @@ __metadata: languageName: node linkType: hard +"form-data-encoder@npm:^1.7.1": + version: 1.7.2 + resolution: "form-data-encoder@npm:1.7.2" + checksum: aeebd87a1cb009e13cbb5e4e4008e6202ed5f6551eb6d9582ba8a062005178907b90f4887899d3c993de879159b6c0c940af8196725b428b4248cec5af3acf5f + languageName: node + linkType: hard + "form-data@npm:^3.0.0": version: 3.0.1 resolution: "form-data@npm:3.0.1" @@ -13571,6 +13786,16 @@ __metadata: languageName: node linkType: hard +"formdata-node@npm:^4.3.1": + version: 4.3.2 + resolution: "formdata-node@npm:4.3.2" + dependencies: + node-domexception: 1.0.0 + web-streams-polyfill: 4.0.0-beta.1 + checksum: e1d7aae7d579775b813ddc8ea4511fee613552715e81b36afb188d3a65b3d4df2ef69017106079ba52d9ab1e3367fea0206862d8ae64c02008ababdb341d2c3d + languageName: node + linkType: hard + "forwarded@npm:0.2.0": version: 0.2.0 resolution: "forwarded@npm:0.2.0" @@ -14132,7 +14357,7 @@ __metadata: languageName: node linkType: hard -"globby@npm:^11.0.0, globby@npm:^11.0.2, globby@npm:^11.0.4, globby@npm:^11.1.0": +"globby@npm:^11.0.0, globby@npm:^11.0.2, globby@npm:^11.0.3, globby@npm:^11.0.4, globby@npm:^11.1.0": version: 11.1.0 resolution: "globby@npm:11.1.0" dependencies: @@ -14219,6 +14444,56 @@ __metadata: languageName: node linkType: hard +"graphql-config@npm:^4.3.0": + version: 4.3.0 + resolution: "graphql-config@npm:4.3.0" + dependencies: + "@endemolshinegroup/cosmiconfig-typescript-loader": 3.0.2 + "@graphql-tools/graphql-file-loader": ^7.3.7 + "@graphql-tools/json-file-loader": ^7.3.7 + "@graphql-tools/load": ^7.5.5 + "@graphql-tools/merge": ^8.2.6 + "@graphql-tools/url-loader": ^7.9.7 + "@graphql-tools/utils": ^8.6.5 + cosmiconfig: 7.0.1 + cosmiconfig-toml-loader: 1.0.0 + minimatch: 4.2.1 + string-env-interpolation: 1.0.1 + peerDependencies: + graphql: ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 + checksum: 4042ab2b40d99b42efb25be18403f9374c70ea013bda824409b6a59e2b4e251056c5c245d9d3785d47ee15cef5a9746622b95e4e2dd873124b920c9b705120e1 + languageName: node + linkType: hard + +"graphql-depth-limit@npm:1.1.0": + version: 1.1.0 + resolution: "graphql-depth-limit@npm:1.1.0" + dependencies: + arrify: ^1.0.1 + peerDependencies: + graphql: "*" + checksum: e43c8c0462612870797c0691e2c9488d6773eb794dda2b71c2c5659f721ec28be42e6c1f381e3b05a892c25d212d9babe08888a8ce6fd4f83ecc19a988675e56 + languageName: node + linkType: hard + +"graphql-executor@npm:0.0.22": + version: 0.0.22 + resolution: "graphql-executor@npm:0.0.22" + peerDependencies: + graphql: ^15.0.0 || ^16.0.0 + checksum: b9f9c01a304cfabab3f16fbb8cbdf0df53ef095e9b6b0b2c260f6ec8fd3d15c38b8f442bd0e91740c4fe6141806078057dc7cc198d8fba4d348c6e15703b8c85 + languageName: node + linkType: hard + +"graphql-sse@npm:^1.0.1": + version: 1.1.0 + resolution: "graphql-sse@npm:1.1.0" + peerDependencies: + graphql: ">=0.11 <=16" + checksum: db4b22551718955faa5ba1c926a33dbb4df9822bfc233ea13e0044b7fced4dc4c65b92d82ca5a68b6ae87b93204639af4faa869b74a7b88ec2d12d6c6b767817 + languageName: node + linkType: hard + "graphql-tag@npm:^2.11.0": version: 2.12.5 resolution: "graphql-tag@npm:2.12.5" @@ -14230,6 +14505,15 @@ __metadata: languageName: node linkType: hard +"graphql-ws@npm:^5.4.1": + version: 5.7.0 + resolution: "graphql-ws@npm:5.7.0" + peerDependencies: + graphql: ">=0.11 <=16" + checksum: 39f795abc48a79177e54f5ef47331424987ba7194361dcfe983fd17c10ef853102b41283b996ab763c4293ea4c1215ba1da36d571c2487f4ff54d2b67a1dc176 + languageName: node + linkType: hard + "graphql@npm:16.3.0": version: 16.3.0 resolution: "graphql@npm:16.3.0" @@ -15938,6 +16222,15 @@ __metadata: languageName: node linkType: hard +"isomorphic-ws@npm:^4.0.1": + version: 4.0.1 + resolution: "isomorphic-ws@npm:4.0.1" + peerDependencies: + ws: "*" + checksum: d7190eadefdc28bdb93d67b5f0c603385aaf87724fa2974abb382ac1ec9756ed2cfb27065cbe76122879c2d452e2982bc4314317f3d6c737ddda6c047328771a + languageName: node + linkType: hard + "istanbul-lib-coverage@npm:^3.0.0, istanbul-lib-coverage@npm:^3.0.1, istanbul-lib-coverage@npm:^3.2.0": version: 3.2.0 resolution: "istanbul-lib-coverage@npm:3.2.0" @@ -15990,6 +16283,13 @@ __metadata: languageName: node linkType: hard +"iterall@npm:^1.2.1": + version: 1.3.0 + resolution: "iterall@npm:1.3.0" + checksum: c78b99678f8c99be488cca7f33e4acca9b72c1326e050afbaf023f086e55619ee466af0464af94a0cb3f292e60cb5bac53a8fd86bd4249ecad26e09f17bb158b + languageName: node + linkType: hard + "iterate-iterator@npm:^1.0.1": version: 1.0.2 resolution: "iterate-iterator@npm:1.0.2" @@ -17258,6 +17558,13 @@ __metadata: languageName: node linkType: hard +"lodash.get@npm:^4": + version: 4.4.2 + resolution: "lodash.get@npm:4.4.2" + checksum: e403047ddb03181c9d0e92df9556570e2b67e0f0a930fcbbbd779370972368f5568e914f913e93f3b08f6d492abc71e14d4e9b7a18916c31fa04bd2306efe545 + languageName: node + linkType: hard + "lodash.isarguments@npm:^3.1.0": version: 3.1.0 resolution: "lodash.isarguments@npm:3.1.0" @@ -17272,6 +17579,13 @@ __metadata: languageName: node linkType: hard +"lodash.lowercase@npm:4.3.0": + version: 4.3.0 + resolution: "lodash.lowercase@npm:4.3.0" + checksum: 463d7e50db29aea736563352f05adcff1f7c60574fe201f47ad98d2834f3dc64bee84a31702e1661d0f94913e89a46ded04befd425bbd3b95d23697689118f98 + languageName: node + linkType: hard + "lodash.memoize@npm:4.x, lodash.memoize@npm:^4.1.2": version: 4.1.2 resolution: "lodash.memoize@npm:4.1.2" @@ -17510,7 +17824,7 @@ __metadata: languageName: node linkType: hard -"make-error@npm:1.x, make-error@npm:^1.1.1": +"make-error@npm:1.x, make-error@npm:^1, make-error@npm:^1.1.1": version: 1.3.6 resolution: "make-error@npm:1.3.6" checksum: b86e5e0e25f7f777b77fabd8e2cbf15737972869d852a22b7e73c17623928fccb826d8e46b9951501d3f20e51ad74ba8c59ed584f610526a48f8ccf88aaec402 @@ -18006,6 +18320,18 @@ __metadata: languageName: node linkType: hard +"meros@npm:^1.1.4": + version: 1.2.0 + resolution: "meros@npm:1.2.0" + peerDependencies: + "@types/node": ">=12" + peerDependenciesMeta: + "@types/node": + optional: true + checksum: 95ec2dc352ad4ffe7a8572676d0399e8cfe67bb3ebe03ce5b03ebb4d990527994528260ff47a7efedc1348a8ee46bfe782564127bd1566d4790e1189b0a1ed29 + languageName: node + linkType: hard + "methods@npm:~1.1.2": version: 1.1.2 resolution: "methods@npm:1.1.2" @@ -18605,6 +18931,15 @@ __metadata: languageName: node linkType: hard +"minimatch@npm:4.2.1": + version: 4.2.1 + resolution: "minimatch@npm:4.2.1" + dependencies: + brace-expansion: ^1.1.7 + checksum: 2b1514e3d0f29a549912f0db7ae7b82c5cab4a8f2dd0369f1c6451a325b3f12b2cf473c95873b6157bb8df183d6cf6db82ff03614b6adaaf1d7e055beccdfd01 + languageName: node + linkType: hard + "minimatch@npm:^3.0.2, minimatch@npm:^3.0.4, minimatch@npm:^3.1.2": version: 3.1.2 resolution: "minimatch@npm:3.1.2" @@ -19136,10 +19471,9 @@ __metadata: "@types/node": 17.0.23 "@types/react": 17.0.44 "@types/react-dom": 17.0.15 - "@typescript-eslint/eslint-plugin": 5.18.0 - "@typescript-eslint/parser": 5.18.0 "@your-org/core-lib": "workspace:^" "@your-org/db-main-prisma": "workspace:^" + "@your-org/eslint-config-bases": "workspace:^" "@your-org/ui-lib": "workspace:^" apollo-server-core: 3.6.7 apollo-server-micro: 3.6.7 @@ -19150,20 +19484,7 @@ __metadata: dotenv-flow: 3.2.0 dotenv-flow-cli: 1.0.0 es-check: 6.2.1 - eslint: 8.13.0 eslint-config-next: 12.1.4 - eslint-config-prettier: 8.5.0 - eslint-import-resolver-typescript: 2.7.1 - eslint-plugin-import: 2.26.0 - eslint-plugin-jest: 26.1.4 - eslint-plugin-jest-formatting: 3.1.0 - eslint-plugin-jsx-a11y: 6.5.1 - eslint-plugin-prettier: 4.0.0 - eslint-plugin-react: 7.29.4 - eslint-plugin-react-hooks: 4.4.0 - eslint-plugin-regexp: 1.6.0 - eslint-plugin-sonarjs: 0.13.0 - eslint-plugin-testing-library: 5.2.1 graphql: 16.3.0 i18next: 21.6.14 ioredis: 5.0.1 @@ -19278,6 +19599,13 @@ __metadata: languageName: node linkType: hard +"node-domexception@npm:1.0.0": + version: 1.0.0 + resolution: "node-domexception@npm:1.0.0" + checksum: ee1d37dd2a4eb26a8a92cd6b64dfc29caec72bff5e1ed9aba80c294f57a31ba4895a60fd48347cf17dd6e766da0ae87d75657dfd1f384ebfa60462c2283f5c7f + languageName: node + linkType: hard + "node-fetch@npm:^2.5.0, node-fetch@npm:^2.6.1, node-fetch@npm:^2.6.7": version: 2.6.7 resolution: "node-fetch@npm:2.6.7" @@ -19886,6 +20214,15 @@ __metadata: languageName: node linkType: hard +"p-limit@npm:3.1.0, p-limit@npm:^3.0.2, p-limit@npm:^3.1.0": + version: 3.1.0 + resolution: "p-limit@npm:3.1.0" + dependencies: + yocto-queue: ^0.1.0 + checksum: 7c3690c4dbf62ef625671e20b7bdf1cbc9534e83352a2780f165b0d3ceba21907e77ad63401708145ca4e25bfc51636588d89a8c0aeb715e6c37d1c066430360 + languageName: node + linkType: hard + "p-limit@npm:^1.1.0": version: 1.3.0 resolution: "p-limit@npm:1.3.0" @@ -19904,15 +20241,6 @@ __metadata: languageName: node linkType: hard -"p-limit@npm:^3.0.2, p-limit@npm:^3.1.0": - version: 3.1.0 - resolution: "p-limit@npm:3.1.0" - dependencies: - yocto-queue: ^0.1.0 - checksum: 7c3690c4dbf62ef625671e20b7bdf1cbc9534e83352a2780f165b0d3ceba21907e77ad63401708145ca4e25bfc51636588d89a8c0aeb715e6c37d1c066430360 - languageName: node - linkType: hard - "p-locate@npm:^2.0.0": version: 2.0.0 resolution: "p-locate@npm:2.0.0" @@ -21990,7 +22318,7 @@ __metadata: languageName: node linkType: hard -"react-dom@npm:18.0.0, react-dom@npm:>=17.0.2": +"react-dom@npm:18.0.0, react-dom@npm:>=17.0.2, react-dom@npm:^18.0.0": version: 18.0.0 resolution: "react-dom@npm:18.0.0" dependencies: @@ -22240,7 +22568,7 @@ __metadata: languageName: node linkType: hard -"react@npm:18.0.0, react@npm:>=17.0.2": +"react@npm:18.0.0, react@npm:>=17.0.2, react@npm:^18.0.0": version: 18.0.0 resolution: "react@npm:18.0.0" dependencies: @@ -22729,25 +23057,11 @@ __metadata: "@testing-library/react-hooks": 7.0.2 "@types/react": 17.0.44 "@types/react-dom": 17.0.15 - "@typescript-eslint/eslint-plugin": 5.18.0 - "@typescript-eslint/parser": 5.18.0 "@vercel/node": 1.14.0 "@your-org/core-lib": "workspace:^" + "@your-org/eslint-config-bases": "workspace:^" "@your-org/ui-lib": "workspace:^" autoprefixer: 10.4.4 - eslint: 8.13.0 - eslint-config-prettier: 8.5.0 - eslint-import-resolver-typescript: 2.7.1 - eslint-plugin-import: 2.26.0 - eslint-plugin-jest: 26.1.4 - eslint-plugin-jest-formatting: 3.1.0 - eslint-plugin-jsx-a11y: 6.5.1 - eslint-plugin-prettier: 4.0.0 - eslint-plugin-react: 7.29.4 - eslint-plugin-react-hooks: 4.4.0 - eslint-plugin-regexp: 1.6.0 - eslint-plugin-sonarjs: 0.13.0 - eslint-plugin-testing-library: 5.2.1 jest: 27.5.1 jest-css-modules-transform: 4.3.0 npm-run-all: 4.1.5 @@ -22843,7 +23157,7 @@ __metadata: languageName: node linkType: hard -"requireindex@npm:^1.1.0, requireindex@npm:^1.2.0": +"requireindex@npm:^1.2.0": version: 1.2.0 resolution: "requireindex@npm:1.2.0" checksum: 50d8b10a1ff1fdf6aea7a1870bc7bd238b0fb1917d8d7ca17fd03afc38a65dcd7a8a4eddd031f89128b5f0065833d5c92c4fef67f2c04e8624057fe626c9cf94 @@ -24261,6 +24575,13 @@ __metadata: languageName: node linkType: hard +"string-env-interpolation@npm:1.0.1": + version: 1.0.1 + resolution: "string-env-interpolation@npm:1.0.1" + checksum: d126329587f635bee65300e4451e7352b9b67e03daeb62f006ca84244cac12a1f6e45176b018653ba0c3ec3b5d980f9ca59d2eeed99cf799501cdaa7f871dc6f + languageName: node + linkType: hard + "string-hash@npm:^1.1.1": version: 1.1.3 resolution: "string-hash@npm:1.1.3" @@ -24679,6 +25000,21 @@ __metadata: languageName: node linkType: hard +"subscriptions-transport-ws@npm:^0.11.0": + version: 0.11.0 + resolution: "subscriptions-transport-ws@npm:0.11.0" + dependencies: + backo2: ^1.0.2 + eventemitter3: ^3.1.0 + iterall: ^1.2.1 + symbol-observable: ^1.0.4 + ws: ^5.2.0 || ^6.0.0 || ^7.0.0 + peerDependencies: + graphql: ^15.7.2 || ^16.0.0 + checksum: cc2e98d5c9d89c44d2e15eca188781c6ebae13d1661c42a99cee9d2897aebe2a22bc118eefff83244a79c88ee4ea24d46973ebf26ae7cb47ac1857fb8ee2c947 + languageName: node + linkType: hard + "superjson@npm:1.8.1": version: 1.8.1 resolution: "superjson@npm:1.8.1" @@ -24778,6 +25114,13 @@ __metadata: languageName: node linkType: hard +"symbol-observable@npm:^1.0.4": + version: 1.2.0 + resolution: "symbol-observable@npm:1.2.0" + checksum: 48ffbc22e3d75f9853b3ff2ae94a44d84f386415110aea5effc24d84c502e03a4a6b7a8f75ebaf7b585780bda34eb5d6da3121f826a6f93398429d30032971b6 + languageName: node + linkType: hard + "symbol-tree@npm:^3.2.4": version: 3.2.4 resolution: "symbol-tree@npm:3.2.4" @@ -24824,6 +25167,16 @@ __metadata: languageName: node linkType: hard +"sync-fetch@npm:^0.3.1": + version: 0.3.1 + resolution: "sync-fetch@npm:0.3.1" + dependencies: + buffer: ^5.7.0 + node-fetch: ^2.6.1 + checksum: f6afd3e18efd7ff0540c2c559fea66e42bc9ae1cc72f5cbd5e51def40062aa7915c06be7e02e10d23e0b844aa3865b3ec41b0ed951688e981acb12548299dff4 + languageName: node + linkType: hard + "synchronous-promise@npm:^2.0.15": version: 2.0.15 resolution: "synchronous-promise@npm:2.0.15" @@ -25523,6 +25876,27 @@ __metadata: languageName: node linkType: hard +"ts-node@npm:^9": + version: 9.1.1 + resolution: "ts-node@npm:9.1.1" + dependencies: + arg: ^4.1.0 + create-require: ^1.1.0 + diff: ^4.0.1 + make-error: ^1.1.1 + source-map-support: ^0.5.17 + yn: 3.1.1 + peerDependencies: + typescript: ">=2.7" + bin: + ts-node: dist/bin.js + ts-node-script: dist/bin-script.js + ts-node-transpile-only: dist/bin-transpile.js + ts-script: dist/bin-script-deprecated.js + checksum: 356e2647b8b1e6ab00380c0537fa569b63bd9b6f006cc40fd650f81fae1817bd8fecc075300036950d8f45c1d85b95be33cd1e48a1a424a7d86c3dbb42bf60e5 + languageName: node + linkType: hard + "ts-pnp@npm:^1.1.6": version: 1.2.0 resolution: "ts-pnp@npm:1.2.0" @@ -25563,7 +25937,7 @@ __metadata: languageName: node linkType: hard -"tslib@npm:2.3.1, tslib@npm:^2.0.0, tslib@npm:^2.0.1, tslib@npm:^2.0.3, tslib@npm:^2.1.0, tslib@npm:^2.3.0, tslib@npm:~2.3.0": +"tslib@npm:2.3.1, tslib@npm:^2, tslib@npm:^2.0.0, tslib@npm:^2.0.1, tslib@npm:^2.0.3, tslib@npm:^2.1.0, tslib@npm:^2.3.0, tslib@npm:~2.3.0": version: 2.3.1 resolution: "tslib@npm:2.3.1" checksum: de17a98d4614481f7fcb5cd53ffc1aaf8654313be0291e1bfaee4b4bb31a20494b7d218ff2e15017883e8ea9626599b3b0e0229c18383ba9dce89da2adf15cb9 @@ -25788,6 +26162,13 @@ __metadata: languageName: node linkType: hard +"undici@npm:^5.0.0": + version: 5.0.0 + resolution: "undici@npm:5.0.0" + checksum: 98bb9914aa0647840ce6fd518ac828b7760df8d9b747680d11260fcb4f50af0029b0513e5600bf0d3a812d9e3f8d9d787bbcbcee7b9e75aa5f7de6f9b0212898 + languageName: node + linkType: hard + "unfetch@npm:^4.2.0": version: 4.2.0 resolution: "unfetch@npm:4.2.0" @@ -26092,6 +26473,15 @@ __metadata: languageName: node linkType: hard +"unixify@npm:^1.0.0": + version: 1.0.0 + resolution: "unixify@npm:1.0.0" + dependencies: + normalize-path: ^2.1.1 + checksum: 3be30e48579fc6c7390bd59b4ab9e745fede0c164dfb7351cf710bd1dbef8484b1441186205af6bcb13b731c0c88caf9b33459f7bf8c89e79c046e656ae433f0 + languageName: node + linkType: hard + "unload@npm:2.2.0": version: 2.2.0 resolution: "unload@npm:2.2.0" @@ -26376,7 +26766,7 @@ __metadata: languageName: node linkType: hard -"value-or-promise@npm:1.0.11": +"value-or-promise@npm:1.0.11, value-or-promise@npm:^1.0.11": version: 1.0.11 resolution: "value-or-promise@npm:1.0.11" checksum: 13f8f2ef620118c73b4d1beee8ce6045d7182bbf15090ecfbcafb677ec43698506a5e9ace6bea5ea35c32bc612c9b1f824bb59b6581cdfb5c919052745c277d5 @@ -26460,20 +26850,8 @@ __metadata: "@types/react-dom": 17.0.15 "@vitejs/plugin-react": 1.3.0 "@your-org/core-lib": "workspace:^" + "@your-org/eslint-config-bases": "workspace:^" "@your-org/ui-lib": "workspace:^" - eslint: 8.13.0 - eslint-config-prettier: 8.5.0 - eslint-import-resolver-typescript: 2.7.1 - eslint-plugin-import: 2.26.0 - eslint-plugin-jest: 26.1.4 - eslint-plugin-jest-formatting: 3.1.0 - eslint-plugin-jsx-a11y: 6.5.1 - eslint-plugin-prettier: 4.0.0 - eslint-plugin-react: 7.29.4 - eslint-plugin-react-hooks: 4.4.0 - eslint-plugin-regexp: 1.6.0 - eslint-plugin-sonarjs: 0.13.0 - eslint-plugin-testing-library: 5.2.1 prettier: 2.6.2 react: 18.0.0 react-dom: 18.0.0 @@ -26643,10 +27021,17 @@ __metadata: languageName: node linkType: hard -"web-streams-polyfill@npm:^3.1.1": - version: 3.2.0 - resolution: "web-streams-polyfill@npm:3.2.0" - checksum: e23ad0649392fa0159dbfc6bb27474c308c3f332d9078cfef3c06c154165bef18732c5814126147c6c712f604216ddc950c171c854e3821f020e0d2d721a5958 +"web-streams-polyfill@npm:4.0.0-beta.1": + version: 4.0.0-beta.1 + resolution: "web-streams-polyfill@npm:4.0.0-beta.1" + checksum: 94c21d3aba1c26e5942bb210ffd60c6990cbc750d34bdf548ed93ed845f0a6eac89cdae1dd0195afaba15fbcf4aaca9e397ee40fa4d1f2c191d04d43717bd065 + languageName: node + linkType: hard + +"web-streams-polyfill@npm:^3.1.1, web-streams-polyfill@npm:^3.2.0": + version: 3.2.1 + resolution: "web-streams-polyfill@npm:3.2.1" + checksum: b119c78574b6d65935e35098c2afdcd752b84268e18746606af149e3c424e15621b6f1ff0b42b2676dc012fc4f0d313f964b41a4b5031e525faa03997457da02 languageName: node linkType: hard @@ -27089,7 +27474,7 @@ __metadata: languageName: node linkType: hard -"ws@npm:8.4.2, ws@npm:^8.2.3": +"ws@npm:8.4.2": version: 8.4.2 resolution: "ws@npm:8.4.2" peerDependencies: @@ -27104,9 +27489,24 @@ __metadata: languageName: node linkType: hard -"ws@npm:^7.3.1, ws@npm:^7.4.5, ws@npm:^7.4.6": - version: 7.5.6 - resolution: "ws@npm:7.5.6" +"ws@npm:^5.2.0 || ^6.0.0 || ^7.0.0, ws@npm:^7.3.1, ws@npm:^7.4.5, ws@npm:^7.4.6": + version: 7.5.7 + resolution: "ws@npm:7.5.7" + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ^5.0.2 + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + checksum: 5c1f669a166fb57560b4e07f201375137fa31d9186afde78b1508926345ce546332f109081574ddc4e38cc474c5406b5fc71c18d71eb75f6e2d2245576976cba + languageName: node + linkType: hard + +"ws@npm:^8.2.3, ws@npm:^8.3.0": + version: 8.5.0 + resolution: "ws@npm:8.5.0" peerDependencies: bufferutil: ^4.0.1 utf-8-validate: ^5.0.2 @@ -27115,7 +27515,7 @@ __metadata: optional: true utf-8-validate: optional: true - checksum: 0c2ffc9a539dd61dd2b00ff6cc5c98a3371e2521011fe23da4b3578bb7ac26cbdf7ca8a68e8e08023c122ae247013216dde2a20c908de415a6bcc87bdef68c87 + checksum: 76f2f90e40344bf18fd544194e7067812fb1372b2a37865678d8f12afe4b478ff2ebc0c7c0aff82cd5e6b66fc43d889eec0f1865c2365d8f7a66d92da7744a77 languageName: node linkType: hard From 9f2c2d049cfb87a3023a38b096f07f998862e3f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Vanvelthem?= Date: Sun, 10 Apr 2022 14:46:40 +0200 Subject: [PATCH 06/22] docs: mention new eslint-plugin-bases --- .changeset/long-pumas-smash.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .changeset/long-pumas-smash.md diff --git a/.changeset/long-pumas-smash.md b/.changeset/long-pumas-smash.md new file mode 100644 index 00000000000..6054ed1b193 --- /dev/null +++ b/.changeset/long-pumas-smash.md @@ -0,0 +1,11 @@ +--- +"nextjs-app": minor +"remix-app": minor +"vite-app": minor +"@your-org/core-lib": minor +"@your-org/db-main-prisma": minor +"@your-org/ui-lib": minor +"@your-org/eslint-config-bases": minor +--- + +Improved linter configs From 401d3fd83c47e2e401d3268fae9835c65a8a74ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Vanvelthem?= Date: Sun, 10 Apr 2022 14:55:15 +0200 Subject: [PATCH 07/22] chore(dev-deps): add missing eslint peer --- apps/nextjs-app/package.json | 88 +++++++++++++------------- apps/remix-app/package.json | 1 + apps/vite-app/package.json | 1 + packages/core-lib/package.json | 1 + packages/ui-lib/package.json | 1 + tools/eslint-config-bases/package.json | 2 +- yarn.lock | 50 ++++++++------- 7 files changed, 76 insertions(+), 68 deletions(-) diff --git a/apps/nextjs-app/package.json b/apps/nextjs-app/package.json index 34c2c247124..c79510445a6 100644 --- a/apps/nextjs-app/package.json +++ b/apps/nextjs-app/package.json @@ -49,50 +49,6 @@ "?postinstall": "@todo: the prisma generate seems to be required, but is installed at the root", "postinstall": "test -n \"$SKIP_POSTINSTALL\" || yarn workspace @your-org/db-main-prisma run prisma generate" }, - "devDependencies": { - "@emotion/babel-plugin": "11.7.2", - "@next/bundle-analyzer": "12.1.4", - "@next/env": "12.1.4", - "@playwright/test": "1.20.2", - "@size-limit/file": "7.0.8", - "@svgr/webpack": "6.2.1", - "@tailwindcss/aspect-ratio": "0.4.0", - "@tailwindcss/forms": "0.5.0", - "@tailwindcss/line-clamp": "0.3.1", - "@tailwindcss/typography": "0.5.2", - "@testing-library/jest-dom": "5.16.4", - "@testing-library/react": "13.0.0", - "@testing-library/react-hooks": "7.0.2", - "@types/cors": "2.8.12", - "@types/ioredis": "4.28.10", - "@types/jest": "27.4.1", - "@types/node": "17.0.23", - "@types/react": "17.0.44", - "@types/react-dom": "17.0.15", - "@your-org/eslint-config-bases": "workspace:^", - "autoprefixer": "10.4.4", - "cross-env": "7.0.3", - "dotenv-flow": "3.2.0", - "dotenv-flow-cli": "1.0.0", - "es-check": "6.2.1", - "eslint-config-next": "12.1.4", - "jest": "27.5.1", - "jest-css-modules-transform": "4.3.0", - "npm-run-all": "4.1.5", - "postcss": "8.4.12", - "postcss-flexbugs-fixes": "5.0.2", - "postcss-preset-env": "7.4.3", - "prettier": "2.6.2", - "rimraf": "3.0.2", - "sass": "1.50.0", - "size-limit": "7.0.8", - "symlink-dir": "5.0.1", - "sync-directory": "4.0.12", - "tailwindcss": "3.0.23", - "ts-jest": "27.1.4", - "ts-node": "10.7.0", - "typescript": "4.6.3" - }, "dependencies": { "@babel/core": "7.17.9", "@emotion/cache": "11.7.1", @@ -135,5 +91,49 @@ "sharp": "0.30.3", "superjson": "1.8.1", "type-fest": "2.12.2" + }, + "devDependencies": { + "@emotion/babel-plugin": "11.7.2", + "@next/bundle-analyzer": "12.1.4", + "@next/env": "12.1.4", + "@playwright/test": "1.20.2", + "@size-limit/file": "7.0.8", + "@svgr/webpack": "6.2.1", + "@tailwindcss/aspect-ratio": "0.4.0", + "@tailwindcss/forms": "0.5.0", + "@tailwindcss/line-clamp": "0.3.1", + "@tailwindcss/typography": "0.5.2", + "@testing-library/jest-dom": "5.16.4", + "@testing-library/react": "13.0.0", + "@testing-library/react-hooks": "7.0.2", + "@types/cors": "2.8.12", + "@types/ioredis": "4.28.10", + "@types/jest": "27.4.1", + "@types/node": "17.0.23", + "@types/react": "17.0.44", + "@types/react-dom": "17.0.15", + "@your-org/eslint-config-bases": "workspace:^", + "autoprefixer": "10.4.4", + "cross-env": "7.0.3", + "dotenv-flow": "3.2.0", + "dotenv-flow-cli": "1.0.0", + "es-check": "6.2.1", + "eslint": "8.13.0", + "eslint-config-next": "12.1.4", + "jest": "27.5.1", + "jest-css-modules-transform": "4.3.0", + "npm-run-all": "4.1.5", + "postcss": "8.4.12", + "postcss-flexbugs-fixes": "5.0.2", + "postcss-preset-env": "7.4.3", + "prettier": "2.6.2", + "rimraf": "3.0.2", + "sass": "1.50.0", + "size-limit": "7.0.8", + "symlink-dir": "5.0.1", + "sync-directory": "4.0.12", + "tailwindcss": "3.0.23", + "ts-jest": "27.1.4", + "typescript": "4.6.3" } } diff --git a/apps/remix-app/package.json b/apps/remix-app/package.json index 0d2f1214e77..dfed598c54e 100644 --- a/apps/remix-app/package.json +++ b/apps/remix-app/package.json @@ -62,6 +62,7 @@ "@vercel/node": "1.14.0", "@your-org/eslint-config-bases": "workspace:^", "autoprefixer": "10.4.4", + "eslint": "8.13.0", "jest": "27.5.1", "jest-css-modules-transform": "4.3.0", "npm-run-all": "4.1.5", diff --git a/apps/vite-app/package.json b/apps/vite-app/package.json index 5c4f3f2b02e..d972c4dc5de 100644 --- a/apps/vite-app/package.json +++ b/apps/vite-app/package.json @@ -30,6 +30,7 @@ "@types/react-dom": "17.0.15", "@vitejs/plugin-react": "1.3.0", "@your-org/eslint-config-bases": "workspace:^", + "eslint": "8.13.0", "prettier": "2.6.2", "rimraf": "3.0.2", "typescript": "4.6.3", diff --git a/packages/core-lib/package.json b/packages/core-lib/package.json index 8073d92ebc6..17371077dea 100644 --- a/packages/core-lib/package.json +++ b/packages/core-lib/package.json @@ -51,6 +51,7 @@ "@types/react": "17.0.44", "@types/react-dom": "17.0.15", "cross-env": "7.0.3", + "eslint": "8.13.0", "jest": "27.5.1", "microbundle": "0.14.2", "npm-run-all": "4.1.5", diff --git a/packages/ui-lib/package.json b/packages/ui-lib/package.json index de10c33fdf0..268f77feb44 100644 --- a/packages/ui-lib/package.json +++ b/packages/ui-lib/package.json @@ -78,6 +78,7 @@ "babel-plugin-polyfill-corejs3": "0.5.2", "core-js": "3.21.1", "cross-env": "7.0.3", + "eslint": "8.13.0", "jest": "27.5.1", "microbundle": "0.14.2", "npm-run-all": "4.1.5", diff --git a/tools/eslint-config-bases/package.json b/tools/eslint-config-bases/package.json index abd5dd8b64c..a18fcf39948 100644 --- a/tools/eslint-config-bases/package.json +++ b/tools/eslint-config-bases/package.json @@ -59,7 +59,6 @@ "@types/react-dom": "17.0.15", "@typescript-eslint/eslint-plugin": "5.18.0", "@typescript-eslint/parser": "5.18.0", - "eslint": "8.13.0", "eslint-config-prettier": "8.5.0", "eslint-import-resolver-typescript": "2.7.1", "eslint-plugin-import": "2.26.0", @@ -77,6 +76,7 @@ "rimraf": "3.0.2" }, "peerDependencies": { + "eslint": "^8.8.0", "react": "^17.0.2 || ^18.0.0", "react-dom": "^17.0.2 || ^18.0.0", "typescript": "^4.5.0" diff --git a/yarn.lock b/yarn.lock index fc35b135254..3ceef4d5911 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7278,6 +7278,7 @@ __metadata: "@types/react-dom": 17.0.15 cross-env: 7.0.3 dequal: ^2.0.0 + eslint: 8.13.0 jest: 27.5.1 microbundle: 0.14.2 npm-run-all: 4.1.5 @@ -7342,7 +7343,6 @@ __metadata: "@types/react-dom": 17.0.15 "@typescript-eslint/eslint-plugin": 5.18.0 "@typescript-eslint/parser": 5.18.0 - eslint: 8.13.0 eslint-config-prettier: 8.5.0 eslint-import-resolver-typescript: 2.7.1 eslint-plugin-import: 2.26.0 @@ -7362,6 +7362,7 @@ __metadata: rimraf: 3.0.2 typescript: 4.6.3 peerDependencies: + eslint: ^8.8.0 react: ^17.0.2 || ^18.0.0 react-dom: ^17.0.2 || ^18.0.0 typescript: ^4.5.0 @@ -7407,6 +7408,7 @@ __metadata: babel-plugin-polyfill-corejs3: 0.5.2 core-js: 3.21.1 cross-env: 7.0.3 + eslint: 8.13.0 jest: 27.5.1 microbundle: 0.14.2 npm-run-all: 4.1.5 @@ -19484,6 +19486,7 @@ __metadata: dotenv-flow: 3.2.0 dotenv-flow-cli: 1.0.0 es-check: 6.2.1 + eslint: 8.13.0 eslint-config-next: 12.1.4 graphql: 16.3.0 i18next: 21.6.14 @@ -19519,7 +19522,6 @@ __metadata: sync-directory: 4.0.12 tailwindcss: 3.0.23 ts-jest: 27.1.4 - ts-node: 10.7.0 type-fest: 2.12.2 typescript: 4.6.3 languageName: unknown @@ -23062,6 +23064,7 @@ __metadata: "@your-org/eslint-config-bases": "workspace:^" "@your-org/ui-lib": "workspace:^" autoprefixer: 10.4.4 + eslint: 8.13.0 jest: 27.5.1 jest-css-modules-transform: 4.3.0 npm-run-all: 4.1.5 @@ -25818,7 +25821,27 @@ __metadata: languageName: node linkType: hard -"ts-node@npm:10.7.0, ts-node@npm:^10.4.0": +"ts-node@npm:8.9.1": + version: 8.9.1 + resolution: "ts-node@npm:8.9.1" + dependencies: + arg: ^4.1.0 + diff: ^4.0.1 + make-error: ^1.1.1 + source-map-support: ^0.5.17 + yn: 3.1.1 + peerDependencies: + typescript: ">=2.7" + bin: + ts-node: dist/bin.js + ts-node-script: dist/bin-script.js + ts-node-transpile-only: dist/bin-transpile.js + ts-script: dist/bin-script-deprecated.js + checksum: 59997e32cfb84323317f9fd33ff62d025b467ff36c296c3ad1ee54f08fd355c58fab37e096e2a63fd01fced929384b16b9d74bf324713a21844e527ddd5f6c17 + languageName: node + linkType: hard + +"ts-node@npm:^10.4.0": version: 10.7.0 resolution: "ts-node@npm:10.7.0" dependencies: @@ -25856,26 +25879,6 @@ __metadata: languageName: node linkType: hard -"ts-node@npm:8.9.1": - version: 8.9.1 - resolution: "ts-node@npm:8.9.1" - dependencies: - arg: ^4.1.0 - diff: ^4.0.1 - make-error: ^1.1.1 - source-map-support: ^0.5.17 - yn: 3.1.1 - peerDependencies: - typescript: ">=2.7" - bin: - ts-node: dist/bin.js - ts-node-script: dist/bin-script.js - ts-node-transpile-only: dist/bin-transpile.js - ts-script: dist/bin-script-deprecated.js - checksum: 59997e32cfb84323317f9fd33ff62d025b467ff36c296c3ad1ee54f08fd355c58fab37e096e2a63fd01fced929384b16b9d74bf324713a21844e527ddd5f6c17 - languageName: node - linkType: hard - "ts-node@npm:^9": version: 9.1.1 resolution: "ts-node@npm:9.1.1" @@ -26852,6 +26855,7 @@ __metadata: "@your-org/core-lib": "workspace:^" "@your-org/eslint-config-bases": "workspace:^" "@your-org/ui-lib": "workspace:^" + eslint: 8.13.0 prettier: 2.6.2 react: 18.0.0 react-dom: 18.0.0 From 420001eec86afa1644aca5dc10165e7aeb23bb74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Vanvelthem?= Date: Sun, 10 Apr 2022 15:01:33 +0200 Subject: [PATCH 08/22] chore(deps): fix missing graphql-eslint --- tools/eslint-config-bases/package.json | 9 +++++---- yarn.lock | 13 +++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/tools/eslint-config-bases/package.json b/tools/eslint-config-bases/package.json index a18fcf39948..a72f59d1e21 100644 --- a/tools/eslint-config-bases/package.json +++ b/tools/eslint-config-bases/package.json @@ -50,6 +50,7 @@ "fix-all-files": "eslint . --ext .ts,.tsx,.js,.jsx --fix" }, "dependencies": { + "@graphql-eslint/eslint-plugin": "3.10.2", "@testing-library/jest-dom": "5.16.4", "@testing-library/react": "13.0.0", "@testing-library/react-hooks": "7.0.2", @@ -76,10 +77,10 @@ "rimraf": "3.0.2" }, "peerDependencies": { - "eslint": "^8.8.0", + "eslint": "^8.0.0", "react": "^17.0.2 || ^18.0.0", "react-dom": "^17.0.2 || ^18.0.0", - "typescript": "^4.5.0" + "typescript": "^4.5.2" }, "peerDependenciesMeta": { "react": { @@ -90,9 +91,9 @@ } }, "devDependencies": { - "@graphql-eslint/eslint-plugin": "3.10.2", + "eslint": "^8.13.0", "react": "^18.0.0", "react-dom": "^18.0.0", - "typescript": "4.6.3" + "typescript": "^4.6.3" } } diff --git a/yarn.lock b/yarn.lock index 3ceef4d5911..5dc7ecf7cf1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7343,6 +7343,7 @@ __metadata: "@types/react-dom": 17.0.15 "@typescript-eslint/eslint-plugin": 5.18.0 "@typescript-eslint/parser": 5.18.0 + eslint: ^8.13.0 eslint-config-prettier: 8.5.0 eslint-import-resolver-typescript: 2.7.1 eslint-plugin-import: 2.26.0 @@ -7360,12 +7361,12 @@ __metadata: react: ^18.0.0 react-dom: ^18.0.0 rimraf: 3.0.2 - typescript: 4.6.3 + typescript: ^4.6.3 peerDependencies: - eslint: ^8.8.0 + eslint: ^8.0.0 react: ^17.0.2 || ^18.0.0 react-dom: ^17.0.2 || ^18.0.0 - typescript: ^4.5.0 + typescript: ^4.5.2 peerDependenciesMeta: react: optional: true @@ -12823,7 +12824,7 @@ __metadata: languageName: node linkType: hard -"eslint@npm:8.13.0": +"eslint@npm:8.13.0, eslint@npm:^8.13.0": version: 8.13.0 resolution: "eslint@npm:8.13.0" dependencies: @@ -26107,7 +26108,7 @@ __metadata: languageName: node linkType: hard -"typescript@npm:4.6.3, typescript@npm:^4.1.3, typescript@npm:^4.4.3": +"typescript@npm:4.6.3, typescript@npm:^4.1.3, typescript@npm:^4.4.3, typescript@npm:^4.6.3": version: 4.6.3 resolution: "typescript@npm:4.6.3" bin: @@ -26127,7 +26128,7 @@ __metadata: languageName: node linkType: hard -"typescript@patch:typescript@4.6.3#~builtin, typescript@patch:typescript@^4.1.3#~builtin, typescript@patch:typescript@^4.4.3#~builtin": +"typescript@patch:typescript@4.6.3#~builtin, typescript@patch:typescript@^4.1.3#~builtin, typescript@patch:typescript@^4.4.3#~builtin, typescript@patch:typescript@^4.6.3#~builtin": version: 4.6.3 resolution: "typescript@patch:typescript@npm%3A4.6.3#~builtin::version=4.6.3&hash=bda367" bin: From 5be9c7c1f020a7771dd2767a914cd2a89baea357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Vanvelthem?= Date: Sun, 10 Apr 2022 15:07:45 +0200 Subject: [PATCH 09/22] chore(dev-deps): missing dep on eslint-config-bases --- packages/core-lib/package.json | 1 + yarn.lock | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/core-lib/package.json b/packages/core-lib/package.json index 17371077dea..bb5c10e77e0 100644 --- a/packages/core-lib/package.json +++ b/packages/core-lib/package.json @@ -50,6 +50,7 @@ "@types/node": "17.0.23", "@types/react": "17.0.44", "@types/react-dom": "17.0.15", + "@your-org/eslint-config-bases": "workspace:^", "cross-env": "7.0.3", "eslint": "8.13.0", "jest": "27.5.1", diff --git a/yarn.lock b/yarn.lock index 5dc7ecf7cf1..991789f9c96 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7276,6 +7276,7 @@ __metadata: "@types/node": 17.0.23 "@types/react": 17.0.44 "@types/react-dom": 17.0.15 + "@your-org/eslint-config-bases": "workspace:^" cross-env: 7.0.3 dequal: ^2.0.0 eslint: 8.13.0 From 3a2552ef1d6395d8bc3466f85f7e0bdfa3941fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Vanvelthem?= Date: Sun, 10 Apr 2022 15:10:13 +0200 Subject: [PATCH 10/22] chore(dev-deps): missing dev-dep on testing-library --- packages/core-lib/package.json | 2 ++ yarn.lock | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/packages/core-lib/package.json b/packages/core-lib/package.json index bb5c10e77e0..ea5a636bc51 100644 --- a/packages/core-lib/package.json +++ b/packages/core-lib/package.json @@ -46,6 +46,8 @@ } }, "devDependencies": { + "@testing-library/react": "13.0.0", + "@testing-library/react-hooks": "8.0.0", "@types/jest": "27.4.1", "@types/node": "17.0.23", "@types/react": "17.0.44", diff --git a/yarn.lock b/yarn.lock index 991789f9c96..064faffffca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5882,6 +5882,28 @@ __metadata: languageName: node linkType: hard +"@testing-library/react-hooks@npm:8.0.0": + version: 8.0.0 + resolution: "@testing-library/react-hooks@npm:8.0.0" + dependencies: + "@babel/runtime": ^7.12.5 + react-error-boundary: ^3.1.0 + peerDependencies: + "@types/react": ^16.9.0 || ^17.0.0 + react: ^16.9.0 || ^17.0.0 + react-dom: ^16.9.0 || ^17.0.0 + react-test-renderer: ^16.9.0 || ^17.0.0 + peerDependenciesMeta: + "@types/react": + optional: true + react-dom: + optional: true + react-test-renderer: + optional: true + checksum: f45bd06601bf1d00e375c3d945b0e54b4d997b18402c45711deada7e8c4a8f569fe283973e6786c9ecd55e4bd01a43bd42546a2924453065880abf4b13dbafdb + languageName: node + linkType: hard + "@testing-library/react@npm:13.0.0": version: 13.0.0 resolution: "@testing-library/react@npm:13.0.0" @@ -7271,6 +7293,8 @@ __metadata: version: 0.0.0-use.local resolution: "@your-org/core-lib@workspace:packages/core-lib" dependencies: + "@testing-library/react": 13.0.0 + "@testing-library/react-hooks": 8.0.0 "@tsed/exceptions": ^6.100.3 "@types/jest": 27.4.1 "@types/node": 17.0.23 From e3c7789ae0cf8fb52b19b0b129c8359a9fc5a77e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Vanvelthem?= Date: Sun, 10 Apr 2022 23:42:25 +0200 Subject: [PATCH 11/22] refactor(eslint): new bases and prettier support --- .prettierignore | 1 + .prettierrc.js | 29 ++-- apps/nextjs-app/.eslintrc.js | 11 +- apps/remix-app/.eslintrc.js | 15 +- apps/vite-app/.eslintrc.js | 10 +- package.json | 4 +- packages/core-lib/.eslintrc.js | 10 +- packages/db-main-prisma/.eslintrc.js | 8 +- packages/eslint-config-bases/.eslintrc.js | 7 + packages/eslint-config-bases/README.md | 147 ++++++++++++++++++ .../eslint-config-bases/lint-staged.config.js | 0 .../eslint-config-bases/package.json | 17 +- .../src/bases/graphql-schema.js | 19 +++ .../eslint-config-bases/src/bases/index.js | 10 ++ .../eslint-config-bases/src/bases/jest.js | 12 +- .../src/bases/playwright.js | 27 ++++ .../eslint-config-bases/src/bases/prettier.js | 16 ++ .../eslint-config-bases/src/bases/react.js | 11 +- packages/eslint-config-bases/src/bases/rtl.js | 29 ++++ .../eslint-config-bases/src/bases/sonar.js | 47 ++++++ .../src/bases/storybook.js | 22 +++ .../src/bases/typescript.js | 7 +- .../src/helpers/getDefaultIgnorePatterns.js | 7 + .../src/helpers/getPrettierConfig.js | 17 ++ .../eslint-config-bases/src/helpers/index.js | 7 + packages/eslint-config-bases/src/index.js | 3 + .../eslint-config-bases/tsconfig.json | 0 packages/ui-lib/.eslintrc.js | 9 +- packages/ui-lib/.gitignore | 1 + tools/eslint-config-bases/.eslintrc.js | 5 - tools/eslint-config-bases/README.md | 11 -- .../src/bases/graphql-schema.js | 15 -- .../src/bases/playwright.js | 19 --- .../src/bases/react-testing-library.js | 26 ---- tools/eslint-config-bases/src/bases/sonar.js | 26 ---- .../src/bases/storybook.js | 12 -- tools/eslint-config-bases/src/index.js | 14 -- yarn.lock | 5 +- 38 files changed, 468 insertions(+), 168 deletions(-) create mode 100644 packages/eslint-config-bases/.eslintrc.js create mode 100644 packages/eslint-config-bases/README.md rename {tools => packages}/eslint-config-bases/lint-staged.config.js (100%) rename {tools => packages}/eslint-config-bases/package.json (87%) create mode 100644 packages/eslint-config-bases/src/bases/graphql-schema.js create mode 100644 packages/eslint-config-bases/src/bases/index.js rename {tools => packages}/eslint-config-bases/src/bases/jest.js (70%) create mode 100644 packages/eslint-config-bases/src/bases/playwright.js create mode 100644 packages/eslint-config-bases/src/bases/prettier.js rename {tools => packages}/eslint-config-bases/src/bases/react.js (89%) create mode 100644 packages/eslint-config-bases/src/bases/rtl.js create mode 100644 packages/eslint-config-bases/src/bases/sonar.js create mode 100644 packages/eslint-config-bases/src/bases/storybook.js rename {tools => packages}/eslint-config-bases/src/bases/typescript.js (96%) create mode 100644 packages/eslint-config-bases/src/helpers/getDefaultIgnorePatterns.js create mode 100644 packages/eslint-config-bases/src/helpers/getPrettierConfig.js create mode 100644 packages/eslint-config-bases/src/helpers/index.js create mode 100644 packages/eslint-config-bases/src/index.js rename {tools => packages}/eslint-config-bases/tsconfig.json (100%) delete mode 100644 tools/eslint-config-bases/.eslintrc.js delete mode 100644 tools/eslint-config-bases/README.md delete mode 100644 tools/eslint-config-bases/src/bases/graphql-schema.js delete mode 100644 tools/eslint-config-bases/src/bases/playwright.js delete mode 100644 tools/eslint-config-bases/src/bases/react-testing-library.js delete mode 100644 tools/eslint-config-bases/src/bases/sonar.js delete mode 100644 tools/eslint-config-bases/src/bases/storybook.js delete mode 100644 tools/eslint-config-bases/src/index.js diff --git a/.prettierignore b/.prettierignore index c0f4e74573c..971b94f136b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,4 +1,5 @@ .yarn **/.next/** **/dist/** +**/build/** **/tmp/** diff --git a/.prettierrc.js b/.prettierrc.js index b0a497a03d0..3822384527a 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -3,22 +3,23 @@ /** * @type {import('prettier').Config} */ + +const { getPrettierConfig } = require('@your-org/eslint-config-bases/helpers'); + +const { overrides = [], ...prettierConfig } = getPrettierConfig(); + module.exports = { - singleQuote: true, - semi: true, - tabWidth: 2, - bracketSpacing: true, - trailingComma: 'es5', - bracketSameLine: false, - useTabs: false, - endOfLine: 'lf', + ...prettierConfig, overrides: [ - { - files: '*.md', - options: { - singleQuote: false, - quoteProps: 'preserve', + ...overrides, + ...[ + { + files: '*.md', + options: { + singleQuote: false, + quoteProps: 'preserve', + }, }, - }, + ], ], }; diff --git a/apps/nextjs-app/.eslintrc.js b/apps/nextjs-app/.eslintrc.js index f183e3749fb..c5e8d878d65 100644 --- a/apps/nextjs-app/.eslintrc.js +++ b/apps/nextjs-app/.eslintrc.js @@ -3,19 +3,24 @@ * @see https://github.com/belgattitude/nextjs-monorepo-example/blob/main/docs/about-linters.md */ +const { + getDefaultIgnorePatterns, +} = require('@your-org/eslint-config-bases/helpers'); + module.exports = { root: true, - ignorePatterns: ['.next', '**/.out'], + ignorePatterns: [...getDefaultIgnorePatterns(), '.next', '.out'], extends: [ '@your-org/eslint-config-bases/typescript', '@your-org/eslint-config-bases/sonar', '@your-org/eslint-config-bases/jest', - '@your-org/eslint-config-bases/storybook', '@your-org/eslint-config-bases/react', - '@your-org/eslint-config-bases/react-testing-library', + '@your-org/eslint-config-bases/rtl', '@your-org/eslint-config-bases/graphql-schema', // Add specific rules for nextjs 'plugin:@next/next/core-web-vitals', + // Apply prettier and disable incompatible rules + '@your-org/eslint-config-bases/prettier', ], rules: { // https://github.com/vercel/next.js/discussions/16832 diff --git a/apps/remix-app/.eslintrc.js b/apps/remix-app/.eslintrc.js index 9ac720f6421..bdf5276deef 100644 --- a/apps/remix-app/.eslintrc.js +++ b/apps/remix-app/.eslintrc.js @@ -3,18 +3,29 @@ * @see https://github.com/belgattitude/nextjs-monorepo-example/blob/main/docs/about-linters.md */ +const { + getDefaultIgnorePatterns, +} = require('@your-org/eslint-config-bases/helpers'); + module.exports = { root: true, - ignorePatterns: ['public/build', 'api/build', '.cache'], + ignorePatterns: [ + ...getDefaultIgnorePatterns(), + 'public/build', + 'api/build', + '.cache', + ], extends: [ '@your-org/eslint-config-bases/typescript', '@your-org/eslint-config-bases/sonar', '@your-org/eslint-config-bases/jest', '@your-org/eslint-config-bases/react', - '@your-org/eslint-config-bases/react-testing-library', + '@your-org/eslint-config-bases/rtl', '@your-org/eslint-config-bases/graphql-schema', // Specific rules for remix '@remix-run/eslint-config', + // Apply prettier and disable incompatible rules + '@your-org/eslint-config-bases/prettier', ], env: { browser: true, diff --git a/apps/vite-app/.eslintrc.js b/apps/vite-app/.eslintrc.js index a35af06ea42..5ec64b9708c 100644 --- a/apps/vite-app/.eslintrc.js +++ b/apps/vite-app/.eslintrc.js @@ -3,15 +3,21 @@ * @see https://github.com/belgattitude/nextjs-monorepo-example/blob/main/docs/about-linters.md */ +const { + getDefaultIgnorePatterns, +} = require('@your-org/eslint-config-bases/helpers'); + module.exports = { root: true, - ignorePatterns: ['dist'], + ignorePatterns: [...getDefaultIgnorePatterns()], extends: [ '@your-org/eslint-config-bases/typescript', '@your-org/eslint-config-bases/sonar', '@your-org/eslint-config-bases/jest', '@your-org/eslint-config-bases/react', - '@your-org/eslint-config-bases/react-testing-library', + '@your-org/eslint-config-bases/rtl', + // Apply prettier and disable incompatible rules + '@your-org/eslint-config-bases/prettier', ], rules: { 'jsx-a11y/anchor-is-valid': 'off', diff --git a/package.json b/package.json index 3044d756508..4332045e0aa 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,7 @@ ], "workspaces": [ "apps/*", - "packages/*", - "tools/*" + "packages/*" ], "scripts": { "g:clean": "rimraf '.cache/*' && yarn workspaces foreach -ptv run clean", @@ -83,6 +82,7 @@ "@commitlint/config-conventional": "16.2.1", "@types/prettier": "2.4.4", "@types/shell-quote": "1.7.1", + "@your-org/eslint-config-bases": "workspace:^", "husky": "7.0.4", "is-ci": "3.0.1", "lint-staged": "12.3.7", diff --git a/packages/core-lib/.eslintrc.js b/packages/core-lib/.eslintrc.js index 9b26b204be0..b0910f9e00f 100644 --- a/packages/core-lib/.eslintrc.js +++ b/packages/core-lib/.eslintrc.js @@ -3,15 +3,21 @@ * @see https://github.com/belgattitude/nextjs-monorepo-example/blob/main/docs/about-linters.md */ +const { + getDefaultIgnorePatterns, +} = require('@your-org/eslint-config-bases/helpers'); + module.exports = { root: true, - ignorePatterns: ['node_modules/**', 'dist', 'build'], + ignorePatterns: [...getDefaultIgnorePatterns()], extends: [ '@your-org/eslint-config-bases/typescript', '@your-org/eslint-config-bases/sonar', '@your-org/eslint-config-bases/jest', - '@your-org/eslint-config-bases/react-testing-library', + '@your-org/eslint-config-bases/rtl', '@your-org/eslint-config-bases/react', + // Apply prettier and disable incompatible rules + '@your-org/eslint-config-bases/prettier', ], rules: { // optional overrides per project diff --git a/packages/db-main-prisma/.eslintrc.js b/packages/db-main-prisma/.eslintrc.js index e299124a5d1..e8ee895d817 100644 --- a/packages/db-main-prisma/.eslintrc.js +++ b/packages/db-main-prisma/.eslintrc.js @@ -3,12 +3,18 @@ * @see https://github.com/belgattitude/nextjs-monorepo-example/blob/main/docs/about-linters.md */ +const { + getDefaultIgnorePatterns, +} = require('@your-org/eslint-config-bases/helpers'); + module.exports = { root: true, - ignorePatterns: ['dist', 'build', 'src/generated'], + ignorePatterns: [...getDefaultIgnorePatterns(), 'src/generated'], extends: [ '@your-org/eslint-config-bases/typescript', '@your-org/eslint-config-bases/sonar', + // Apply prettier and disable incompatible rules + '@your-org/eslint-config-bases/prettier', ], rules: { // optional overrides per project diff --git a/packages/eslint-config-bases/.eslintrc.js b/packages/eslint-config-bases/.eslintrc.js new file mode 100644 index 00000000000..c490dc3e2e7 --- /dev/null +++ b/packages/eslint-config-bases/.eslintrc.js @@ -0,0 +1,7 @@ +const { getDefaultIgnorePatterns } = require('./src/helpers'); + +module.exports = { + root: true, + ignorePatterns: [...getDefaultIgnorePatterns()], + extends: ['./src/bases/typescript', './src/bases/prettier'], +}; diff --git a/packages/eslint-config-bases/README.md b/packages/eslint-config-bases/README.md new file mode 100644 index 00000000000..efd28d777d9 --- /dev/null +++ b/packages/eslint-config-bases/README.md @@ -0,0 +1,147 @@ +# @your-org/eslint-config-bases + +

+ + build + +

+ +# About linters + +This doc provides tips and tricks based on [eslint](https://eslint.org) and [prettier](https://prettier.org) in the +context of the [nextjs-monorepo-example](https://github.com/belgattitude/nextjs-monorepo-example). +It covers few popular plugins, their configurations, how to run them efficiently +on CI and how they can be customized per apps or packages. + +## Plugins + +Depending on the nature of the project (plain typescript, react, nextjs...), the following plugins are enabled: + +| Type/Plugin | Scope | Comment | +| :---------------------------------------------------------------------------------------------------------------------- | :----- | :--------------------------------------------------------------------------- | +| [eslint:recommended](https://eslint.org/docs/rules/) | base | The basics for code linting. | +| [@typescript-eslint/recommended](https://typescript-eslint.io/rules/) | base | The basics for typescript. | +| [@typescript-eslint/consistent-type](https://typescript-eslint.io/rules/consistent-type-imports) | base | Use TS 3.8+ imports/exports, helps with [esbuild](https://esbuild.github.io) | +| [@typescript-eslint/naming-convention](https://typescript-eslint.io/rules/naming-convention) | base | | +| [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import) | base | Order imports | +| [eslint-plugin-sonarjs/recommended](https://github.com/SonarSource/eslint-plugin-sonarjs) | base | Help to keep complexity sane | +| [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) | base | Run prettier formatting from eslint | +| [eslint-plugin-regexp/recommended](https://github.com/ota-meshi/eslint-plugin-regexp) | base | | +| [eslint-plugin-jest/recommended](https://github.com/jest-community/eslint-plugin-jest) | base | Jest recommended practices. | +| [eslint-plugin-react/recommended](https://github.com/yannickcr/eslint-plugin-react) | react | | +| [eslint-plugin-react-hooks/recommended](https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks) | react | | +| [eslint-plugin-jsx-a11y/recommended](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y) | react | Helps to produce accessibility-ready jsx | +| [eslint-plugin-testing-library/recommended](https://github.com/testing-library/eslint-plugin-testing-library) | react | Ease when using react-testing-library | +| [@next/next/core-web-vitals](https://nextjs.org/docs/basic-features/eslint#eslint-plugin) | nextjs | NextJs specific | +| ... | ... | ... | + +There's many more in the wild. + +## Structure + +Often in monorepo you might want to apply different plugins or config differently for each package. There's many +ways to achieve it. The [nextjs-monorepo-example](https://github.com/belgattitude/nextjs-monorepo-example) uses a +nested approach: + +``` +. +├── apps +│ ├── remix-app +│ │ └── .eslintrc.js (extends eslint.base: adds react, rtl...) +│ └── web-app +│ └── .eslintrc.js (extends eslint.base: adds react, nextjs, rtl...) +├── packages +│ ├── db-main-prisma +│ │ └── .eslintrc.js (re-export eslint.base: no changes) +│ └── ui-lib +│ └── .eslintrc.js (extends eslint.base: adds react, rtl, storybook...) +│ +├── .eslint.base.js (base config to extend: just typescript and jest) +├── .prettierignore (prettier ignored files) +└── .prettierrc.js (prettier global configuration) +``` + +Open the files above to know more about configuration. + +## Commands + +If you are in a specific package, you can run the linter from the package directory. + +| Name | Description | +| ----------------- | ---------------------- | +| `yarn lint` | Display linter issues. | +| `yarn lint --fix` | Run automatic fixes. | + +It's possible to run the linter globally from any folder of the monorepo. + +| Name | Description | +| ------------------- | ---------------------------------------------- | +| `yarn g:lint` | Display linter issues in all apps and packages | +| `yarn g:lint --fix` | Run automatic fixes | + +## Lint-staged + +See the [specific doc](./about-lint-staged.md). + +## Performance + +By default, all lint command will automatically enable cache. + +On Github CI, the cache will be persisted thx to `action/cache`. + +
+ action/cache example + +```yaml +- name: Restore packages cache + uses: actions/cache@v2 + with: + path: | + ${{ github.workspace }}/.cache + ${{ github.workspace }}/**/tsconfig.tsbuildinfo + ${{ github.workspace }}/**/.eslintcache + + key: ${{ runner.os }}-packages-cache-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('packages/**.[jt]sx?', 'packages/**.json') }} + restore-keys: | + ${{ runner.os }}-packages-cache-${{ hashFiles('**/yarn.lock') }}- +``` + +
+ +## Installation + +In monorepos, rathers than installing linters at the root level, a safer approach is to specify them +per apps/packages. If you're creating a new package, here's the typical dev-dependencies to add: + +### Base + +Generic typescript project with jest + +```bash +yarn add --dev prettier eslint \ + eslint-import-resolver-typescript eslint-plugin-import eslint-plugin-jest \ + eslint-plugin-jest-formatting eslint-plugin-prettier eslint-plugin-regexp \ + eslint-plugin-sonarjs @typescript-eslint/eslint-plugin @typescript-eslint/parser +``` + +### React + +Generic react + +```bash +yarn add --dev eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks \ + eslint-plugin-testing-library +``` + +### Nextjs + +Specific to nextjs. + +```bash +yarn add --dev eslint-config-next +``` + +## Future + +Note that when times come a good move is to create a ./packages/my-eslint-plugin. That +eases the installation and the configuration. diff --git a/tools/eslint-config-bases/lint-staged.config.js b/packages/eslint-config-bases/lint-staged.config.js similarity index 100% rename from tools/eslint-config-bases/lint-staged.config.js rename to packages/eslint-config-bases/lint-staged.config.js diff --git a/tools/eslint-config-bases/package.json b/packages/eslint-config-bases/package.json similarity index 87% rename from tools/eslint-config-bases/package.json rename to packages/eslint-config-bases/package.json index a72f59d1e21..a70b2f70059 100644 --- a/tools/eslint-config-bases/package.json +++ b/packages/eslint-config-bases/package.json @@ -13,11 +13,15 @@ "name": "Vanvelthem Sébastien", "url": "https://github.com/belgattitude" }, + "type": "commonjs", "main": "./index.js", "exports": { ".": { "require": "./src/index.js" }, + "./helpers": { + "require": "./src/helpers/index.js" + }, "./graphql-schema": { "require": "./src/bases/graphql-schema.js" }, @@ -30,8 +34,11 @@ "./react": { "require": "./src/bases/react.js" }, - "./react-testing-library": { - "require": "./src/bases/react-testing-library.js" + "./prettier": { + "require": "./src/bases/prettier.js" + }, + "./rtl": { + "require": "./src/bases/rtl.js" }, "./sonar": { "require": "./src/bases/sonar.js" @@ -45,9 +52,9 @@ }, "scripts": { "clean": "rimraf --no-glob ./dist ./coverage ./tsconfig.tsbuildinfo ./.eslintcache && jest --clear-cache", - "lint": "eslint . --ext .ts,.js", - "typecheck": "tsc --project ./tsconfig.json --noEmit", - "fix-all-files": "eslint . --ext .ts,.tsx,.js,.jsx --fix" + "lint": "eslint --ext .ts,.js", + "typecheck": "tsc --project tsconfig.json --noEmit", + "fix-all-files": "eslint --ext .ts,.tsx,.js,.jsx --fix" }, "dependencies": { "@graphql-eslint/eslint-plugin": "3.10.2", diff --git a/packages/eslint-config-bases/src/bases/graphql-schema.js b/packages/eslint-config-bases/src/bases/graphql-schema.js new file mode 100644 index 00000000000..89abd2fbfc6 --- /dev/null +++ b/packages/eslint-config-bases/src/bases/graphql-schema.js @@ -0,0 +1,19 @@ +/** + * Opinionated config base for projects using graphql schemas (*.graphql) + */ +const graphqlSchemaPatterns = { + files: ['*.graphql'], +}; + +module.exports = { + overrides: [ + { + files: graphqlSchemaPatterns.files, + // @see https://github.com/B2o5T/graphql-eslint + extends: 'plugin:@graphql-eslint/schema-recommended', + rules: { + '@graphql-eslint/known-type-names': 'error', + }, + }, + ], +}; diff --git a/packages/eslint-config-bases/src/bases/index.js b/packages/eslint-config-bases/src/bases/index.js new file mode 100644 index 00000000000..57fe309e8c0 --- /dev/null +++ b/packages/eslint-config-bases/src/bases/index.js @@ -0,0 +1,10 @@ +module.exports = { + graphqlSchema: require('./graphql-schema'), + jest: require('./jest'), + playwright: require('./playwright'), + react: require('./react'), + reactTestingLibrary: require('./rtl'), + storybook: require('./storybook'), + typescript: require('./typescript'), + sonar: require('./sonar'), +}; diff --git a/tools/eslint-config-bases/src/bases/jest.js b/packages/eslint-config-bases/src/bases/jest.js similarity index 70% rename from tools/eslint-config-bases/src/bases/jest.js rename to packages/eslint-config-bases/src/bases/jest.js index e8c2b75c534..711d5671389 100644 --- a/tools/eslint-config-bases/src/bases/jest.js +++ b/packages/eslint-config-bases/src/bases/jest.js @@ -2,11 +2,21 @@ * Custom config base for projects using jest. * @see https://github.com/jest-community/eslint-plugin-jest */ + +const jestPatterns = { + files: ['**/*.test.{js,jsx,ts,tsx}'], +}; + module.exports = { + env: { + es6: true, + node: true, + }, overrides: [ { // Perf: To ensure best performance enable eslint-plugin-jest for test files only. - files: ['**/?(*.)+(test).{js,jsx,ts,tsx}'], + files: jestPatterns.files, + // @see https://github.com/jest-community/eslint-plugin-jest extends: ['plugin:jest/recommended'], rules: { '@typescript-eslint/no-non-null-assertion': 'off', diff --git a/packages/eslint-config-bases/src/bases/playwright.js b/packages/eslint-config-bases/src/bases/playwright.js new file mode 100644 index 00000000000..498f1e943ba --- /dev/null +++ b/packages/eslint-config-bases/src/bases/playwright.js @@ -0,0 +1,27 @@ +/** + * Opinionated config base for projects using playwright. + */ + +const playwrightPatterns = { + files: ['**/e2e/**/*.test.{js,ts}'], +}; + +module.exports = { + env: { + es6: true, + node: true, + }, + overrides: [ + { + // To ensure best performance enable only on e2e test files + files: playwrightPatterns.files, + // @see https://github.com/playwright-community/eslint-plugin-playwright + extends: ['plugin:playwright/recommended'], + rules: { + '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/no-object-literal-type-assertion': 'off', + '@typescript-eslint/no-empty-function': 'off', + }, + }, + ], +}; diff --git a/packages/eslint-config-bases/src/bases/prettier.js b/packages/eslint-config-bases/src/bases/prettier.js new file mode 100644 index 00000000000..0a6ca366ad1 --- /dev/null +++ b/packages/eslint-config-bases/src/bases/prettier.js @@ -0,0 +1,16 @@ +/** + * Custom config base for projects using prettier. + */ + +const { getPrettierConfig } = require('../helpers'); +const { ...prettierConfig } = getPrettierConfig(); + +module.exports = { + extends: ['prettier'], + plugins: ['prettier'], + rules: { + 'prettier/prettier': ['error', prettierConfig], + 'arrow-body-style': 'off', + 'prefer-arrow-callback': 'off', + }, +}; diff --git a/tools/eslint-config-bases/src/bases/react.js b/packages/eslint-config-bases/src/bases/react.js similarity index 89% rename from tools/eslint-config-bases/src/bases/react.js rename to packages/eslint-config-bases/src/bases/react.js index e9e2a4fe1de..e9603cc3162 100644 --- a/tools/eslint-config-bases/src/bases/react.js +++ b/packages/eslint-config-bases/src/bases/react.js @@ -1,7 +1,16 @@ +/** + * Opinionated config base for projects using react. + */ + +const reactPatterns = { + files: ['*.tsx', '*.jsx'], +}; + module.exports = { env: { browser: true, es6: true, + node: true, }, settings: { react: { @@ -10,7 +19,7 @@ module.exports = { }, overrides: [ { - files: ['*.tsx', '*.jsx'], + files: reactPatterns.files, extends: [ // @see https://github.com/yannickcr/eslint-plugin-react 'plugin:react/recommended', diff --git a/packages/eslint-config-bases/src/bases/rtl.js b/packages/eslint-config-bases/src/bases/rtl.js new file mode 100644 index 00000000000..106f2d2c6ac --- /dev/null +++ b/packages/eslint-config-bases/src/bases/rtl.js @@ -0,0 +1,29 @@ +/** + * Opinionated config base for projects using react-testing-library + */ + +const rtlPatterns = { + files: ['**/*.test.{jsx,tsx}'], +}; + +module.exports = { + env: { + browser: true, + es6: true, + node: true, + }, + overrides: [ + { + // For performance enable react-testing-library only on test files + files: rtlPatterns.files, + extends: ['plugin:testing-library/react'], + }, + { + files: ['**/test-utils.tsx'], + rules: { + '@typescript-eslint/explicit-module-boundary-types': 'off', + 'import/export': 'off', + }, + }, + ], +}; diff --git a/packages/eslint-config-bases/src/bases/sonar.js b/packages/eslint-config-bases/src/bases/sonar.js new file mode 100644 index 00000000000..099f13b0d9b --- /dev/null +++ b/packages/eslint-config-bases/src/bases/sonar.js @@ -0,0 +1,47 @@ +/** + * Opinionated config base for projects that enable sonarjs + */ + +const sonarPatterns = { + files: ['**/*.{js,jsx,ts,tsx}'], + excludedFiles: ['*.test.{js,ts,jsx,tsx}', '*.stories.{js,ts,jsx,tsx}'], +}; + +module.exports = { + env: { + browser: true, + es6: true, + node: true, + }, + overrides: [ + { + files: sonarPatterns.files, + excludedFiles: sonarPatterns.excludedFiles, + extends: ['plugin:sonarjs/recommended'], + rules: { + 'sonarjs/no-nested-template-literals': 'off', + }, + }, + { + files: ['*.{jsx,tsx}'], + rules: { + // relax complexity for react code + 'sonarjs/cognitive-complexity': ['error', 15], + // relax duplicate strings + 'sonarjs/no-duplicate-string': 'off', + }, + }, + { + // relax javascript code as it often contains obscure configs + files: ['*.js', '*.cjs', '*.mjs'], + parser: 'espree', + parserOptions: { + ecmaVersion: 2020, + }, + rules: { + 'sonarjs/no-duplicate-string': 'off', + 'sonarjs/no-all-duplicated-branches': 'off', + }, + }, + ], +}; diff --git a/packages/eslint-config-bases/src/bases/storybook.js b/packages/eslint-config-bases/src/bases/storybook.js new file mode 100644 index 00000000000..1211fa9d026 --- /dev/null +++ b/packages/eslint-config-bases/src/bases/storybook.js @@ -0,0 +1,22 @@ +/** + * Opinionated config base for projects using storybook. + */ + +const storybookPatterns = { + files: ['**/*.stories.{ts,tsx,mdx}'], +}; + +module.exports = { + env: { + browser: true, + es6: true, + node: true, + }, + overrides: [ + { + // For performance run storybook/recommended on test files, not regular code + files: storybookPatterns.files, + extends: ['plugin:storybook/recommended'], + }, + ], +}; diff --git a/tools/eslint-config-bases/src/bases/typescript.js b/packages/eslint-config-bases/src/bases/typescript.js similarity index 96% rename from tools/eslint-config-bases/src/bases/typescript.js rename to packages/eslint-config-bases/src/bases/typescript.js index ab2f2001dc8..156034a9b3a 100644 --- a/tools/eslint-config-bases/src/bases/typescript.js +++ b/packages/eslint-config-bases/src/bases/typescript.js @@ -1,10 +1,11 @@ /** * Custom config base for projects using typescript / javascript. */ + module.exports = { env: { - node: true, es6: true, + node: true, }, parser: '@typescript-eslint/parser', parserOptions: { @@ -27,7 +28,6 @@ module.exports = { 'plugin:import/recommended', 'plugin:import/typescript', 'plugin:regexp/recommended', - 'plugin:prettier/recommended', ], rules: { 'spaced-comment': [ @@ -146,6 +146,7 @@ module.exports = { }, overrides: [ { + // commonjs or assumed files: ['*.js', '*.cjs'], parser: 'espree', parserOptions: { @@ -157,8 +158,6 @@ module.exports = { '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-var-requires': 'off', '@typescript-eslint/explicit-module-boundary-types': 'off', - 'sonarjs/no-duplicate-string': 'off', - 'sonarjs/no-all-duplicated-branches': 'off', '@typescript-eslint/consistent-type-exports': 'off', '@typescript-eslint/consistent-type-imports': 'off', 'import/order': 'off', diff --git a/packages/eslint-config-bases/src/helpers/getDefaultIgnorePatterns.js b/packages/eslint-config-bases/src/helpers/getDefaultIgnorePatterns.js new file mode 100644 index 00000000000..94cce662daf --- /dev/null +++ b/packages/eslint-config-bases/src/helpers/getDefaultIgnorePatterns.js @@ -0,0 +1,7 @@ +const getDefaultIgnorePatterns = () => { + return ['**/node_modules', '**/.cache', 'build', 'dist']; +}; + +module.exports = { + getDefaultIgnorePatterns, +}; diff --git a/packages/eslint-config-bases/src/helpers/getPrettierConfig.js b/packages/eslint-config-bases/src/helpers/getPrettierConfig.js new file mode 100644 index 00000000000..0f9e37410da --- /dev/null +++ b/packages/eslint-config-bases/src/helpers/getPrettierConfig.js @@ -0,0 +1,17 @@ +const getPrettierConfig = () => { + return { + singleQuote: true, + semi: true, + tabWidth: 2, + bracketSpacing: true, + trailingComma: 'es5', + bracketSameLine: false, + useTabs: false, + endOfLine: 'lf', + overrides: [], + }; +}; + +module.exports = { + getPrettierConfig, +}; diff --git a/packages/eslint-config-bases/src/helpers/index.js b/packages/eslint-config-bases/src/helpers/index.js new file mode 100644 index 00000000000..8820b681c85 --- /dev/null +++ b/packages/eslint-config-bases/src/helpers/index.js @@ -0,0 +1,7 @@ +const { getDefaultIgnorePatterns } = require('./getDefaultIgnorePatterns'); +const { getPrettierConfig } = require('./getPrettierConfig'); + +module.exports = { + getDefaultIgnorePatterns, + getPrettierConfig, +}; diff --git a/packages/eslint-config-bases/src/index.js b/packages/eslint-config-bases/src/index.js new file mode 100644 index 00000000000..84997bc2694 --- /dev/null +++ b/packages/eslint-config-bases/src/index.js @@ -0,0 +1,3 @@ +const { typescript } = require('./bases'); + +module.exports = typescript; diff --git a/tools/eslint-config-bases/tsconfig.json b/packages/eslint-config-bases/tsconfig.json similarity index 100% rename from tools/eslint-config-bases/tsconfig.json rename to packages/eslint-config-bases/tsconfig.json diff --git a/packages/ui-lib/.eslintrc.js b/packages/ui-lib/.eslintrc.js index 397d66c75be..35252a834bc 100644 --- a/packages/ui-lib/.eslintrc.js +++ b/packages/ui-lib/.eslintrc.js @@ -3,15 +3,22 @@ * @see https://github.com/belgattitude/nextjs-monorepo-example/blob/main/docs/about-linters.md */ +const { + getDefaultIgnorePatterns, +} = require('@your-org/eslint-config-bases/helpers'); + module.exports = { root: true, + ignorePatterns: [...getDefaultIgnorePatterns(), '/storybook-static'], extends: [ '@your-org/eslint-config-bases/typescript', '@your-org/eslint-config-bases/sonar', '@your-org/eslint-config-bases/jest', - '@your-org/eslint-config-bases/react-testing-library', + '@your-org/eslint-config-bases/rtl', '@your-org/eslint-config-bases/storybook', '@your-org/eslint-config-bases/react', + // Apply prettier and disable incompatible rules + '@your-org/eslint-config-bases/prettier', ], rules: { // optional overrides per project diff --git a/packages/ui-lib/.gitignore b/packages/ui-lib/.gitignore index 2c61bc4e14a..c9cd4da2417 100644 --- a/packages/ui-lib/.gitignore +++ b/packages/ui-lib/.gitignore @@ -2,6 +2,7 @@ # build /dist +/build /storybook-static # dependencies diff --git a/tools/eslint-config-bases/.eslintrc.js b/tools/eslint-config-bases/.eslintrc.js deleted file mode 100644 index aa11bbf6fcc..00000000000 --- a/tools/eslint-config-bases/.eslintrc.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - root: true, - ignorePatterns: ['**/node_modules/**', '**/dist/**'], - extends: ['./src/bases/typescript'], -}; diff --git a/tools/eslint-config-bases/README.md b/tools/eslint-config-bases/README.md deleted file mode 100644 index c5c3672b4d9..00000000000 --- a/tools/eslint-config-bases/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# @your-org/eslint-config - -

- - build - -

- -## Intro - -WIP diff --git a/tools/eslint-config-bases/src/bases/graphql-schema.js b/tools/eslint-config-bases/src/bases/graphql-schema.js deleted file mode 100644 index 640b369dbe2..00000000000 --- a/tools/eslint-config-bases/src/bases/graphql-schema.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Custom config base for projects using graphql schemas (*.graphql) - * @see https://github.com/B2o5T/graphql-eslint - */ -module.exports = { - overrides: [ - { - files: ['*.graphql'], - extends: 'plugin:@graphql-eslint/schema-recommended', - rules: { - '@graphql-eslint/known-type-names': 'error', - }, - }, - ], -}; diff --git a/tools/eslint-config-bases/src/bases/playwright.js b/tools/eslint-config-bases/src/bases/playwright.js deleted file mode 100644 index 93452ec3de0..00000000000 --- a/tools/eslint-config-bases/src/bases/playwright.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Custom config base for projects using playwright. - * @see https://github.com/playwright-community/eslint-plugin-playwright - */ -module.exports = { - overrides: [ - { - // To ensure best performance enable jest/recommended only on test files - // PS: *.e2e.ts convention is used to disambiguate from regular *.test.[jt]sx? files - files: ['*.e2e.ts'], - extends: ['plugin:playwright/recommended'], - rules: { - '@typescript-eslint/no-non-null-assertion': 'off', - '@typescript-eslint/no-object-literal-type-assertion': 'off', - '@typescript-eslint/no-empty-function': 'off', - }, - }, - ], -}; diff --git a/tools/eslint-config-bases/src/bases/react-testing-library.js b/tools/eslint-config-bases/src/bases/react-testing-library.js deleted file mode 100644 index d9935af149b..00000000000 --- a/tools/eslint-config-bases/src/bases/react-testing-library.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Custom config base for projects using react-testing-library - */ -module.exports = { - overrides: [ - { - // For performance enable jest/recommended only on test files - files: ['**/__tests__/**/*.{ts,tsx}'], - extends: ['plugin:testing-library/react'], - }, - { - files: ['**/test-utils.tsx'], - rules: { - '@typescript-eslint/explicit-module-boundary-types': 'off', - 'import/export': 'off', - }, - }, - { - files: ['**/test-utils.tsx'], - rules: { - '@typescript-eslint/explicit-module-boundary-types': 'off', - 'import/export': 'off', - }, - }, - ], -}; diff --git a/tools/eslint-config-bases/src/bases/sonar.js b/tools/eslint-config-bases/src/bases/sonar.js deleted file mode 100644 index c91f0a177e0..00000000000 --- a/tools/eslint-config-bases/src/bases/sonar.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Custom config base for projects that want to enable sonar-js - */ -module.exports = { - overrides: [ - { - files: ['**/*.{js,jsx,ts,tsx}'], - excludedFiles: ['**/__tests__/**/*.{js,jsx,ts,tsx}'], - extends: ['plugin:sonarjs/recommended'], - rules: { - 'sonarjs/no-nested-template-literals': 'off', - }, - }, - { - files: ['*.js', '*.cjs'], - parser: 'espree', - parserOptions: { - ecmaVersion: 2020, - }, - rules: { - 'sonarjs/no-duplicate-string': 'off', - 'sonarjs/no-all-duplicated-branches': 'off', - }, - }, - ], -}; diff --git a/tools/eslint-config-bases/src/bases/storybook.js b/tools/eslint-config-bases/src/bases/storybook.js deleted file mode 100644 index f299f6b6cdc..00000000000 --- a/tools/eslint-config-bases/src/bases/storybook.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Custom config base for projects using storybook. - */ -module.exports = { - overrides: [ - { - // For performance run storybook/recommended on test files, not regular code - files: ['**/*.stories.{ts,tsx,mdx}'], - extends: ['plugin:storybook/recommended'], - }, - ], -}; diff --git a/tools/eslint-config-bases/src/index.js b/tools/eslint-config-bases/src/index.js deleted file mode 100644 index e01aa3226b5..00000000000 --- a/tools/eslint-config-bases/src/index.js +++ /dev/null @@ -1,14 +0,0 @@ -const bases = { - graphqlSchema: require('./bases/graphql-schema'), - jest: require('./bases/jest'), - playwright: require('./bases/playwright'), - react: require('./bases/react'), - reactTestingLibrary: require('./bases/react-testing-library'), - storybook: require('./bases/storybook'), - typescript: require('./bases/typescript'), - sonar: require('./bases/sonar'), -}; - -module.exports = { - bases, -}; diff --git a/yarn.lock b/yarn.lock index 064faffffca..9473f2ff3bf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7354,9 +7354,9 @@ __metadata: languageName: unknown linkType: soft -"@your-org/eslint-config-bases@workspace:^, @your-org/eslint-config-bases@workspace:tools/eslint-config-bases": +"@your-org/eslint-config-bases@workspace:^, @your-org/eslint-config-bases@workspace:packages/eslint-config-bases": version: 0.0.0-use.local - resolution: "@your-org/eslint-config-bases@workspace:tools/eslint-config-bases" + resolution: "@your-org/eslint-config-bases@workspace:packages/eslint-config-bases" dependencies: "@graphql-eslint/eslint-plugin": 3.10.2 "@testing-library/jest-dom": 5.16.4 @@ -19563,6 +19563,7 @@ __metadata: "@commitlint/config-conventional": 16.2.1 "@types/prettier": 2.4.4 "@types/shell-quote": 1.7.1 + "@your-org/eslint-config-bases": "workspace:^" cross-env: 7.0.3 husky: 7.0.4 is-ci: 3.0.1 From 047cbfa597a4a0a3ed40c46d7e36ff8f71b9ceb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Vanvelthem?= Date: Sun, 10 Apr 2022 23:55:30 +0200 Subject: [PATCH 12/22] refactor(eslint): new bases and prettier support --- .eslintrc.base.js | 233 ------------------ apps/nextjs-app/.eslintrc.js | 9 +- apps/remix-app/.eslintrc.js | 4 +- package.json | 1 + packages/eslint-config-bases/package.json | 3 + .../src/helpers/getDefaultIgnorePatterns.js | 3 +- 6 files changed, 8 insertions(+), 245 deletions(-) delete mode 100644 .eslintrc.base.js diff --git a/.eslintrc.base.js b/.eslintrc.base.js deleted file mode 100644 index 970a03730e8..00000000000 --- a/.eslintrc.base.js +++ /dev/null @@ -1,233 +0,0 @@ -/** - * Default eslint base configuration that can be extended by apps/packages - * in the monorepo - * @see https://github.com/belgattitude/nextjs-monorepo-example/blob/main/docs/about-linters.md - */ - -module.exports = { - root: true, - env: { - node: true, - es6: true, - }, - ignorePatterns: ['**/node_modules', '**/dist', '**/build'], - parser: '@typescript-eslint/parser', - parserOptions: { - ecmaFeatures: { - jsx: true, - globalReturn: false, - }, - ecmaVersion: 2020, - project: ['tsconfig.json'], - sourceType: 'module', - }, - settings: { - react: { - version: 'detect', - }, - 'import/resolver': { - typescript: {}, - }, - }, - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:import/recommended', - 'plugin:import/typescript', - 'plugin:regexp/recommended', - 'plugin:prettier/recommended', - ], - globals: { - context: 'readonly', - cy: 'readonly', - assert: 'readonly', - Cypress: 'readonly', - }, - rules: { - 'spaced-comment': [ - 'error', - 'always', - { - line: { - markers: ['/'], - exceptions: ['-', '+'], - }, - block: { - markers: ['!'], - exceptions: ['*'], - balanced: true, - }, - }, - ], - 'linebreak-style': ['error', 'unix'], - 'no-empty-function': 'off', - 'import/default': 'off', - 'import/no-named-as-default-member': 'off', - 'import/no-named-as-default': 'off', - 'import/order': [ - 'error', - { - groups: [ - 'builtin', - 'external', - 'internal', - 'parent', - 'sibling', - 'index', - 'object', - ], - alphabetize: { order: 'asc', caseInsensitive: true }, - }, - ], - '@typescript-eslint/ban-tslint-comment': ['error'], - '@typescript-eslint/ban-ts-comment': [ - 'error', - { - 'ts-expect-error': 'allow-with-description', - minimumDescriptionLength: 10, - 'ts-ignore': true, - 'ts-nocheck': true, - 'ts-check': false, - }, - ], - '@typescript-eslint/no-explicit-any': ['error', { ignoreRestArgs: false }], - '@typescript-eslint/no-empty-function': [ - 'error', - { allow: ['private-constructors'] }, - ], - '@typescript-eslint/no-unused-vars': [ - 'warn', - { argsIgnorePattern: '^_', ignoreRestSiblings: true }, - ], - '@typescript-eslint/consistent-type-exports': 'error', - '@typescript-eslint/consistent-type-imports': [ - 'error', - { prefer: 'type-imports' }, - ], - '@typescript-eslint/naming-convention': [ - 'error', - { - selector: 'default', - format: ['camelCase'], - leadingUnderscore: 'forbid', - trailingUnderscore: 'forbid', - }, - { - selector: 'variable', - format: ['camelCase'], - leadingUnderscore: 'allow', - }, - { - selector: ['function'], - format: ['camelCase'], - }, - { - selector: 'parameter', - format: ['camelCase'], - leadingUnderscore: 'allow', - }, - { - selector: 'class', - format: ['PascalCase'], - }, - { - selector: 'classProperty', - format: ['camelCase'], - }, - { - selector: 'objectLiteralProperty', - format: [ - 'camelCase', - // Some external libraries use snake_case for params - 'snake_case', - // Env variables are generally uppercase - 'UPPER_CASE', - ], - }, - { - selector: ['typeAlias', 'interface'], - format: ['PascalCase'], - }, - { - selector: ['typeProperty'], - format: ['camelCase'], - }, - { - selector: ['typeParameter'], - format: ['PascalCase'], - }, - ], - }, - overrides: [ - { - // For performance run sonarjs/recommended on regular code, not test files. - files: ['**/*.{js,jsx,ts,tsx}'], - excludedFiles: ['**/__tests__/**/*.{js,jsx,ts,tsx}'], - extends: ['plugin:sonarjs/recommended'], - rules: { - 'sonarjs/no-nested-template-literals': 'off', - }, - }, - { - // For performance run jest/recommended on test files, not regular code - files: ['**/?(*.)+(test).{js,jsx,ts,tsx}'], - extends: ['plugin:jest/recommended'], - rules: { - '@typescript-eslint/no-non-null-assertion': 'off', - '@typescript-eslint/no-object-literal-type-assertion': 'off', - '@typescript-eslint/no-empty-function': 'off', - }, - }, - { - // To disambiguate unit from e2e (playwright) test files, the *.spec.ts - // is used across this repo, so we can apply a different ruleset. - files: ['*.spec.ts'], - rules: { - '@typescript-eslint/no-non-null-assertion': 'off', - '@typescript-eslint/no-object-literal-type-assertion': 'off', - '@typescript-eslint/no-empty-function': 'off', - }, - }, - // Fine-tune naming convention react typescript jsx (function components) - { - files: ['*.tsx'], - rules: { - '@typescript-eslint/naming-convention': [ - 'warn', - { - selector: 'variable', - format: ['camelCase', 'PascalCase'], - }, - { - selector: ['function'], - format: ['camelCase', 'PascalCase'], - }, - { - selector: 'parameter', - format: ['camelCase', 'PascalCase'], - leadingUnderscore: 'allow', - }, - ], - }, - }, - { - files: ['*.js'], - parser: 'espree', - parserOptions: { - ecmaVersion: 2020, - }, - rules: { - '@typescript-eslint/naming-convention': 'off', - '@typescript-eslint/ban-ts-comment': 'off', - '@typescript-eslint/no-explicit-any': 'off', - '@typescript-eslint/no-var-requires': 'off', - '@typescript-eslint/explicit-module-boundary-types': 'off', - 'sonarjs/no-duplicate-string': 'off', - 'sonarjs/no-all-duplicated-branches': 'off', - '@typescript-eslint/consistent-type-exports': 'off', - '@typescript-eslint/consistent-type-imports': 'off', - 'import/order': 'off', - }, - }, - ], -}; diff --git a/apps/nextjs-app/.eslintrc.js b/apps/nextjs-app/.eslintrc.js index c5e8d878d65..3da14129dbf 100644 --- a/apps/nextjs-app/.eslintrc.js +++ b/apps/nextjs-app/.eslintrc.js @@ -31,9 +31,8 @@ module.exports = { }, overrides: [ { - files: ['src/pages/**/*.{ts,tsx}'], + files: ['src/pages/\\_*.{ts,tsx}'], rules: { - '@typescript-eslint/explicit-module-boundary-types': 'off', 'react/display-name': 'off', }, }, @@ -50,11 +49,5 @@ module.exports = { ], }, }, - { - files: ['src/backend/api/**/*.ts'], - rules: { - '@typescript-eslint/explicit-module-boundary-types': 'off', - }, - }, ], }; diff --git a/apps/remix-app/.eslintrc.js b/apps/remix-app/.eslintrc.js index bdf5276deef..35401a5dbfb 100644 --- a/apps/remix-app/.eslintrc.js +++ b/apps/remix-app/.eslintrc.js @@ -32,8 +32,6 @@ module.exports = { es6: true, node: true, }, - rules: { - 'jsx-a11y/anchor-is-valid': 'off', - }, + rules: {}, overrides: [], }; diff --git a/package.json b/package.json index 4332045e0aa..f0ad89fc4b0 100644 --- a/package.json +++ b/package.json @@ -83,6 +83,7 @@ "@types/prettier": "2.4.4", "@types/shell-quote": "1.7.1", "@your-org/eslint-config-bases": "workspace:^", + "eslint": "8.13.0", "husky": "7.0.4", "is-ci": "3.0.1", "lint-staged": "12.3.7", diff --git a/packages/eslint-config-bases/package.json b/packages/eslint-config-bases/package.json index a70b2f70059..566cc6c02ab 100644 --- a/packages/eslint-config-bases/package.json +++ b/packages/eslint-config-bases/package.json @@ -95,6 +95,9 @@ }, "react-dom": { "optional": true + }, + "typescript": { + "optional": true } }, "devDependencies": { diff --git a/packages/eslint-config-bases/src/helpers/getDefaultIgnorePatterns.js b/packages/eslint-config-bases/src/helpers/getDefaultIgnorePatterns.js index 94cce662daf..9dba493fbf9 100644 --- a/packages/eslint-config-bases/src/helpers/getDefaultIgnorePatterns.js +++ b/packages/eslint-config-bases/src/helpers/getDefaultIgnorePatterns.js @@ -1,5 +1,6 @@ const getDefaultIgnorePatterns = () => { - return ['**/node_modules', '**/.cache', 'build', 'dist']; + // Hacky way to silence @yarnpkg/doctor about node_modules detection + return [`**/${'node'}_modules}`, '**/.cache', 'build', 'dist']; }; module.exports = { From fdc76f6c965864af54418ed4ab7ed80806a94647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Vanvelthem?= Date: Mon, 11 Apr 2022 16:49:12 +0200 Subject: [PATCH 13/22] chore: hack to force resolution of @types/react to 17 --- package.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package.json b/package.json index baeb28df340..c8763c9dab4 100644 --- a/package.json +++ b/package.json @@ -72,6 +72,11 @@ "install:playwright": "npx playwright install", "postinstall": "is-ci || yarn husky install" }, + "?resolutions": "Temporary hacks to lock specific versions of dependencies", + "resolutions": { + "@types/react": "^17.0.44", + "@types/react-dom": "^17.0.15" + }, "dependencies": { "cross-env": "7.0.3" }, From b43ccb8142ca1c3ee574e3f87daa0bbcf2d21928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Vanvelthem?= Date: Mon, 11 Apr 2022 16:49:30 +0200 Subject: [PATCH 14/22] chore: improve exclude directories --- apps/nextjs-app/tsconfig.json | 2 +- packages/core-lib/tsconfig.json | 2 +- packages/db-main-prisma/tsconfig.json | 2 +- packages/eslint-config-bases/tsconfig.json | 2 +- packages/ui-lib/tsconfig.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/nextjs-app/tsconfig.json b/apps/nextjs-app/tsconfig.json index 371c2e65ab9..aaa889887bb 100644 --- a/apps/nextjs-app/tsconfig.json +++ b/apps/nextjs-app/tsconfig.json @@ -25,7 +25,7 @@ "@your-org/db-main-prisma": ["../../../packages/db-main-prisma/src/index"] } }, - "exclude": ["**/node_modules", "**/.*/", ".next"], + "exclude": ["**/node_modules", "**/.*/", ".next", ".out"], "include": [ "next-env.d.ts", "**/*.ts", diff --git a/packages/core-lib/tsconfig.json b/packages/core-lib/tsconfig.json index e87d1402149..00c08151ca5 100644 --- a/packages/core-lib/tsconfig.json +++ b/packages/core-lib/tsconfig.json @@ -11,5 +11,5 @@ "incremental": true, "paths": {} }, - "exclude": ["**/node_modules", "**/.*/", "dist"] + "exclude": ["**/node_modules", "**/.*/", "dist", "build"] } diff --git a/packages/db-main-prisma/tsconfig.json b/packages/db-main-prisma/tsconfig.json index 8d3fb060bf6..0793156568e 100644 --- a/packages/db-main-prisma/tsconfig.json +++ b/packages/db-main-prisma/tsconfig.json @@ -12,5 +12,5 @@ "@your-org/core-lib": ["../../../packages/core-lib/src/index"] } }, - "exclude": ["**/node_modules", "**/.*/"] + "exclude": ["**/node_modules", "**/.*/", "dist", "build"] } diff --git a/packages/eslint-config-bases/tsconfig.json b/packages/eslint-config-bases/tsconfig.json index ba6c34dd31b..fac60290401 100644 --- a/packages/eslint-config-bases/tsconfig.json +++ b/packages/eslint-config-bases/tsconfig.json @@ -7,5 +7,5 @@ "allowJs": true, "checkJs": true }, - "exclude": ["**/node_modules", "**/.*/", "dist"] + "exclude": ["**/node_modules", "**/.*/", "dist", "build"] } diff --git a/packages/ui-lib/tsconfig.json b/packages/ui-lib/tsconfig.json index b301e2a1f6f..71fc95dc64b 100644 --- a/packages/ui-lib/tsconfig.json +++ b/packages/ui-lib/tsconfig.json @@ -15,5 +15,5 @@ "@your-org/core-lib": ["../../../packages/core-lib/src/index"] } }, - "exclude": ["**/node_modules", "**/.*/", "dist"] + "exclude": ["**/node_modules", "**/.*/", "dist", "build"] } From 7d1aae5219d5c13e6a2ffc69dd23856e2d94ea1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Vanvelthem?= Date: Mon, 11 Apr 2022 16:49:48 +0200 Subject: [PATCH 15/22] chore(lock): freshen and dedupe --- yarn.lock | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/yarn.lock b/yarn.lock index 9b9f9372a41..45305f8d100 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6424,16 +6424,7 @@ __metadata: languageName: node linkType: hard -"@types/react-dom@npm:*": - version: 18.0.0 - resolution: "@types/react-dom@npm:18.0.0" - dependencies: - "@types/react": "*" - checksum: 0d8c9cb3e72aefe0dd2b58a49845a200369f01ae92f3f11f642e04efc95dfd1c9380b6592d4273dd6113fb8707947d15b66d56c75c41f39f28bd897f0c08dfa9 - languageName: node - linkType: hard - -"@types/react-dom@npm:17.0.15": +"@types/react-dom@npm:^17.0.15": version: 17.0.15 resolution: "@types/react-dom@npm:17.0.15" dependencies: @@ -6469,18 +6460,7 @@ __metadata: languageName: node linkType: hard -"@types/react@npm:*, @types/react@npm:>=16": - version: 18.0.1 - resolution: "@types/react@npm:18.0.1" - dependencies: - "@types/prop-types": "*" - "@types/scheduler": "*" - csstype: ^3.0.2 - checksum: ede927ed3766fef5fec513fe75e79180bb3c97d21ca7707321e969193c596bc4a531160238546a845e4131df02ec9be7803277a268bc270156362d16b29b4ffb - languageName: node - linkType: hard - -"@types/react@npm:17.0.44, @types/react@npm:^17": +"@types/react@npm:^17.0.44": version: 17.0.44 resolution: "@types/react@npm:17.0.44" dependencies: From 98f282fa35c8bcea10ebfe98b09604b1bb6fee96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Vanvelthem?= Date: Mon, 11 Apr 2022 16:55:20 +0200 Subject: [PATCH 16/22] chore(ncu): don't upgrade @types/react to 18 yet --- .ncurc.yml | 1 + renovate.json5 | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.ncurc.yml b/.ncurc.yml index 4fe7302d4af..e62df385514 100644 --- a/.ncurc.yml +++ b/.ncurc.yml @@ -10,6 +10,7 @@ reject: [ 'is-port-reachable', # Till cache-interop supports it 'ioredis', + # Not ready yet '@types/react', '@types/react-dom', ] diff --git a/renovate.json5 b/renovate.json5 index 03762423a72..66a83333605 100644 --- a/renovate.json5 +++ b/renovate.json5 @@ -18,7 +18,9 @@ "matchPackageNames": [ // see why in .ncurc.yml "is-port-reachable", - "execa" + "execa", + "@types/react", + "@types/react-dom" ], "enabled": false }, From 030d4dd2ce6d5ef2a4d06b375ece9ee24fee50a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Vanvelthem?= Date: Mon, 11 Apr 2022 17:09:29 +0200 Subject: [PATCH 17/22] feat(eslint): add plugin regexp --- apps/nextjs-app/.eslintrc.js | 1 + apps/remix-app/.eslintrc.js | 1 + apps/vite-app/.eslintrc.js | 1 + packages/core-lib/.eslintrc.js | 1 + packages/db-main-prisma/.eslintrc.js | 1 + packages/eslint-config-bases/package.json | 9 ++++++--- packages/eslint-config-bases/src/bases/index.js | 1 + packages/eslint-config-bases/src/bases/regexp.js | 12 ++++++++++++ packages/eslint-config-bases/src/bases/typescript.js | 1 - packages/ui-lib/.eslintrc.js | 1 + 10 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 packages/eslint-config-bases/src/bases/regexp.js diff --git a/apps/nextjs-app/.eslintrc.js b/apps/nextjs-app/.eslintrc.js index 3da14129dbf..87b3df11f58 100644 --- a/apps/nextjs-app/.eslintrc.js +++ b/apps/nextjs-app/.eslintrc.js @@ -13,6 +13,7 @@ module.exports = { extends: [ '@your-org/eslint-config-bases/typescript', '@your-org/eslint-config-bases/sonar', + '@your-org/eslint-config-bases/regexp', '@your-org/eslint-config-bases/jest', '@your-org/eslint-config-bases/react', '@your-org/eslint-config-bases/rtl', diff --git a/apps/remix-app/.eslintrc.js b/apps/remix-app/.eslintrc.js index 35401a5dbfb..cf2cd6892c4 100644 --- a/apps/remix-app/.eslintrc.js +++ b/apps/remix-app/.eslintrc.js @@ -18,6 +18,7 @@ module.exports = { extends: [ '@your-org/eslint-config-bases/typescript', '@your-org/eslint-config-bases/sonar', + '@your-org/eslint-config-bases/regexp', '@your-org/eslint-config-bases/jest', '@your-org/eslint-config-bases/react', '@your-org/eslint-config-bases/rtl', diff --git a/apps/vite-app/.eslintrc.js b/apps/vite-app/.eslintrc.js index 5ec64b9708c..a3695999d17 100644 --- a/apps/vite-app/.eslintrc.js +++ b/apps/vite-app/.eslintrc.js @@ -13,6 +13,7 @@ module.exports = { extends: [ '@your-org/eslint-config-bases/typescript', '@your-org/eslint-config-bases/sonar', + '@your-org/eslint-config-bases/regexp', '@your-org/eslint-config-bases/jest', '@your-org/eslint-config-bases/react', '@your-org/eslint-config-bases/rtl', diff --git a/packages/core-lib/.eslintrc.js b/packages/core-lib/.eslintrc.js index b0910f9e00f..6aa470f02ff 100644 --- a/packages/core-lib/.eslintrc.js +++ b/packages/core-lib/.eslintrc.js @@ -13,6 +13,7 @@ module.exports = { extends: [ '@your-org/eslint-config-bases/typescript', '@your-org/eslint-config-bases/sonar', + '@your-org/eslint-config-bases/regexp', '@your-org/eslint-config-bases/jest', '@your-org/eslint-config-bases/rtl', '@your-org/eslint-config-bases/react', diff --git a/packages/db-main-prisma/.eslintrc.js b/packages/db-main-prisma/.eslintrc.js index e8ee895d817..f071e89046a 100644 --- a/packages/db-main-prisma/.eslintrc.js +++ b/packages/db-main-prisma/.eslintrc.js @@ -13,6 +13,7 @@ module.exports = { extends: [ '@your-org/eslint-config-bases/typescript', '@your-org/eslint-config-bases/sonar', + '@your-org/eslint-config-bases/regexp', // Apply prettier and disable incompatible rules '@your-org/eslint-config-bases/prettier', ], diff --git a/packages/eslint-config-bases/package.json b/packages/eslint-config-bases/package.json index 547eb6fa159..316534da5d2 100644 --- a/packages/eslint-config-bases/package.json +++ b/packages/eslint-config-bases/package.json @@ -31,15 +31,18 @@ "./playwright": { "require": "./src/bases/playwright.js" }, - "./react": { - "require": "./src/bases/react.js" - }, "./prettier": { "require": "./src/bases/prettier.js" }, + "./react": { + "require": "./src/bases/react.js" + }, "./rtl": { "require": "./src/bases/rtl.js" }, + "./regexp": { + "require": "./src/bases/regexp.js" + }, "./sonar": { "require": "./src/bases/sonar.js" }, diff --git a/packages/eslint-config-bases/src/bases/index.js b/packages/eslint-config-bases/src/bases/index.js index 57fe309e8c0..0a0527304e4 100644 --- a/packages/eslint-config-bases/src/bases/index.js +++ b/packages/eslint-config-bases/src/bases/index.js @@ -3,6 +3,7 @@ module.exports = { jest: require('./jest'), playwright: require('./playwright'), react: require('./react'), + regexp: require('./regexp'), reactTestingLibrary: require('./rtl'), storybook: require('./storybook'), typescript: require('./typescript'), diff --git a/packages/eslint-config-bases/src/bases/regexp.js b/packages/eslint-config-bases/src/bases/regexp.js new file mode 100644 index 00000000000..57839fe0284 --- /dev/null +++ b/packages/eslint-config-bases/src/bases/regexp.js @@ -0,0 +1,12 @@ +/** + * Custom config base for projects that wants to enable regexp rules. + */ + +module.exports = { + // @see https://github.com/ota-meshi/eslint-plugin-regexp + extends: ['plugin:regexp/recommended'], + rules: { + 'regexp/prefer-result-array-groups': 'off', + }, + overrides: [], +}; diff --git a/packages/eslint-config-bases/src/bases/typescript.js b/packages/eslint-config-bases/src/bases/typescript.js index 156034a9b3a..112461bafe3 100644 --- a/packages/eslint-config-bases/src/bases/typescript.js +++ b/packages/eslint-config-bases/src/bases/typescript.js @@ -27,7 +27,6 @@ module.exports = { 'plugin:@typescript-eslint/recommended', 'plugin:import/recommended', 'plugin:import/typescript', - 'plugin:regexp/recommended', ], rules: { 'spaced-comment': [ diff --git a/packages/ui-lib/.eslintrc.js b/packages/ui-lib/.eslintrc.js index 35252a834bc..242ce518d16 100644 --- a/packages/ui-lib/.eslintrc.js +++ b/packages/ui-lib/.eslintrc.js @@ -12,6 +12,7 @@ module.exports = { ignorePatterns: [...getDefaultIgnorePatterns(), '/storybook-static'], extends: [ '@your-org/eslint-config-bases/typescript', + '@your-org/eslint-config-bases/regexp', '@your-org/eslint-config-bases/sonar', '@your-org/eslint-config-bases/jest', '@your-org/eslint-config-bases/rtl', From 2062d76f65789d45593d1d3e056ed6fe280477b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Vanvelthem?= Date: Mon, 11 Apr 2022 17:29:57 +0200 Subject: [PATCH 18/22] docs: updated README --- packages/eslint-config-bases/README.md | 205 ++++++++++--------------- 1 file changed, 85 insertions(+), 120 deletions(-) diff --git a/packages/eslint-config-bases/README.md b/packages/eslint-config-bases/README.md index efd28d777d9..6ceee01ba27 100644 --- a/packages/eslint-config-bases/README.md +++ b/packages/eslint-config-bases/README.md @@ -6,142 +6,107 @@

-# About linters - -This doc provides tips and tricks based on [eslint](https://eslint.org) and [prettier](https://prettier.org) in the -context of the [nextjs-monorepo-example](https://github.com/belgattitude/nextjs-monorepo-example). -It covers few popular plugins, their configurations, how to run them efficiently -on CI and how they can be customized per apps or packages. - -## Plugins - -Depending on the nature of the project (plain typescript, react, nextjs...), the following plugins are enabled: - -| Type/Plugin | Scope | Comment | -| :---------------------------------------------------------------------------------------------------------------------- | :----- | :--------------------------------------------------------------------------- | -| [eslint:recommended](https://eslint.org/docs/rules/) | base | The basics for code linting. | -| [@typescript-eslint/recommended](https://typescript-eslint.io/rules/) | base | The basics for typescript. | -| [@typescript-eslint/consistent-type](https://typescript-eslint.io/rules/consistent-type-imports) | base | Use TS 3.8+ imports/exports, helps with [esbuild](https://esbuild.github.io) | -| [@typescript-eslint/naming-convention](https://typescript-eslint.io/rules/naming-convention) | base | | -| [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import) | base | Order imports | -| [eslint-plugin-sonarjs/recommended](https://github.com/SonarSource/eslint-plugin-sonarjs) | base | Help to keep complexity sane | -| [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) | base | Run prettier formatting from eslint | -| [eslint-plugin-regexp/recommended](https://github.com/ota-meshi/eslint-plugin-regexp) | base | | -| [eslint-plugin-jest/recommended](https://github.com/jest-community/eslint-plugin-jest) | base | Jest recommended practices. | -| [eslint-plugin-react/recommended](https://github.com/yannickcr/eslint-plugin-react) | react | | -| [eslint-plugin-react-hooks/recommended](https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks) | react | | -| [eslint-plugin-jsx-a11y/recommended](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y) | react | Helps to produce accessibility-ready jsx | -| [eslint-plugin-testing-library/recommended](https://github.com/testing-library/eslint-plugin-testing-library) | react | Ease when using react-testing-library | -| [@next/next/core-web-vitals](https://nextjs.org/docs/basic-features/eslint#eslint-plugin) | nextjs | NextJs specific | -| ... | ... | ... | - -There's many more in the wild. - -## Structure - -Often in monorepo you might want to apply different plugins or config differently for each package. There's many -ways to achieve it. The [nextjs-monorepo-example](https://github.com/belgattitude/nextjs-monorepo-example) uses a -nested approach: +# About -``` -. -├── apps -│ ├── remix-app -│ │ └── .eslintrc.js (extends eslint.base: adds react, rtl...) -│ └── web-app -│ └── .eslintrc.js (extends eslint.base: adds react, nextjs, rtl...) -├── packages -│ ├── db-main-prisma -│ │ └── .eslintrc.js (re-export eslint.base: no changes) -│ └── ui-lib -│ └── .eslintrc.js (extends eslint.base: adds react, rtl, storybook...) -│ -├── .eslint.base.js (base config to extend: just typescript and jest) -├── .prettierignore (prettier ignored files) -└── .prettierrc.js (prettier global configuration) -``` - -Open the files above to know more about configuration. - -## Commands - -If you are in a specific package, you can run the linter from the package directory. - -| Name | Description | -| ----------------- | ---------------------- | -| `yarn lint` | Display linter issues. | -| `yarn lint --fix` | Run automatic fixes. | - -It's possible to run the linter globally from any folder of the monorepo. - -| Name | Description | -| ------------------- | ---------------------------------------------- | -| `yarn g:lint` | Display linter issues in all apps and packages | -| `yarn g:lint --fix` | Run automatic fixes | - -## Lint-staged - -See the [specific doc](./about-lint-staged.md). - -## Performance - -By default, all lint command will automatically enable cache. +Customizable eslint config bases that can be easily shared and fine-tuned by apps and +packages that lives in the [monorepo example](https://github.com/belgattitude/nextjs-monorepo-example). -On Github CI, the cache will be persisted thx to `action/cache`. +## Install -
- action/cache example - -```yaml -- name: Restore packages cache - uses: actions/cache@v2 - with: - path: | - ${{ github.workspace }}/.cache - ${{ github.workspace }}/**/tsconfig.tsbuildinfo - ${{ github.workspace }}/**/.eslintcache - - key: ${{ runner.os }}-packages-cache-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('packages/**.[jt]sx?', 'packages/**.json') }} - restore-keys: | - ${{ runner.os }}-packages-cache-${{ hashFiles('**/yarn.lock') }}- +```bash +$ yarn add --dev @your-org/eslint-config-bases:"workspace:^" ``` -
+> **Tip:** You may need to add the eslint peer dep as well: `yarn add --dev eslint`. + +## Usage + +In your app or package, create an `./apps/my-app/.eslintrc.js` file that extends any of the +existing base configs. For example: + +```javascript +module.exports = { + root: true, // Be sure to set root to true in monorepo. + ignorePatterns: ["**/node_modules", "**/.cache", "build", ".next"], + extends: [ + "@your-org/eslint-config-bases/typescript", + "@your-org/eslint-config-bases/sonar", + "@your-org/eslint-config-bases/regexp", + "@your-org/eslint-config-bases/jest", + "@your-org/eslint-config-bases/react", + "@your-org/eslint-config-bases/rtl", + "@your-org/eslint-config-bases/graphql-schema", + "@your-org/eslint-config-bases/storybook", + + // Add specific rules for your framework if needed. + // ie: + // - nextjs: 'plugin:@next/next/core-web-vitals', + // - remix: '@remix-run/eslint-config', + // ... + + // Post configure the prettier base so there won't be + // any conficts between eslint / prettier + "@your-org/eslint-config-bases/prettier", + ], + rules: { + // Specific global rules for your app or package + }, + overrides: [ + // Specific file rules for your app or package + ], +}; +``` -## Installation +## Bases -In monorepos, rathers than installing linters at the root level, a safer approach is to specify them -per apps/packages. If you're creating a new package, here's the typical dev-dependencies to add: +You can find the bases in `./src/bases` and see how they are defined. -### Base +### Typescript -Generic typescript project with jest +Generic typescript project, mostly based on -```bash -yarn add --dev prettier eslint \ - eslint-import-resolver-typescript eslint-plugin-import eslint-plugin-jest \ - eslint-plugin-jest-formatting eslint-plugin-prettier eslint-plugin-regexp \ - eslint-plugin-sonarjs @typescript-eslint/eslint-plugin @typescript-eslint/parser -``` +| Type/Plugin | Comment | +| :---------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------- | +| [eslint:recommended](https://eslint.org/docs/rules/) | The basics for code linting. | +| [@typescript-eslint/recommended](https://typescript-eslint.io/rules/) | The basics for typescript. | +| [@typescript-eslint/consistent-type](https://typescript-eslint.io/rules/consistent-type-imports) | Use TS 3.8+ imports/exports, helps with [esbuild](https://esbuild.github.io) | +| [@typescript-eslint/naming-convention](https://typescript-eslint.io/rules/naming-convention) | | +| [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import) | Order imports | +| [eslint-plugin-sonarjs/recommended](https://github.com/SonarSource/eslint-plugin-sonarjs) | Help to keep complexity sane | +| [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) | Run prettier formatting from eslint | +| [eslint-plugin-regexp/recommended](https://github.com/ota-meshi/eslint-plugin-regexp) | | +| [eslint-plugin-jest/recommended](https://github.com/jest-community/eslint-plugin-jest) | Jest recommended practices. | +| [eslint-plugin-react/recommended](https://github.com/yannickcr/eslint-plugin-react) | | +| [eslint-plugin-react-hooks/recommended](https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks) | | +| [eslint-plugin-jsx-a11y/recommended](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y) | Helps to produce accessibility-ready jsx | +| [eslint-plugin-testing-library/recommended](https://github.com/testing-library/eslint-plugin-testing-library) | Ease when using react-testing-library | ### React -Generic react +| Type/Plugin | Comment | +| :---------------------------------------------------------------------------------------------------------------------- | :--------------------------------------- | +| [eslint-plugin-react/recommended](https://github.com/yannickcr/eslint-plugin-react) | | +| [eslint-plugin-react-hooks/recommended](https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks) | | +| [eslint-plugin-jsx-a11y/recommended](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y) | Helps to produce accessibility-ready jsx | -```bash -yarn add --dev eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks \ - eslint-plugin-testing-library -``` +### Jest -### Nextjs +| Type/Plugin | Comment | +| :------------------------------------------------------------------------------------- | :-------------------------- | +| [eslint-plugin-jest/recommended](https://github.com/jest-community/eslint-plugin-jest) | Jest recommended practices. | -Specific to nextjs. +### React Testing Library -```bash -yarn add --dev eslint-config-next -``` +| Type/Plugin | Comment | +| :------------------------------------------------------------------------------------------------------------ | :------------------------------------ | +| [eslint-plugin-testing-library/recommended](https://github.com/testing-library/eslint-plugin-testing-library) | Ease when using react-testing-library | + +### Regexp + +| Type/Plugin | Comment | +| :------------------------------------------------------------------------------------ | :------ | +| [eslint-plugin-regexp/recommended](https://github.com/ota-meshi/eslint-plugin-regexp) | | -## Future +### Etc -Note that when times come a good move is to create a ./packages/my-eslint-plugin. That -eases the installation and the configuration. +... From 92826afc4fe4827e3702f0dfc254d54a8a92f6af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Vanvelthem?= Date: Mon, 11 Apr 2022 17:39:49 +0200 Subject: [PATCH 19/22] docs: updated linter docs --- docs/about-linters.md | 134 +++++++++++++++--------------------------- 1 file changed, 49 insertions(+), 85 deletions(-) diff --git a/docs/about-linters.md b/docs/about-linters.md index e7e15c8a19c..642dda83223 100644 --- a/docs/about-linters.md +++ b/docs/about-linters.md @@ -1,60 +1,62 @@ # About linters -This doc provides tips and tricks based on [eslint](https://eslint.org) and [prettier](https://prettier.org) in the -context of the [nextjs-monorepo-example](https://github.com/belgattitude/nextjs-monorepo-example). -It covers few popular plugins, their configurations, how to run them efficiently -on CI and how they can be customized per apps or packages. - -## Plugins - -Depending on the nature of the project (plain typescript, react, nextjs...), the following plugins are enabled: - -| Type/Plugin | Scope | Comment | -| :---------------------------------------------------------------------------------------------------------------------- | :----- | :--------------------------------------------------------------------------- | -| [eslint:recommended](https://eslint.org/docs/rules/) | base | The basics for code linting. | -| [@typescript-eslint/recommended](https://typescript-eslint.io/rules/) | base | The basics for typescript. | -| [@typescript-eslint/consistent-type](https://typescript-eslint.io/rules/consistent-type-imports) | base | Use TS 3.8+ imports/exports, helps with [esbuild](https://esbuild.github.io) | -| [@typescript-eslint/naming-convention](https://typescript-eslint.io/rules/naming-convention) | base | | -| [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import) | base | Order imports | -| [eslint-plugin-sonarjs/recommended](https://github.com/SonarSource/eslint-plugin-sonarjs) | base | Help to keep complexity sane | -| [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) | base | Run prettier formatting from eslint | -| [eslint-plugin-regexp/recommended](https://github.com/ota-meshi/eslint-plugin-regexp) | base | | -| [eslint-plugin-jest/recommended](https://github.com/jest-community/eslint-plugin-jest) | base | Jest recommended practices. | -| [eslint-plugin-react/recommended](https://github.com/yannickcr/eslint-plugin-react) | react | | -| [eslint-plugin-react-hooks/recommended](https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks) | react | | -| [eslint-plugin-jsx-a11y/recommended](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y) | react | Helps to produce accessibility-ready jsx | -| [eslint-plugin-testing-library/recommended](https://github.com/testing-library/eslint-plugin-testing-library) | react | Ease when using react-testing-library | -| [@next/next/core-web-vitals](https://nextjs.org/docs/basic-features/eslint#eslint-plugin) | nextjs | NextJs specific | -| ... | ... | ... | - -There's many more in the wild. - -## Structure - -Often in monorepo you might want to apply different plugins or config differently for each package. There's many -ways to achieve it. The [nextjs-monorepo-example](https://github.com/belgattitude/nextjs-monorepo-example) uses a -nested approach: +Linters in a monorepo should offer consistency but also offer flexibility in each app and package (a.k.a. workspace). + +## Recommended approach + +Define a package holding all your base configurations and enable them per workspace. + +### Example config + +If you use the provided example of `packages/eslint-config-bases`, it's easy to add or +customize rules on per workspace basis by creating an `.eslintrc.js` file in the workspace root. + +```javascript +module.exports = { + root: true, // Be sure to set root to true in monorepo. + ignorePatterns: ["**/node_modules", "**/.cache", "build", ".next"], + extends: [ + "@your-org/eslint-config-bases/typescript", + "@your-org/eslint-config-bases/sonar", + "@your-org/eslint-config-bases/regexp", + "@your-org/eslint-config-bases/jest", + "@your-org/eslint-config-bases/react", + "@your-org/eslint-config-bases/rtl", + "@your-org/eslint-config-bases/graphql-schema", + "@your-org/eslint-config-bases/storybook", + + // Add specific rules for your framework if needed. + // ie: + // - nextjs: 'plugin:@next/next/core-web-vitals', + // - remix: '@remix-run/eslint-config', + // ... + + // Post configure the prettier base so there won't be + // any conficts between eslint / prettier + "@your-org/eslint-config-bases/prettier", + ], + rules: { + // Specific global rules for your app or package + }, + overrides: [ + // Specific file rules for your app or package + ], +}; +``` + +### Workspace structure ``` . ├── apps │ ├── remix-app -│ │ └── .eslintrc.js (extends eslint.base: adds react, rtl...) +│ │ └── .eslintrc.js (extends from [@your-org/eslint-config-bases/react]) │ └── nextjs-app -│ └── .eslintrc.js (extends eslint.base: adds react, nextjs, rtl...) -├── packages -│ ├── db-main-prisma -│ │ └── .eslintrc.js (re-export eslint.base: no changes) -│ └── ui-lib -│ └── .eslintrc.js (extends eslint.base: adds react, rtl, storybook...) -│ -├── .eslint.base.js (base config to extend: just typescript and jest) -├── .prettierignore (prettier ignored files) -└── .prettierrc.js (prettier global configuration) +│ └── .eslintrc.js +└── packages + └── eslint-config-bases ``` -Open the files above to know more about configuration. - ## Commands If you are in a specific package, you can run the linter from the package directory. @@ -99,41 +101,3 @@ On Github CI, the cache will be persisted thx to `action/cache`. ``` - -## Installation - -In monorepos, rathers than installing linters at the root level, a safer approach is to specify them -per apps/packages. If you're creating a new package, here's the typical dev-dependencies to add: - -### Base - -Generic typescript project with jest - -```bash -yarn add --dev prettier eslint \ - eslint-import-resolver-typescript eslint-plugin-import eslint-plugin-jest \ - eslint-plugin-jest-formatting eslint-plugin-prettier eslint-plugin-regexp \ - eslint-plugin-sonarjs @typescript-eslint/eslint-plugin @typescript-eslint/parser -``` - -### React - -Generic react - -```bash -yarn add --dev eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks \ - eslint-plugin-testing-library -``` - -### Nextjs - -Specific to nextjs. - -```bash -yarn add --dev eslint-config-next -``` - -## Future - -Note that when times come a good move is to create a ./packages/my-eslint-plugin. That -eases the installation and the configuration. From f867da197730f59705e223812a447841bf738a2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Vanvelthem?= Date: Mon, 11 Apr 2022 17:46:58 +0200 Subject: [PATCH 20/22] docs: update readme --- README.md | 91 +++++++++---------------------------------------------- 1 file changed, 14 insertions(+), 77 deletions(-) diff --git a/README.md b/README.md index 7020abbfed4..398166b73c4 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,8 @@ Useful to └── packages ├── core-lib ├── db-main-prisma - └── ui-lib (emotion, storybook) + ├── eslint-config-bases (to shared eslint configs) + └── ui-lib (emotion, storybook) ``` #### Example apps @@ -68,6 +69,7 @@ Useful to - [packages/core-lib](./packages/core-lib): publishable. [README](./packages/core-lib/README.md) | [CHANGELOG](./packages/core-lib/CHANGELOG.md) - [packages/db-main-prisma](./packages/db-main-prisma): used by web-app. [README](./packages/db-main-prisma/README.md) | [CHANGELOG](./packages/db-main-prisma/CHANGELOG.md) +- [packages/eslint-config-bases](./packages/eslint-config-bases): [README](./packages/eslint-config-bases/README.md) | [CHANGELOG](./packages/eslint-config-bases/CHANGELOG.md) - [packages/ui-lib](./packages/ui-lib): publishable. [README](./packages/ui-lib/README.md) | [CHANGELOG](./packages/ui-lib/CHANGELOG.md) > Apps can depend on packages, packages can depend on each others... @@ -124,6 +126,12 @@ If needed static resources like **locales**, **images**,... can be shared by usi │ │ ├── package.json │ │ └── tsconfig.json │ │ +│ ├── eslint-config-bases +│ │ ├── src/ +│ │ ├── CHANGELOG.md +│ │ ├── package.json +│ │ └── tsconfig.json +│ │ │ └── ui-lib (basic design-system in react) │ ├── src/ │ ├── CHANGELOG.md @@ -204,46 +212,11 @@ Initialize a package.json with the name of your package. "fix:all-files": "eslint . --ext .ts,.tsx,.js,.jsx --fix", }, "devDependencies": { - "@testing-library/jest-dom": "5.14.1", - "@testing-library/react": "12.0.0", - "@testing-library/react-hooks": "7.0.1", - "@types/node": "16.4.10", - "@types/react": "17.0.15", - "@types/react-dom": "17.0.9", - "@typescript-eslint/eslint-plugin": "4.29.0", - "@typescript-eslint/parser": "4.29.0", - "camelcase": "6.2.0", - "eslint": "7.32.0", - "eslint-config-prettier": "8.3.0", - "eslint-plugin-import": "2.23.4", - "eslint-plugin-jest": "24.4.0", - "eslint-plugin-jest-formatting": "3.0.0", - "eslint-plugin-jsx-a11y": "6.4.1", - "eslint-plugin-prettier": "3.4.0", - "eslint-plugin-react": "7.24.0", - "eslint-plugin-react-hooks": "4.2.0", - "eslint-plugin-testing-library": "4.10.1", - "jest": "27.0.6", - "npm-run-all": "4.1.5", - "prettier": "2.3.2", - "react": "17.0.2", - "react-dom": "17.0.2", - "rimraf": "3.0.2", - "shell-quote": "1.7.2", - "ts-jest": "27.0.4", - "typescript": "4.3.5", - }, - "peerDependencies": { - "react": "^16.14.0 || ^17.0.2", - "react-dom": "^16.14.0 || ^17.0.2", + "@your-org/eslint-config-bases": "workspace:^", }, } ``` -> _Note that as we want to be strict with dependencies, the best is to -> define all you need (eslint, ...) per package. And not in the monorepo root. -> That might seem weird, but on the long run it's much safer._ - ### 3. Using the package in app @@ -256,7 +229,7 @@ yarn and pnpm. ```bash cd apps/my-app -yarn add @your-org/magnificent-poney@'workspace:*' +yarn add @your-org/magnificent-poney@'workspace:^' ``` Inspiration can be found in [apps/nextjs-app/package.json](./apps/nextjs-app/package.json). @@ -268,7 +241,7 @@ Inspiration can be found in [apps/nextjs-app/package.json](./apps/nextjs-app/pac { "name": "my-app", "dependencies": { - "@your-org/magnificient-poney": "workspace:*", + "@your-org/magnificient-poney": "workspace:^", }, } ``` @@ -429,11 +402,8 @@ They are based on the excellent [npm-check-updates](https://github.com/raineorsh ### 5.1 Linters -An example of base eslint configuration can be found in [./.eslint.base.js](./.eslintrc.base.js), apps -and packages extends it in their own root folder, as an example see [./apps/nextjs-app/.eslintrc.js](./apps/nextjs-app/.eslintrc.js). -Prettier is included in eslint configuration as well as [eslint-config-next](https://nextjs.org/docs/basic-features/eslint) for nextjs apps. - -For code complexity and deeper code analysis [sonarjs plugin](https://github.com/SonarSource/eslint-plugin-sonarjs) is activated. +See an example in [./apps/nextjs-app/.eslintrc.js](./apps/nextjs-app/.eslintrc.js) and our +[eslint-config-bases](./packages/eslint-config-bases/README.md). ### 5.2 Hooks / Lint-staged @@ -557,39 +527,6 @@ To help keeping deps up-to-date, see the `yarn deps:check && yarn deps:update` s > by setting `defaultSemverRangePrefix: ""` in [yarnrc.yml](./.yarnrc.yml). But this would make the default for packages/\* as well. > Better to handle `yarn add something --exact` on per-case basis. -#### About next-transpile-modules - -And why this repo example doesn't use it to support package sharing. - -[next-transpile-modules](https://github.com/martpie/next-transpile-modules) is one of the most installed -packages for nextjs. It basically allows you to transpile some 3rd party packages present in your node_modules folder. -This can be helpful for transpiling packages for legacy browser support (ie11), esm packages (till it lands in nextjs) and -handle shared packages. - -In this repo, we use next-transpile-modules only for ie11 and esm. The monorepo management is done through [tsconfig path](https://github.com/vercel/next.js/pull/13542). -It will work best when external tooling is involved (ts-jest...), but comes with some limitations if your shared package use an -scss compiler for example. Note that future version of NextJs might improve monorepo support through [experimental.externalDir option](https://github.com/vercel/next.js/pull/22867). - -See here a quick comparison: - -| Support matrix | tsconfig paths | next-transpile-module | -| ------------------- | ------------------ | ------------------------- | -| Typescript | ✅ | ✅ | -| Javascript | ✅ | ✅ | -| NextJs Fast refresh | ✅ | ✅ | -| CSS | custom webpack cfg | ✅ | -| SCSS | custom webpack cfg | ✅ | -| CSS-in-JS | ✅ | ✅ | -| ts-jest | ✅ | custom aliases | -| Vercel monorepo | ✅ | ✅ | -| Yarn 2 PNP | ✅ | ✅ | -| Webpack5 | ✅ | ✅ | -| Publishable (npm) | ✅ | ❌ (ntm relies on "main") | - -## See also - -- https://stackoverflow.com/a/69554480/5490184 - ## License [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fbelgattitude%2Fnextjs-monorepo-example.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fbelgattitude%2Fnextjs-monorepo-example?ref=badge_large) From 7586304453cdaf731a4e52ac6031668875cc3544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Vanvelthem?= Date: Mon, 11 Apr 2022 17:53:16 +0200 Subject: [PATCH 21/22] docs: updated features --- packages/eslint-config-bases/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/eslint-config-bases/README.md b/packages/eslint-config-bases/README.md index 6ceee01ba27..cba42ea78fa 100644 --- a/packages/eslint-config-bases/README.md +++ b/packages/eslint-config-bases/README.md @@ -11,6 +11,12 @@ Customizable eslint config bases that can be easily shared and fine-tuned by apps and packages that lives in the [monorepo example](https://github.com/belgattitude/nextjs-monorepo-example). +## Features + +- **Perf:** Plugins enabled on conventional file patterns rather than all files. +- **Customizable:** Each app can extend multiple bases and customize them. +- **Compatible:** Compatibility with prettier. + ## Install ```bash From 019d5b1f48cad9198d981d826df38d114f48267a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Vanvelthem?= Date: Mon, 11 Apr 2022 17:58:32 +0200 Subject: [PATCH 22/22] docs: mention prettier --- packages/eslint-config-bases/README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/eslint-config-bases/README.md b/packages/eslint-config-bases/README.md index cba42ea78fa..85fb2ee4cc0 100644 --- a/packages/eslint-config-bases/README.md +++ b/packages/eslint-config-bases/README.md @@ -63,6 +63,25 @@ module.exports = { }; ``` +> **Tip:** "@your-org/eslint-config-bases/prettier" must be set at the end to disable any +> conflicting rules. + +## Prettier integration + +On top level re-export the prettier base from `@your-org/eslint-config-bases`, for example + +```javascript +const { getPrettierConfig } = require("@your-org/eslint-config-bases/helpers"); +module.exports = { + ...prettierConfig, + overrides: [ + // whatever you need + ], +}; +``` + +So eslint and prettier won't confict. + ## Bases You can find the bases in `./src/bases` and see how they are defined.