From 6141a2dda2cb55ea82f41166136d0cfdaeb3fe95 Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Wed, 2 Mar 2022 20:21:46 +0100 Subject: [PATCH 01/20] fix(eslint-plugin): make import/no-extraneous-dependencies work for react config --- package.json | 4 +- packages/eslint-plugin/src/configs/react.js | 74 +++++++++++---------- yarn.lock | 71 +++++++++++++++++++- 3 files changed, 109 insertions(+), 40 deletions(-) diff --git a/package.json b/package.json index 242f6e6212e44..155bd4da6776b 100644 --- a/package.json +++ b/package.json @@ -179,10 +179,10 @@ "eslint": "7.25.0", "eslint-config-airbnb": "18.2.1", "eslint-config-prettier": "8.3.0", - "eslint-import-resolver-typescript": "2.4.0", + "eslint-import-resolver-typescript": "2.5.0", "eslint-plugin-deprecation": "1.2.1", "eslint-plugin-es": "4.1.0", - "eslint-plugin-import": "2.22.1", + "eslint-plugin-import": "2.25.4", "eslint-plugin-jest": "23.20.0", "eslint-plugin-jsdoc": "^36.0.7", "eslint-plugin-jsx-a11y": "6.4.1", diff --git a/packages/eslint-plugin/src/configs/react.js b/packages/eslint-plugin/src/configs/react.js index 984800edbf887..1a79f5861aa69 100644 --- a/packages/eslint-plugin/src/configs/react.js +++ b/packages/eslint-plugin/src/configs/react.js @@ -1,24 +1,24 @@ // @ts-check -const path = require('path'); const configHelpers = require('../utils/configHelpers'); -const gitRoot = configHelpers.findGitRoot(); - /** @type {import("eslint").Linter.Config} */ const config = { + root: true, extends: [ // Provides both rules and some parser options and other settings 'airbnb', + // add typescript support for import plugin - https://github.com/import-js/eslint-plugin-import/blob/main/config/typescript.js + 'plugin:import/typescript', // Extended configs are applied in order, so these configs that turn other rules off should come last 'prettier', ], parser: '@typescript-eslint/parser', plugins: [ + 'import', '@fluentui', '@rnx-kit', '@typescript-eslint', 'deprecation', - 'import', 'jest', 'jsdoc', 'jsx-a11y', @@ -26,16 +26,11 @@ const config = { 'react-hooks', ], settings: { - // Some config suggestions copied from https://github.com/alexgorbatchev/eslint-import-resolver-typescript#configuration - 'import/parsers': { - '@typescript-eslint/parser': ['.ts', '.tsx'], - }, 'import/resolver': { + // @see https://github.com/alexgorbatchev/eslint-import-resolver-typescript#configuration typescript: { - // always try to resolve types under `@types` directory alwaysTryTypes: true, - // NOTE: For packages without a tsconfig.json, override with "project": "../../tsconfig.json" - project: ['./tsconfig.json', path.join(gitRoot, 'tsconfig.json')], + project: './tsconfig.json', }, }, jsdoc: { @@ -102,7 +97,6 @@ const config = { 'dot-notation': 'error', eqeqeq: ['error', 'always'], 'guard-for-in': 'error', - 'import/no-extraneous-dependencies': ['error', { devDependencies: false }], 'jsx-a11y/tabindex-no-positive': 'error', 'no-alert': 'error', 'no-bitwise': 'error', @@ -173,15 +167,7 @@ const config = { 'default-case': 'off', 'func-names': 'off', 'global-require': 'off', - 'import/extensions': 'off', - 'import/first': 'off', - 'import/newline-after-import': 'off', - 'import/no-duplicates': 'off', // mostly redundant with no-duplicate-imports - 'import/no-dynamic-require': 'off', - 'import/no-mutable-exports': 'off', - 'import/no-unresolved': 'off', - 'import/no-useless-path-segments': 'off', - 'import/order': 'off', + 'jsx-a11y/alt-text': 'off', 'jsx-a11y/anchor-is-valid': 'off', 'jsx-a11y/aria-activedescendant-has-tabindex': 'off', @@ -256,7 +242,6 @@ const config = { 'no-restricted-syntax': 'off', // permanently disable because we disagree with these rules - 'import/prefer-default-export': 'off', 'no-await-in-loop': 'off', // contrary to rule docs, awaited things often are NOT parallelizable 'react/jsx-props-no-spreading': 'off', 'react/prop-types': 'off', @@ -264,9 +249,6 @@ const config = { // permanently disable due to performance issues (using custom rule `@fluentui/max-len` instead) 'max-len': 'off', - // permanently disable due to being unnecessary or having limited benefit for TS - 'import/export': 'off', - // permanently disable due to perf problems and limited benefit // see here for perf testing (note that you must run eslint directly) // https://eslint.org/docs/developer-guide/working-with-rules#per-rule-performance @@ -277,6 +259,30 @@ const config = { 'react/no-unused-prop-types': 'off', 'react/prefer-es6-class': 'off', + 'jsdoc/check-tag-names': [ + 'error', + { + // Allow TSDoc tags @remarks and @defaultValue + definedTags: ['remarks', 'defaultValue'], + }, + ], + + /** + * + * import plugin rules + * @see https://github.com/import-js/eslint-plugin-import + */ + 'import/no-extraneous-dependencies': ['error', { devDependencies: false }], + 'import/extensions': 'off', + 'import/first': 'off', + 'import/newline-after-import': 'off', + 'import/no-duplicates': 'off', // mostly redundant with no-duplicate-imports + 'import/no-dynamic-require': 'off', + 'import/no-mutable-exports': 'off', + 'import/no-unresolved': 'off', + 'import/no-useless-path-segments': 'off', + 'import/order': 'off', + 'import/prefer-default-export': 'off', // may cause perf problems per https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/FAQ.md#eslint-plugin-import 'import/no-cycle': 'off', 'import/no-deprecated': 'off', @@ -284,17 +290,9 @@ const config = { 'import/no-unused-modules': 'off', // these ones aren't needed for TS and may cause perf problems 'import/default': 'off', - 'import/named': 'off', 'import/namespace': 'off', 'import/no-named-as-default-member': 'off', - - 'jsdoc/check-tag-names': [ - 'error', - { - // Allow TSDoc tags @remarks and @defaultValue - definedTags: ['remarks', 'defaultValue'], - }, - ], + 'import/export': 'off', }, }; @@ -406,7 +404,13 @@ const getOverrides = () => [ { files: [...configHelpers.devDependenciesFiles], rules: { - 'import/no-extraneous-dependencies': ['error', { packageDir: ['.', gitRoot] }], + // - turning off this rule for non production code + // - it doesn't work for our use cases as it should + // - we don't wanna specify monorepo packages as devDependencies in package.json + // if they are used in non production code. This rule is unable to handle this scenario. + // TODO: + // As a follow up we will introduce `@nrwl/nx/enforce-module-boundaries` with {"banTransitiveDependencies": true} + 'import/no-extraneous-dependencies': ['off'], }, }, ]; diff --git a/yarn.lock b/yarn.lock index 04c1104540286..ad332a3064e8c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6713,6 +6713,15 @@ array.prototype.flat@^1.2.1, array.prototype.flat@^1.2.3: define-properties "^1.1.3" es-abstract "^1.17.0-next.1" +array.prototype.flat@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.2.5.tgz#07e0975d84bbc7c48cd1879d609e682598d33e13" + integrity sha512-KaYU+S+ndVqyUnignHftkwc58o3uVU1jzczILJ1tN2YaIZpFIKBiP/x/j97E5MVPsaCloPbqWLB/8qCTVvT2qg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.19.0" + array.prototype.flatmap@^1.2.1, array.prototype.flatmap@^1.2.4, array.prototype.flatmap@^1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/array.prototype.flatmap/-/array.prototype.flatmap-1.2.5.tgz#908dc82d8a406930fdf38598d51e7411d18d4446" @@ -10056,7 +10065,7 @@ debug@3.2.6: dependencies: ms "^2.1.1" -debug@3.X, debug@^3.0.0, debug@^3.1.0, debug@^3.1.1, debug@^3.2.6: +debug@3.X, debug@^3.0.0, debug@^3.1.0, debug@^3.1.1, debug@^3.2.6, debug@^3.2.7: version "3.2.7" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a" integrity sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ== @@ -11392,7 +11401,26 @@ eslint-import-resolver-node@^0.3.4: debug "^2.6.9" resolve "^1.13.1" -eslint-import-resolver-typescript@2.4.0, eslint-import-resolver-typescript@^2.4.0: +eslint-import-resolver-node@^0.3.6: + version "0.3.6" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz#4048b958395da89668252001dbd9eca6b83bacbd" + integrity sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw== + dependencies: + debug "^3.2.7" + resolve "^1.20.0" + +eslint-import-resolver-typescript@2.5.0, eslint-import-resolver-typescript@^2.4.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-2.5.0.tgz#07661966b272d14ba97f597b51e1a588f9722f0a" + integrity sha512-qZ6e5CFr+I7K4VVhQu3M/9xGv9/YmwsEXrsm3nimw8vWaVHRDrQRp26BgCypTxBp3vUp4o5aVEJRiy0F2DFddQ== + dependencies: + debug "^4.3.1" + glob "^7.1.7" + is-glob "^4.0.1" + resolve "^1.20.0" + tsconfig-paths "^3.9.0" + +eslint-import-resolver-typescript@^2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-2.4.0.tgz#ec1e7063ebe807f0362a7320543aaed6fe1100e1" integrity sha512-useJKURidCcldRLCNKWemr1fFQL1SzB3G4a0li6lFGvlc5xGe1hY343bvG07cbpCzPuM/lK19FIJB3XGFSkplA== @@ -11411,6 +11439,14 @@ eslint-module-utils@^2.6.0: debug "^2.6.9" pkg-dir "^2.0.0" +eslint-module-utils@^2.7.2: + version "2.7.3" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz#ad7e3a10552fdd0642e1e55292781bd6e34876ee" + integrity sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ== + dependencies: + debug "^3.2.7" + find-up "^2.1.0" + eslint-plugin-deprecation@1.2.1, eslint-plugin-deprecation@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/eslint-plugin-deprecation/-/eslint-plugin-deprecation-1.2.1.tgz#ab1b80d7d0b8ce694f646ed41e03f90d3f0fbcd0" @@ -11436,7 +11472,26 @@ eslint-plugin-es@^3.0.0: eslint-utils "^2.0.0" regexpp "^3.0.0" -eslint-plugin-import@2.22.1, eslint-plugin-import@^2.22.1: +eslint-plugin-import@2.25.4: + version "2.25.4" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.25.4.tgz#322f3f916a4e9e991ac7af32032c25ce313209f1" + integrity sha512-/KJBASVFxpu0xg1kIBn9AUa8hQVnszpwgE7Ld0lKAlx7Ie87yzEzCgSkekt+le/YVhiaosO4Y14GDAOc41nfxA== + dependencies: + array-includes "^3.1.4" + array.prototype.flat "^1.2.5" + debug "^2.6.9" + doctrine "^2.1.0" + eslint-import-resolver-node "^0.3.6" + eslint-module-utils "^2.7.2" + has "^1.0.3" + is-core-module "^2.8.0" + is-glob "^4.0.3" + minimatch "^3.0.4" + object.values "^1.1.5" + resolve "^1.20.0" + tsconfig-paths "^3.12.0" + +eslint-plugin-import@^2.22.1: version "2.22.1" resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz#0896c7e6a0cf44109a2d97b95903c2bb689d7702" integrity sha512-8K7JjINHOpH64ozkAhpT3sd+FswIZTfMZTjdx052pnWrgRCVfp8op9tbjpAk3DdUeI/Ba4C8OjdC0r90erHEOw== @@ -25304,6 +25359,16 @@ tsconfig-paths@3.9.0, tsconfig-paths@^3.9.0: minimist "^1.2.0" strip-bom "^3.0.0" +tsconfig-paths@^3.12.0: + version "3.13.0" + resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.13.0.tgz#f3e9b8f6876698581d94470c03c95b3a48c0e3d7" + integrity sha512-nWuffZppoaYK0vQ1SQmkSsQzJoHA4s6uzdb2waRpD806x9yfq153AdVsWz4je2qZcW+pENrMQXbGQ3sMCkXuhw== + dependencies: + "@types/json5" "^0.0.29" + json5 "^1.0.1" + minimist "^1.2.0" + strip-bom "^3.0.0" + tslib@1.11.2: version "1.11.2" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.2.tgz#9c79d83272c9a7aaf166f73915c9667ecdde3cc9" From fa7c23217f234a975a02cecf11045671c9a82771 Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Thu, 3 Mar 2022 14:27:45 +0100 Subject: [PATCH 02/20] Change files --- ...-cra-template-1441b2ce-805e-4783-b54d-d0dc1405794e.json | 7 +++++++ ...eslint-plugin-6b96c0dd-b3e9-49e3-9668-83ccf7e28620.json | 7 +++++++ ...act-accordion-a88290b3-b03a-40b9-a8cc-d24ab80c5071.json | 7 +++++++ ...-react-avatar-c63280cc-55c6-4360-aa31-5ced2bd439ae.json | 7 +++++++ ...ct-components-6b800570-deea-41a1-a565-0987a0589347.json | 7 +++++++ ...eact-provider-c610d38f-97b5-4686-ab4d-ec59b20d764a.json | 7 +++++++ ...ui-react-tabs-7eea6ae2-201d-49d4-8749-15add0838235.json | 7 +++++++ 7 files changed, 49 insertions(+) create mode 100644 change/@fluentui-cra-template-1441b2ce-805e-4783-b54d-d0dc1405794e.json create mode 100644 change/@fluentui-eslint-plugin-6b96c0dd-b3e9-49e3-9668-83ccf7e28620.json create mode 100644 change/@fluentui-react-accordion-a88290b3-b03a-40b9-a8cc-d24ab80c5071.json create mode 100644 change/@fluentui-react-avatar-c63280cc-55c6-4360-aa31-5ced2bd439ae.json create mode 100644 change/@fluentui-react-components-6b800570-deea-41a1-a565-0987a0589347.json create mode 100644 change/@fluentui-react-provider-c610d38f-97b5-4686-ab4d-ec59b20d764a.json create mode 100644 change/@fluentui-react-tabs-7eea6ae2-201d-49d4-8749-15add0838235.json diff --git a/change/@fluentui-cra-template-1441b2ce-805e-4783-b54d-d0dc1405794e.json b/change/@fluentui-cra-template-1441b2ce-805e-4783-b54d-d0dc1405794e.json new file mode 100644 index 0000000000000..f20ec14c08bde --- /dev/null +++ b/change/@fluentui-cra-template-1441b2ce-805e-4783-b54d-d0dc1405794e.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore(cra-template): remove import/resolve from lint config", + "packageName": "@fluentui/cra-template", + "email": "martinhochel@microsoft.com", + "dependentChangeType": "none" +} diff --git a/change/@fluentui-eslint-plugin-6b96c0dd-b3e9-49e3-9668-83ccf7e28620.json b/change/@fluentui-eslint-plugin-6b96c0dd-b3e9-49e3-9668-83ccf7e28620.json new file mode 100644 index 0000000000000..8525468131ca6 --- /dev/null +++ b/change/@fluentui-eslint-plugin-6b96c0dd-b3e9-49e3-9668-83ccf7e28620.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "fix(eslint-plugin): make import/no-extraneous-dependencies work for react config", + "packageName": "@fluentui/eslint-plugin", + "email": "martinhochel@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/change/@fluentui-react-accordion-a88290b3-b03a-40b9-a8cc-d24ab80c5071.json b/change/@fluentui-react-accordion-a88290b3-b03a-40b9-a8cc-d24ab80c5071.json new file mode 100644 index 0000000000000..93aeb62647a43 --- /dev/null +++ b/change/@fluentui-react-accordion-a88290b3-b03a-40b9-a8cc-d24ab80c5071.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "fixup! fix(react-accordion): fix missing dependencies", + "packageName": "@fluentui/react-accordion", + "email": "martinhochel@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/change/@fluentui-react-avatar-c63280cc-55c6-4360-aa31-5ced2bd439ae.json b/change/@fluentui-react-avatar-c63280cc-55c6-4360-aa31-5ced2bd439ae.json new file mode 100644 index 0000000000000..f60e3858226df --- /dev/null +++ b/change/@fluentui-react-avatar-c63280cc-55c6-4360-aa31-5ced2bd439ae.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "fixup! fix(react-avatar): fix missing dependencies", + "packageName": "@fluentui/react-avatar", + "email": "martinhochel@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/change/@fluentui-react-components-6b800570-deea-41a1-a565-0987a0589347.json b/change/@fluentui-react-components-6b800570-deea-41a1-a565-0987a0589347.json new file mode 100644 index 0000000000000..ffc22e15edd92 --- /dev/null +++ b/change/@fluentui-react-components-6b800570-deea-41a1-a565-0987a0589347.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "chore(react-components): fix lint issues exposed by import/no-extrenaus-dependency rule", + "packageName": "@fluentui/react-components", + "email": "martinhochel@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/change/@fluentui-react-provider-c610d38f-97b5-4686-ab4d-ec59b20d764a.json b/change/@fluentui-react-provider-c610d38f-97b5-4686-ab4d-ec59b20d764a.json new file mode 100644 index 0000000000000..f04acd6122d62 --- /dev/null +++ b/change/@fluentui-react-provider-c610d38f-97b5-4686-ab4d-ec59b20d764a.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "fix(react-provider): fix lint issues", + "packageName": "@fluentui/react-provider", + "email": "martinhochel@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/change/@fluentui-react-tabs-7eea6ae2-201d-49d4-8749-15add0838235.json b/change/@fluentui-react-tabs-7eea6ae2-201d-49d4-8749-15add0838235.json new file mode 100644 index 0000000000000..8f81d4a040efd --- /dev/null +++ b/change/@fluentui-react-tabs-7eea6ae2-201d-49d4-8749-15add0838235.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "fix(react-tabs): fix missing dependencies and lint warnings", + "packageName": "@fluentui/react-tabs", + "email": "martinhochel@microsoft.com", + "dependentChangeType": "patch" +} From c5f186fac4a2e7e9c8aa0b9af3d4de2e0cfe2032 Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Thu, 3 Mar 2022 14:42:40 +0100 Subject: [PATCH 03/20] chore: remove unused import-resolver-ts eslint plugin --- package.json | 1 - packages/eslint-plugin/package.json | 1 - yarn.lock | 13 +------------ 3 files changed, 1 insertion(+), 14 deletions(-) diff --git a/package.json b/package.json index 155bd4da6776b..15569b4449ffe 100644 --- a/package.json +++ b/package.json @@ -320,7 +320,6 @@ "enhanced-resolve", "eslint-config-airbnb", "eslint-config-prettier", - "eslint-import-resolver-typescript", "eslint-plugin-deprecation", "eslint-plugin-import", "eslint-plugin-jest", diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 64c239a4d97e2..38f5495df0982 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -18,7 +18,6 @@ "@typescript-eslint/parser": "^4.22.0", "eslint-config-airbnb": "^18.2.1", "eslint-config-prettier": "^8.3.0", - "eslint-import-resolver-typescript": "^2.4.0", "eslint-plugin-deprecation": "^1.2.1", "eslint-plugin-import": "^2.22.1", "eslint-plugin-jest": "^23.13.2", diff --git a/yarn.lock b/yarn.lock index ad332a3064e8c..ee9790a680c5e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11409,7 +11409,7 @@ eslint-import-resolver-node@^0.3.6: debug "^3.2.7" resolve "^1.20.0" -eslint-import-resolver-typescript@2.5.0, eslint-import-resolver-typescript@^2.4.0: +eslint-import-resolver-typescript@2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-2.5.0.tgz#07661966b272d14ba97f597b51e1a588f9722f0a" integrity sha512-qZ6e5CFr+I7K4VVhQu3M/9xGv9/YmwsEXrsm3nimw8vWaVHRDrQRp26BgCypTxBp3vUp4o5aVEJRiy0F2DFddQ== @@ -11420,17 +11420,6 @@ eslint-import-resolver-typescript@2.5.0, eslint-import-resolver-typescript@^2.4. resolve "^1.20.0" tsconfig-paths "^3.9.0" -eslint-import-resolver-typescript@^2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-2.4.0.tgz#ec1e7063ebe807f0362a7320543aaed6fe1100e1" - integrity sha512-useJKURidCcldRLCNKWemr1fFQL1SzB3G4a0li6lFGvlc5xGe1hY343bvG07cbpCzPuM/lK19FIJB3XGFSkplA== - dependencies: - debug "^4.1.1" - glob "^7.1.6" - is-glob "^4.0.1" - resolve "^1.17.0" - tsconfig-paths "^3.9.0" - eslint-module-utils@^2.6.0: version "2.6.0" resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.6.0.tgz#579ebd094f56af7797d19c9866c9c9486629bfa6" From 14de40d55badcb7edcd0989bea2b50e56fd5073c Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Fri, 4 Mar 2022 13:07:14 +0100 Subject: [PATCH 04/20] fix(react-conformance-griffel): add react-conformance missing dependency --- ...nce-griffel-7dbc04a7-7597-4437-a96b-cbde034b0fe0.json | 7 +++++++ package.json | 8 ++++++++ packages/react-conformance-griffel/package.json | 9 +++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 change/@fluentui-react-conformance-griffel-7dbc04a7-7597-4437-a96b-cbde034b0fe0.json diff --git a/change/@fluentui-react-conformance-griffel-7dbc04a7-7597-4437-a96b-cbde034b0fe0.json b/change/@fluentui-react-conformance-griffel-7dbc04a7-7597-4437-a96b-cbde034b0fe0.json new file mode 100644 index 0000000000000..d7cf011e2698e --- /dev/null +++ b/change/@fluentui-react-conformance-griffel-7dbc04a7-7597-4437-a96b-cbde034b0fe0.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "fix(react-conformance-griffel): add react-conformance missing dependency", + "packageName": "@fluentui/react-conformance-griffel", + "email": "martinhochel@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/package.json b/package.json index 15569b4449ffe..bc81b4d8fe10f 100644 --- a/package.json +++ b/package.json @@ -415,6 +415,14 @@ "ci-info", "node-fetch" ] + }, + { + "packages": [ + "@fluentui/react-conformance-griffel" + ], + "dependencies": [ + "@fluentui/react-conformance" + ] } ] }, diff --git a/packages/react-conformance-griffel/package.json b/packages/react-conformance-griffel/package.json index 8d7415188f2da..3fcc4279d917f 100644 --- a/packages/react-conformance-griffel/package.json +++ b/packages/react-conformance-griffel/package.json @@ -22,10 +22,15 @@ }, "devDependencies": { "@fluentui/eslint-plugin": "*", - "@fluentui/scripts": "^1.0.0", - "@fluentui/react-conformance": "*" + "@fluentui/scripts": "^1.0.0" + }, + "peerDependencies": { + "@types/react": ">=16.8.0 <18.0.0", + "@types/react-dom": ">=16.8.0 <18.0.0", + "typescript": "^4.3.0" }, "dependencies": { + "@fluentui/react-conformance": "^0.10.1", "@griffel/react": "1.0.0", "tslib": "^2.1.0" }, From c955bfff5953136feee495a78736120cd172e897 Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Fri, 4 Mar 2022 13:43:28 +0100 Subject: [PATCH 05/20] chore(pr-deploy-site): make lint work after import resolver changes --- apps/pr-deploy-site/.eslintrc.json | 7 ------- apps/pr-deploy-site/package.json | 6 +++--- apps/pr-deploy-site/tsconfig.json | 8 ++++++++ package.json | 1 + 4 files changed, 12 insertions(+), 10 deletions(-) create mode 100644 apps/pr-deploy-site/tsconfig.json diff --git a/apps/pr-deploy-site/.eslintrc.json b/apps/pr-deploy-site/.eslintrc.json index 39e08c0d62209..ac81a128fc768 100644 --- a/apps/pr-deploy-site/.eslintrc.json +++ b/apps/pr-deploy-site/.eslintrc.json @@ -1,13 +1,6 @@ { "extends": ["plugin:@fluentui/eslint-plugin/node"], "root": true, - "settings": { - "import/resolver": { - "typescript": { - "project": "../../tsconfig.json" - } - } - }, "overrides": [ { // pr-deploy-site.js is run without transpiling in all browsers, which means it must use diff --git a/apps/pr-deploy-site/package.json b/apps/pr-deploy-site/package.json index e7c77a6e4f388..1358952b5e2e3 100644 --- a/apps/pr-deploy-site/package.json +++ b/apps/pr-deploy-site/package.json @@ -7,12 +7,12 @@ "scripts": { "clean": "just-scripts clean", "generate:site": "just-scripts generate:site", - "lint": "eslint --ext .js,.ts --cache ." + "lint": "eslint --ext .js,.ts --cache .", + "type-check": "tsc -p ." }, "license": "MIT", "devDependencies": { "@fluentui/eslint-plugin": "*", - "@fluentui/scripts": "^1.0.0", - "@microsoft/eslint-plugin-sdl": "0.1.9" + "@fluentui/scripts": "^1.0.0" } } diff --git a/apps/pr-deploy-site/tsconfig.json b/apps/pr-deploy-site/tsconfig.json new file mode 100644 index 0000000000000..05b3c792324e3 --- /dev/null +++ b/apps/pr-deploy-site/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../scripts/tsconfig.json", + "compilerOptions": { + "noEmit": true, + "allowJs": true + }, + "include": ["pr-deploy-site.js", "just.config.ts"] +} diff --git a/package.json b/package.json index bc81b4d8fe10f..34e3bb21b2843 100644 --- a/package.json +++ b/package.json @@ -93,6 +93,7 @@ "@griffel/webpack-loader": "2.0.0", "@linaria/babel-preset": "3.0.0-beta.14", "@microsoft/api-extractor": "7.18.1", + "@microsoft/eslint-plugin-sdl": "0.1.9", "@nrwl/cli": "13.8.1", "@nrwl/devkit": "13.8.1", "@nrwl/jest": "13.8.1", From 84ecd83f7dd6d75ccc3444cad5c6fcc7ed6d0720 Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Fri, 4 Mar 2022 14:29:20 +0100 Subject: [PATCH 06/20] fix(react-avatar): fix missing dependencies --- packages/react-avatar/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react-avatar/package.json b/packages/react-avatar/package.json index 85d71e980e072..25469f86e25d0 100644 --- a/packages/react-avatar/package.json +++ b/packages/react-avatar/package.json @@ -36,6 +36,7 @@ "@fluentui/react-badge": "9.0.0-rc.5", "@fluentui/react-icons": "^2.0.159-beta.10", "@fluentui/react-theme": "9.0.0-rc.4", + "@fluentui/react-shared-contexts": "9.0.0-rc.4", "@fluentui/react-utilities": "9.0.0-rc.5", "@griffel/react": "1.0.0", "tslib": "^2.1.0" From bc4d1d3f8aedce9dd23eebd72b7a5c9d8d8c2c2e Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Fri, 4 Mar 2022 15:34:18 +0100 Subject: [PATCH 07/20] fix(react-accordion): fix missing dependencies --- packages/react-accordion/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react-accordion/package.json b/packages/react-accordion/package.json index 9138411ed0cc0..7afbfa6a15c2c 100644 --- a/packages/react-accordion/package.json +++ b/packages/react-accordion/package.json @@ -34,6 +34,7 @@ "dependencies": { "@fluentui/react-aria": "9.0.0-rc.5", "@fluentui/react-context-selector": "9.0.0-rc.5", + "@fluentui/react-shared-contexts": "9.0.0-rc.4", "@fluentui/react-icons": "^2.0.159-beta.10", "@griffel/react": "1.0.0", "@fluentui/react-tabster": "9.0.0-rc.5", From e29b1b133f77159fcd62a3008d76ee1cbff033ee Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Fri, 4 Mar 2022 15:38:35 +0100 Subject: [PATCH 08/20] fix(react-tabs): fix missing dependencies and lint warnings --- packages/react-tabs/package.json | 1 + packages/react-tabs/src/components/Tab/renderTab.tsx | 1 - packages/react-tabs/src/components/Tab/useTab.ts | 1 - packages/react-tabs/src/components/Tab/useTabStyles.ts | 1 - packages/react-tabs/src/components/TabList/renderTabList.tsx | 1 - packages/react-tabs/src/components/TabList/useTabList.ts | 1 - packages/react-tabs/src/components/TabList/useTabListStyles.ts | 1 - 7 files changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/react-tabs/package.json b/packages/react-tabs/package.json index e113266683f23..9eeb03459f187 100644 --- a/packages/react-tabs/package.json +++ b/packages/react-tabs/package.json @@ -33,6 +33,7 @@ }, "dependencies": { "@griffel/react": "1.0.0", + "@fluentui/react-context-selector": "9.0.0-rc.5", "@fluentui/react-tabster": "9.0.0-rc.5", "@fluentui/react-theme": "9.0.0-rc.4", "@fluentui/react-utilities": "9.0.0-rc.5", diff --git a/packages/react-tabs/src/components/Tab/renderTab.tsx b/packages/react-tabs/src/components/Tab/renderTab.tsx index a487c2ac063bd..338bad0053125 100644 --- a/packages/react-tabs/src/components/Tab/renderTab.tsx +++ b/packages/react-tabs/src/components/Tab/renderTab.tsx @@ -5,7 +5,6 @@ import type { TabState, TabSlots } from './Tab.types'; /** * Render the final JSX of Tab */ -// eslint-disable-next-line @typescript-eslint/naming-convention export const renderTab_unstable = (state: TabState) => { const { slots, slotProps } = getSlots(state); diff --git a/packages/react-tabs/src/components/Tab/useTab.ts b/packages/react-tabs/src/components/Tab/useTab.ts index 3395923eed53c..e6878cb512dc5 100644 --- a/packages/react-tabs/src/components/Tab/useTab.ts +++ b/packages/react-tabs/src/components/Tab/useTab.ts @@ -14,7 +14,6 @@ import { SelectTabEvent } from '../TabList/TabList.types'; * @param props - props from this instance of Tab * @param ref - reference to root HTMLElement of Tab */ -// eslint-disable-next-line @typescript-eslint/naming-convention export const useTab_unstable = (props: TabProps, ref: React.Ref): TabState => { const { content, icon, value } = props; diff --git a/packages/react-tabs/src/components/Tab/useTabStyles.ts b/packages/react-tabs/src/components/Tab/useTabStyles.ts index b7186ac07a025..354870957e1b9 100644 --- a/packages/react-tabs/src/components/Tab/useTabStyles.ts +++ b/packages/react-tabs/src/components/Tab/useTabStyles.ts @@ -166,7 +166,6 @@ const useContentStyles = makeStyles({ /** * Apply styling to the Tab slots based on the state */ -// eslint-disable-next-line @typescript-eslint/naming-convention export const useTabStyles_unstable = (state: TabState): TabState => { const rootStyles = useRootStyles(); const focusStyles = useFocusStyles(); diff --git a/packages/react-tabs/src/components/TabList/renderTabList.tsx b/packages/react-tabs/src/components/TabList/renderTabList.tsx index b93f0b20cbafb..b2db464f6ec79 100644 --- a/packages/react-tabs/src/components/TabList/renderTabList.tsx +++ b/packages/react-tabs/src/components/TabList/renderTabList.tsx @@ -6,7 +6,6 @@ import { TabListContext } from './TabListContext'; /** * Render the final JSX of TabList */ -// eslint-disable-next-line @typescript-eslint/naming-convention export const renderTabList_unstable = (state: TabListState, contextValues: TabListContextValues) => { const { slots, slotProps } = getSlots(state); diff --git a/packages/react-tabs/src/components/TabList/useTabList.ts b/packages/react-tabs/src/components/TabList/useTabList.ts index 99191b9458805..660fd7b039a10 100644 --- a/packages/react-tabs/src/components/TabList/useTabList.ts +++ b/packages/react-tabs/src/components/TabList/useTabList.ts @@ -18,7 +18,6 @@ import type { RegisterTabData, SelectTabData, SelectTabEvent, TabListProps, TabL * @param props - props from this instance of TabList * @param ref - reference to root HTMLElement of TabList */ -// eslint-disable-next-line @typescript-eslint/naming-convention export const useTabList_unstable = (props: TabListProps, ref: React.Ref): TabListState => { const { appearance = 'transparent', onTabSelect, size = 'medium', vertical = false } = props; diff --git a/packages/react-tabs/src/components/TabList/useTabListStyles.ts b/packages/react-tabs/src/components/TabList/useTabListStyles.ts index 1f2e80e952aac..94ab9f5376ef3 100644 --- a/packages/react-tabs/src/components/TabList/useTabListStyles.ts +++ b/packages/react-tabs/src/components/TabList/useTabListStyles.ts @@ -91,7 +91,6 @@ const useVerticalIndicatorStyles = makeStyles({ /** * Apply styling to the TabList slots based on the state */ -// eslint-disable-next-line @typescript-eslint/naming-convention export const useTabListStyles_unstable = (state: TabListState): TabListState => { const { selectedTabRect: selectionIndicatorRect, selectedValue, size, vertical } = state; From 6ca077f7b9adbf95b0fd0d8836f737a4fe347fef Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Fri, 4 Mar 2022 15:42:33 +0100 Subject: [PATCH 09/20] fix(vr-tests-react-components): fix missing dependencies --- apps/vr-tests-react-components/package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/vr-tests-react-components/package.json b/apps/vr-tests-react-components/package.json index 9b0bae899208b..9dafe89d4bf20 100644 --- a/apps/vr-tests-react-components/package.json +++ b/apps/vr-tests-react-components/package.json @@ -33,12 +33,15 @@ "@fluentui/react-popover": "9.0.0-rc.5", "@fluentui/react-positioning": "9.0.0-rc.5", "@fluentui/react-provider": "9.0.0-rc.5", + "@fluentui/react-radio": "9.0.0-beta.2", + "@fluentui/react-shared-contexts": "9.0.0-rc.4", "@fluentui/react-slider": "9.0.0-beta.10", "@fluentui/react-switch": "9.0.0-rc.5", "@fluentui/react-tabs": "9.0.0-beta.8", "@fluentui/react-text": "9.0.0-rc.5", "@fluentui/react-theme": "9.0.0-rc.4", "@fluentui/react-tooltip": "9.0.0-rc.5", + "@fluentui/react-utilities": "9.0.0-rc.5", "@fluentui/scripts": "^1.0.0", "@griffel/react": "1.0.0", "react": "16.14.0", From a42389f57b7a49a40ef3ead4745685843a57e2e0 Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Fri, 4 Mar 2022 17:08:13 +0100 Subject: [PATCH 10/20] chore(cra-template): remove import/resolve from lint config --- packages/cra-template/.eslintrc.json | 7 ------- packages/cra-template/package.json | 3 ++- packages/cra-template/tsconfig.json | 8 ++++++++ 3 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 packages/cra-template/tsconfig.json diff --git a/packages/cra-template/.eslintrc.json b/packages/cra-template/.eslintrc.json index 8a66911c1ed56..efb1ca6d6e8af 100644 --- a/packages/cra-template/.eslintrc.json +++ b/packages/cra-template/.eslintrc.json @@ -1,13 +1,6 @@ { "extends": ["plugin:@fluentui/eslint-plugin/react"], "root": true, - "settings": { - "import/resolver": { - "typescript": { - "project": "../../tsconfig.json" - } - } - }, "overrides": [ { "files": ["template/**/*.{ts,tsx}"], diff --git a/packages/cra-template/package.json b/packages/cra-template/package.json index 8b879dd5084fa..6b3c667613de4 100644 --- a/packages/cra-template/package.json +++ b/packages/cra-template/package.json @@ -9,7 +9,8 @@ }, "scripts": { "lint": "eslint --ext .js,.ts,.tsx .", - "test": "node -r @fluentui/scripts/babel/register scripts/test.ts" + "test": "node -r @fluentui/scripts/babel/register scripts/test.ts", + "type-check": "tsc -p ." }, "license": "MIT", "files": [ diff --git a/packages/cra-template/tsconfig.json b/packages/cra-template/tsconfig.json new file mode 100644 index 0000000000000..d0cebca8137d0 --- /dev/null +++ b/packages/cra-template/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../scripts/tsconfig.json", + "compilerOptions": { + "noEmit": true + }, + "include": ["scripts"], + "exclude": ["node_modules", "template"] +} From 7708a557c104846a806874cf62db26eabb5b4484 Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Fri, 4 Mar 2022 18:27:51 +0100 Subject: [PATCH 11/20] chore(react-components): fix lint issues exposed by import/no-extrenaus-dependency rule --- packages/react-components/config/pre-copy.json | 2 +- .../src/unstable/{package.json => package.json__tmpl__} | 0 packages/react-components/src/unstable/tsconfig.json | 4 ---- 3 files changed, 1 insertion(+), 5 deletions(-) rename packages/react-components/src/unstable/{package.json => package.json__tmpl__} (100%) delete mode 100644 packages/react-components/src/unstable/tsconfig.json diff --git a/packages/react-components/config/pre-copy.json b/packages/react-components/config/pre-copy.json index ef3caf24f777a..840125f4b3b70 100644 --- a/packages/react-components/config/pre-copy.json +++ b/packages/react-components/config/pre-copy.json @@ -1,5 +1,5 @@ { "copyTo": { - "unstable": ["./src/unstable/package.json"] + "unstable/package.json": "./src/unstable/package.json__tmpl__" } } diff --git a/packages/react-components/src/unstable/package.json b/packages/react-components/src/unstable/package.json__tmpl__ similarity index 100% rename from packages/react-components/src/unstable/package.json rename to packages/react-components/src/unstable/package.json__tmpl__ diff --git a/packages/react-components/src/unstable/tsconfig.json b/packages/react-components/src/unstable/tsconfig.json deleted file mode 100644 index 4fe490521de8d..0000000000000 --- a/packages/react-components/src/unstable/tsconfig.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "include": ["index.ts"] -} From ec845e9a45fddf5abffe0f74ca51e0bdd5874a0f Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Fri, 4 Mar 2022 18:29:43 +0100 Subject: [PATCH 12/20] feat(scripts): add file rename while copy behaviour to copy just-task --- scripts/tasks/copy.ts | 50 ++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/scripts/tasks/copy.ts b/scripts/tasks/copy.ts index 6e1c6efc16327..7a86709ae79bc 100644 --- a/scripts/tasks/copy.ts +++ b/scripts/tasks/copy.ts @@ -1,8 +1,8 @@ import * as fs from 'fs'; import * as path from 'path'; -import { series, resolveCwd, copyTask } from 'just-scripts'; +import { series, resolveCwd, copyTask, copyInstructionsTask, TaskFunction } from 'just-scripts'; -export function expandSourcePath(pattern) { +export function expandSourcePath(pattern: string): string { if (!pattern) { return null; } @@ -31,25 +31,49 @@ export function expandSourcePath(pattern) { } export function copy() { - let tasks = []; - let configPath = path.resolve(process.cwd(), 'config/pre-copy.json'); + const tasks: TaskFunction[] = []; + const configPath = path.resolve(process.cwd(), 'config/pre-copy.json'); if (!fs.existsSync(configPath)) { return; } - const config = JSON.parse(fs.readFileSync(configPath, 'utf8')); + const config: { copyTo?: Record | string> } = JSON.parse(fs.readFileSync(configPath, 'utf8')); if (config && config.copyTo) { - for (let destination in config.copyTo) { + for (const destination in config.copyTo) { const sources = config.copyTo[destination]; - destination = path.resolve(process.cwd(), destination); - tasks.push( - copyTask({ - paths: sources.map(src => expandSourcePath(src)), - dest: destination, - }), - ); + const destinationPath = path.resolve(process.cwd(), destination); + + if (Array.isArray(sources)) { + const sourcePaths = sources.map(src => expandSourcePath(src)); + + tasks.push( + copyTask({ + paths: sourcePaths, + dest: destinationPath, + }), + ); + + continue; + } + + if (typeof sources === 'string') { + tasks.push( + copyInstructionsTask({ + copyInstructions: [ + { + sourceFilePath: sources, + destinationFilePath: destinationPath, + }, + ], + }), + ); + + continue; + } + + throw new Error('non supported API used. copyTo is a String Dictionary with values being string or string array'); } } From 7c6f659f16cc1e6173f00350ac4052e5126fa889 Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Tue, 8 Mar 2022 17:19:30 +0100 Subject: [PATCH 13/20] fixup! fix(eslint-plugin): make import/no-extraneous-dependencies work for react config --- packages/eslint-plugin/package.json | 1 + yarn.lock | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 38f5495df0982..64c239a4d97e2 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -18,6 +18,7 @@ "@typescript-eslint/parser": "^4.22.0", "eslint-config-airbnb": "^18.2.1", "eslint-config-prettier": "^8.3.0", + "eslint-import-resolver-typescript": "^2.4.0", "eslint-plugin-deprecation": "^1.2.1", "eslint-plugin-import": "^2.22.1", "eslint-plugin-jest": "^23.13.2", diff --git a/yarn.lock b/yarn.lock index ee9790a680c5e..a9570a406034f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1668,6 +1668,18 @@ "@uifabric/set-version" "^7.0.23" tslib "^1.10.0" +"@fluentui/react-conformance@^0.10.1": + version "0.10.1" + resolved "https://registry.yarnpkg.com/@fluentui/react-conformance/-/react-conformance-0.10.1.tgz#ff4996144d8ed1378b41dd760b4b9a84c4160007" + integrity sha512-M7LkkvkDXa+XAQ4qNB2/IHvIYKjxlfVrFkuKa9X8Kw4GooxVlzljH0KMHt98DRDW8f7rTehly0GtCGSELnSbWA== + dependencies: + chalk "^2.4.2" + doctrine "^3.0.0" + lodash "^4.17.15" + react-docgen-typescript "^2.1.0" + react-is "^16.6.3" + tslib "^2.1.0" + "@fluentui/react-icons@^2.0.159-beta.10": version "2.0.159-beta.10" resolved "https://registry.yarnpkg.com/@fluentui/react-icons/-/react-icons-2.0.159-beta.10.tgz#8934c05b415bbb1b46f9085c72eaf78fd7bad967" @@ -11409,7 +11421,7 @@ eslint-import-resolver-node@^0.3.6: debug "^3.2.7" resolve "^1.20.0" -eslint-import-resolver-typescript@2.5.0: +eslint-import-resolver-typescript@2.5.0, eslint-import-resolver-typescript@^2.4.0: version "2.5.0" resolved "https://registry.yarnpkg.com/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-2.5.0.tgz#07661966b272d14ba97f597b51e1a588f9722f0a" integrity sha512-qZ6e5CFr+I7K4VVhQu3M/9xGv9/YmwsEXrsm3nimw8vWaVHRDrQRp26BgCypTxBp3vUp4o5aVEJRiy0F2DFddQ== From 2a485500da6a104eb2ecb2c7fdf0575a0ef55406 Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Tue, 8 Mar 2022 17:28:51 +0100 Subject: [PATCH 14/20] fixup! fixup! fix(eslint-plugin): make import/no-extraneous-dependencies work for react config --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 34e3bb21b2843..71a7f4105943c 100644 --- a/package.json +++ b/package.json @@ -321,6 +321,7 @@ "enhanced-resolve", "eslint-config-airbnb", "eslint-config-prettier", + "eslint-import-resolver-typescript", "eslint-plugin-deprecation", "eslint-plugin-import", "eslint-plugin-jest", From 02c338a952af3aa4a8581582c464d6300e503937 Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Tue, 8 Mar 2022 17:36:33 +0100 Subject: [PATCH 15/20] fixup! fixup! fixup! fix(eslint-plugin): make import/no-extraneous-dependencies work for react config --- packages/eslint-plugin/src/configs/react.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/src/configs/react.js b/packages/eslint-plugin/src/configs/react.js index 1a79f5861aa69..e93fa706125ee 100644 --- a/packages/eslint-plugin/src/configs/react.js +++ b/packages/eslint-plugin/src/configs/react.js @@ -410,7 +410,7 @@ const getOverrides = () => [ // if they are used in non production code. This rule is unable to handle this scenario. // TODO: // As a follow up we will introduce `@nrwl/nx/enforce-module-boundaries` with {"banTransitiveDependencies": true} - 'import/no-extraneous-dependencies': ['off'], + 'import/no-extraneous-dependencies': 'off', }, }, ]; From c6c42d9f610b658d174786b8d756395ae5017f17 Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Tue, 8 Mar 2022 17:53:46 +0100 Subject: [PATCH 16/20] fixup! fixup! fixup! fixup! fix(eslint-plugin): make import/no-extraneous-dependencies work for react config --- packages/eslint-plugin/src/configs/react.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/eslint-plugin/src/configs/react.js b/packages/eslint-plugin/src/configs/react.js index e93fa706125ee..8c34586c924e7 100644 --- a/packages/eslint-plugin/src/configs/react.js +++ b/packages/eslint-plugin/src/configs/react.js @@ -404,12 +404,7 @@ const getOverrides = () => [ { files: [...configHelpers.devDependenciesFiles], rules: { - // - turning off this rule for non production code - // - it doesn't work for our use cases as it should - // - we don't wanna specify monorepo packages as devDependencies in package.json - // if they are used in non production code. This rule is unable to handle this scenario. - // TODO: - // As a follow up we will introduce `@nrwl/nx/enforce-module-boundaries` with {"banTransitiveDependencies": true} + // TODO: https://github.com/microsoft/fluentui/issues/21999 'import/no-extraneous-dependencies': 'off', }, }, From 305186ef8a5f2666bb1d66ea8abeb947fea748a2 Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Tue, 8 Mar 2022 18:14:14 +0100 Subject: [PATCH 17/20] fixup! fix(react-conformance-griffel): add react-conformance missing dependency --- packages/react-conformance-griffel/package.json | 2 +- yarn.lock | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/packages/react-conformance-griffel/package.json b/packages/react-conformance-griffel/package.json index 3fcc4279d917f..d48756a229c61 100644 --- a/packages/react-conformance-griffel/package.json +++ b/packages/react-conformance-griffel/package.json @@ -30,7 +30,7 @@ "typescript": "^4.3.0" }, "dependencies": { - "@fluentui/react-conformance": "^0.10.1", + "@fluentui/react-conformance": "^0.11.0", "@griffel/react": "1.0.0", "tslib": "^2.1.0" }, diff --git a/yarn.lock b/yarn.lock index a9570a406034f..58da173815e4a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1668,18 +1668,6 @@ "@uifabric/set-version" "^7.0.23" tslib "^1.10.0" -"@fluentui/react-conformance@^0.10.1": - version "0.10.1" - resolved "https://registry.yarnpkg.com/@fluentui/react-conformance/-/react-conformance-0.10.1.tgz#ff4996144d8ed1378b41dd760b4b9a84c4160007" - integrity sha512-M7LkkvkDXa+XAQ4qNB2/IHvIYKjxlfVrFkuKa9X8Kw4GooxVlzljH0KMHt98DRDW8f7rTehly0GtCGSELnSbWA== - dependencies: - chalk "^2.4.2" - doctrine "^3.0.0" - lodash "^4.17.15" - react-docgen-typescript "^2.1.0" - react-is "^16.6.3" - tslib "^2.1.0" - "@fluentui/react-icons@^2.0.159-beta.10": version "2.0.159-beta.10" resolved "https://registry.yarnpkg.com/@fluentui/react-icons/-/react-icons-2.0.159-beta.10.tgz#8934c05b415bbb1b46f9085c72eaf78fd7bad967" From 61aa885703f2839c3122276ee854788a50802326 Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Thu, 10 Mar 2022 13:27:31 +0100 Subject: [PATCH 18/20] Apply suggestions from code review Co-authored-by: Oleksandr Fediashov --- ...ui-react-accordion-a88290b3-b03a-40b9-a8cc-d24ab80c5071.json | 2 +- ...entui-react-avatar-c63280cc-55c6-4360-aa31-5ced2bd439ae.json | 2 +- ...i-react-components-6b800570-deea-41a1-a565-0987a0589347.json | 2 +- ...onformance-griffel-7dbc04a7-7597-4437-a96b-cbde034b0fe0.json | 2 +- ...luentui-react-tabs-7eea6ae2-201d-49d4-8749-15add0838235.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/change/@fluentui-react-accordion-a88290b3-b03a-40b9-a8cc-d24ab80c5071.json b/change/@fluentui-react-accordion-a88290b3-b03a-40b9-a8cc-d24ab80c5071.json index 93aeb62647a43..0c0a74a4d58f2 100644 --- a/change/@fluentui-react-accordion-a88290b3-b03a-40b9-a8cc-d24ab80c5071.json +++ b/change/@fluentui-react-accordion-a88290b3-b03a-40b9-a8cc-d24ab80c5071.json @@ -1,6 +1,6 @@ { "type": "prerelease", - "comment": "fixup! fix(react-accordion): fix missing dependencies", + "comment": "add missing dependencies", "packageName": "@fluentui/react-accordion", "email": "martinhochel@microsoft.com", "dependentChangeType": "patch" diff --git a/change/@fluentui-react-avatar-c63280cc-55c6-4360-aa31-5ced2bd439ae.json b/change/@fluentui-react-avatar-c63280cc-55c6-4360-aa31-5ced2bd439ae.json index f60e3858226df..625eed59b787c 100644 --- a/change/@fluentui-react-avatar-c63280cc-55c6-4360-aa31-5ced2bd439ae.json +++ b/change/@fluentui-react-avatar-c63280cc-55c6-4360-aa31-5ced2bd439ae.json @@ -1,6 +1,6 @@ { "type": "prerelease", - "comment": "fixup! fix(react-avatar): fix missing dependencies", + "comment": "add missing dependencies", "packageName": "@fluentui/react-avatar", "email": "martinhochel@microsoft.com", "dependentChangeType": "patch" diff --git a/change/@fluentui-react-components-6b800570-deea-41a1-a565-0987a0589347.json b/change/@fluentui-react-components-6b800570-deea-41a1-a565-0987a0589347.json index ffc22e15edd92..5564405c8077f 100644 --- a/change/@fluentui-react-components-6b800570-deea-41a1-a565-0987a0589347.json +++ b/change/@fluentui-react-components-6b800570-deea-41a1-a565-0987a0589347.json @@ -1,5 +1,5 @@ { - "type": "prerelease", + "type": "none", "comment": "chore(react-components): fix lint issues exposed by import/no-extrenaus-dependency rule", "packageName": "@fluentui/react-components", "email": "martinhochel@microsoft.com", diff --git a/change/@fluentui-react-conformance-griffel-7dbc04a7-7597-4437-a96b-cbde034b0fe0.json b/change/@fluentui-react-conformance-griffel-7dbc04a7-7597-4437-a96b-cbde034b0fe0.json index d7cf011e2698e..37916659eda22 100644 --- a/change/@fluentui-react-conformance-griffel-7dbc04a7-7597-4437-a96b-cbde034b0fe0.json +++ b/change/@fluentui-react-conformance-griffel-7dbc04a7-7597-4437-a96b-cbde034b0fe0.json @@ -1,6 +1,6 @@ { "type": "prerelease", - "comment": "fix(react-conformance-griffel): add react-conformance missing dependency", + "comment": "add react-conformance missing dependency", "packageName": "@fluentui/react-conformance-griffel", "email": "martinhochel@microsoft.com", "dependentChangeType": "patch" diff --git a/change/@fluentui-react-tabs-7eea6ae2-201d-49d4-8749-15add0838235.json b/change/@fluentui-react-tabs-7eea6ae2-201d-49d4-8749-15add0838235.json index 8f81d4a040efd..6e98650d420eb 100644 --- a/change/@fluentui-react-tabs-7eea6ae2-201d-49d4-8749-15add0838235.json +++ b/change/@fluentui-react-tabs-7eea6ae2-201d-49d4-8749-15add0838235.json @@ -1,6 +1,6 @@ { "type": "prerelease", - "comment": "fix(react-tabs): fix missing dependencies and lint warnings", + "comment": "fix missing dependencies and lint warnings", "packageName": "@fluentui/react-tabs", "email": "martinhochel@microsoft.com", "dependentChangeType": "patch" From 74d2ef83a68491d99f617c16a96a8f8be76bf30d Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Thu, 10 Mar 2022 13:30:18 +0100 Subject: [PATCH 19/20] fixup! Change files --- ...eact-provider-c610d38f-97b5-4686-ab4d-ec59b20d764a.json | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 change/@fluentui-react-provider-c610d38f-97b5-4686-ab4d-ec59b20d764a.json diff --git a/change/@fluentui-react-provider-c610d38f-97b5-4686-ab4d-ec59b20d764a.json b/change/@fluentui-react-provider-c610d38f-97b5-4686-ab4d-ec59b20d764a.json deleted file mode 100644 index f04acd6122d62..0000000000000 --- a/change/@fluentui-react-provider-c610d38f-97b5-4686-ab4d-ec59b20d764a.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "prerelease", - "comment": "fix(react-provider): fix lint issues", - "packageName": "@fluentui/react-provider", - "email": "martinhochel@microsoft.com", - "dependentChangeType": "patch" -} From 0bcc3bc5e25824ec274500d28e02077bfeb407e1 Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Thu, 10 Mar 2022 14:51:02 +0100 Subject: [PATCH 20/20] chore: dedupe eslint-plugin-import --- yarn.lock | 95 ++----------------------------------------------------- 1 file changed, 3 insertions(+), 92 deletions(-) diff --git a/yarn.lock b/yarn.lock index 58da173815e4a..820542e1d55a4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6705,7 +6705,7 @@ array.prototype.find@^2.1.0: define-properties "^1.1.3" es-abstract "^1.13.0" -array.prototype.flat@^1.2.1, array.prototype.flat@^1.2.3: +array.prototype.flat@^1.2.1: version "1.2.3" resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.2.3.tgz#0de82b426b0318dbfdb940089e38b043d37f6c7b" integrity sha512-gBlRZV0VSmfPIeWfuuy56XZMvbVfbEUnOXUvt3F/eUUUSyzlgLxhEX4YAEpxNAogRGehPSnfXyPtYyKAhkzQhQ== @@ -9153,11 +9153,6 @@ constants-browserify@^1.0.0: resolved "https://registry.yarnpkg.com/constants-browserify/-/constants-browserify-1.0.0.tgz#c20b96d8c617748aaf1c16021760cd27fcb8cb75" integrity sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U= -contains-path@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" - integrity sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo= - content-disposition@0.5.3, content-disposition@^0.5.2: version "0.5.3" resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.3.tgz#e130caf7e7279087c5616c2007d0485698984fbd" @@ -10565,14 +10560,6 @@ doctoc@^2.0.1: underscore "~1.12.1" update-section "~0.3.3" -doctrine@1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" - integrity sha1-N53Ocw9hZvds76TmcHoVmwLFpvo= - dependencies: - esutils "^2.0.2" - isarray "^1.0.0" - doctrine@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" @@ -11393,14 +11380,6 @@ eslint-config-prettier@8.3.0, eslint-config-prettier@^8.3.0: resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz#f7471b20b6fe8a9a9254cc684454202886a2dd7a" integrity sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew== -eslint-import-resolver-node@^0.3.4: - version "0.3.4" - resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.4.tgz#85ffa81942c25012d8231096ddf679c03042c717" - integrity sha512-ogtf+5AB/O+nM6DIeBUNr2fuT7ot9Qg/1harBfBtaP13ekEWFQEEMP94BCB7zaNW3gyY+8SHYF00rnqYwXKWOA== - dependencies: - debug "^2.6.9" - resolve "^1.13.1" - eslint-import-resolver-node@^0.3.6: version "0.3.6" resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz#4048b958395da89668252001dbd9eca6b83bacbd" @@ -11420,14 +11399,6 @@ eslint-import-resolver-typescript@2.5.0, eslint-import-resolver-typescript@^2.4. resolve "^1.20.0" tsconfig-paths "^3.9.0" -eslint-module-utils@^2.6.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.6.0.tgz#579ebd094f56af7797d19c9866c9c9486629bfa6" - integrity sha512-6j9xxegbqe8/kZY8cYpcp0xhbK0EgJlg3g9mib3/miLaExuuwc3n5UEfSnU6hWMbT0FAYVvDbL9RrRgpUeQIvA== - dependencies: - debug "^2.6.9" - pkg-dir "^2.0.0" - eslint-module-utils@^2.7.2: version "2.7.3" resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz#ad7e3a10552fdd0642e1e55292781bd6e34876ee" @@ -11461,7 +11432,7 @@ eslint-plugin-es@^3.0.0: eslint-utils "^2.0.0" regexpp "^3.0.0" -eslint-plugin-import@2.25.4: +eslint-plugin-import@2.25.4, eslint-plugin-import@^2.22.1: version "2.25.4" resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.25.4.tgz#322f3f916a4e9e991ac7af32032c25ce313209f1" integrity sha512-/KJBASVFxpu0xg1kIBn9AUa8hQVnszpwgE7Ld0lKAlx7Ie87yzEzCgSkekt+le/YVhiaosO4Y14GDAOc41nfxA== @@ -11480,25 +11451,6 @@ eslint-plugin-import@2.25.4: resolve "^1.20.0" tsconfig-paths "^3.12.0" -eslint-plugin-import@^2.22.1: - version "2.22.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz#0896c7e6a0cf44109a2d97b95903c2bb689d7702" - integrity sha512-8K7JjINHOpH64ozkAhpT3sd+FswIZTfMZTjdx052pnWrgRCVfp8op9tbjpAk3DdUeI/Ba4C8OjdC0r90erHEOw== - dependencies: - array-includes "^3.1.1" - array.prototype.flat "^1.2.3" - contains-path "^0.1.0" - debug "^2.6.9" - doctrine "1.5.0" - eslint-import-resolver-node "^0.3.4" - eslint-module-utils "^2.6.0" - has "^1.0.3" - minimatch "^3.0.4" - object.values "^1.1.1" - read-pkg-up "^2.0.0" - resolve "^1.17.0" - tsconfig-paths "^3.9.0" - eslint-plugin-jest@23.20.0, eslint-plugin-jest@^23.13.2: version "23.20.0" resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-23.20.0.tgz#e1d69c75f639e99d836642453c4e75ed22da4099" @@ -17515,16 +17467,6 @@ load-json-file@^1.0.0, load-json-file@^1.1.0: pinkie-promise "^2.0.0" strip-bom "^2.0.0" -load-json-file@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" - integrity sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg= - dependencies: - graceful-fs "^4.1.2" - parse-json "^2.2.0" - pify "^2.0.0" - strip-bom "^3.0.0" - load-json-file@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b" @@ -20556,13 +20498,6 @@ path-type@^1.0.0: pify "^2.0.0" pinkie-promise "^2.0.0" -path-type@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" - integrity sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM= - dependencies: - pify "^2.0.0" - path-type@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" @@ -20675,13 +20610,6 @@ pkg-conf@^1.1.2: object-assign "^4.0.1" symbol "^0.2.1" -pkg-dir@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b" - integrity sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s= - dependencies: - find-up "^2.1.0" - pkg-dir@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-3.0.0.tgz#2749020f239ed990881b1f71210d51eb6523bea3" @@ -21971,14 +21899,6 @@ read-pkg-up@^1.0.1: find-up "^1.0.0" read-pkg "^1.0.0" -read-pkg-up@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" - integrity sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4= - dependencies: - find-up "^2.0.0" - read-pkg "^2.0.0" - read-pkg-up@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-3.0.0.tgz#3ed496685dba0f8fe118d0691dc51f4a1ff96f07" @@ -21996,15 +21916,6 @@ read-pkg@^1.0.0: normalize-package-data "^2.3.2" path-type "^1.0.0" -read-pkg@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8" - integrity sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg= - dependencies: - load-json-file "^2.0.0" - normalize-package-data "^2.3.2" - path-type "^2.0.0" - read-pkg@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389" @@ -22686,7 +22597,7 @@ resolve@1.15.1: dependencies: path-parse "^1.0.6" -resolve@^1.1.6, resolve@^1.1.7, resolve@^1.10.0, resolve@^1.11.0, resolve@^1.11.1, resolve@^1.12.0, resolve@^1.13.1, resolve@^1.14.2, resolve@^1.17.0, resolve@^1.18.1, resolve@^1.19.0, resolve@^1.3.2, resolve@^1.4.0, resolve@^1.7.1, resolve@^1.9.0: +resolve@^1.1.6, resolve@^1.1.7, resolve@^1.10.0, resolve@^1.11.0, resolve@^1.11.1, resolve@^1.12.0, resolve@^1.14.2, resolve@^1.17.0, resolve@^1.18.1, resolve@^1.19.0, resolve@^1.3.2, resolve@^1.4.0, resolve@^1.7.1, resolve@^1.9.0: version "1.20.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.20.0.tgz#629a013fb3f70755d6f0b7935cc1c2c5378b1975" integrity sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==