From 8722596e561b57decfe9aa79121db844737102ff Mon Sep 17 00:00:00 2001 From: Martin Hochel Date: Thu, 10 Mar 2022 15:57:13 +0100 Subject: [PATCH] fix(eslint-plugin): make import/no-extraneous-dependencies work for react config (#21924) * fix(eslint-plugin): make import/no-extraneous-dependencies work for react config * Change files * chore: remove unused import-resolver-ts eslint plugin * fix(react-conformance-griffel): add react-conformance missing dependency * chore(pr-deploy-site): make lint work after import resolver changes * fix(react-avatar): fix missing dependencies * fix(react-accordion): fix missing dependencies * fix(react-tabs): fix missing dependencies and lint warnings * fix(vr-tests-react-components): fix missing dependencies * chore(cra-template): remove import/resolve from lint config * chore(react-components): fix lint issues exposed by import/no-extrenaus-dependency rule * feat(scripts): add file rename while copy behaviour to copy just-task * fixup! fix(eslint-plugin): make import/no-extraneous-dependencies work for react config * fixup! fixup! fix(eslint-plugin): make import/no-extraneous-dependencies work for react config * fixup! fixup! fixup! fix(eslint-plugin): make import/no-extraneous-dependencies work for react config * fixup! fixup! fixup! fixup! fix(eslint-plugin): make import/no-extraneous-dependencies work for react config * fixup! fix(react-conformance-griffel): add react-conformance missing dependency * Apply suggestions from code review Co-authored-by: Oleksandr Fediashov * fixup! Change files * chore: dedupe eslint-plugin-import Co-authored-by: Oleksandr Fediashov --- apps/pr-deploy-site/.eslintrc.json | 7 - apps/pr-deploy-site/package.json | 6 +- apps/pr-deploy-site/tsconfig.json | 8 + apps/vr-tests-react-components/package.json | 3 + ...-1441b2ce-805e-4783-b54d-d0dc1405794e.json | 7 + ...-6b96c0dd-b3e9-49e3-9668-83ccf7e28620.json | 7 + ...-a88290b3-b03a-40b9-a8cc-d24ab80c5071.json | 7 + ...-c63280cc-55c6-4360-aa31-5ced2bd439ae.json | 7 + ...-6b800570-deea-41a1-a565-0987a0589347.json | 7 + ...-7dbc04a7-7597-4437-a96b-cbde034b0fe0.json | 7 + ...-7eea6ae2-201d-49d4-8749-15add0838235.json | 7 + package.json | 13 +- packages/cra-template/.eslintrc.json | 7 - packages/cra-template/package.json | 3 +- packages/cra-template/tsconfig.json | 8 + packages/eslint-plugin/src/configs/react.js | 69 ++++----- packages/react-accordion/package.json | 1 + packages/react-avatar/package.json | 1 + .../react-components/config/pre-copy.json | 2 +- .../{package.json => package.json__tmpl__} | 0 .../src/unstable/tsconfig.json | 4 - .../react-conformance-griffel/package.json | 9 +- packages/react-tabs/package.json | 1 + .../src/components/Tab/renderTab.tsx | 1 - .../react-tabs/src/components/Tab/useTab.ts | 1 - .../src/components/Tab/useTabStyles.ts | 1 - .../src/components/TabList/renderTabList.tsx | 1 - .../src/components/TabList/useTabList.ts | 1 - .../components/TabList/useTabListStyles.ts | 1 - scripts/tasks/copy.ts | 50 ++++-- yarn.lock | 145 +++++++----------- 31 files changed, 221 insertions(+), 171 deletions(-) create mode 100644 apps/pr-deploy-site/tsconfig.json 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-conformance-griffel-7dbc04a7-7597-4437-a96b-cbde034b0fe0.json create mode 100644 change/@fluentui-react-tabs-7eea6ae2-201d-49d4-8749-15add0838235.json create mode 100644 packages/cra-template/tsconfig.json 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/apps/pr-deploy-site/.eslintrc.json b/apps/pr-deploy-site/.eslintrc.json index 39e08c0d62209a..ac81a128fc7689 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 e7c77a6e4f388f..1358952b5e2e3e 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 00000000000000..05b3c792324e38 --- /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/apps/vr-tests-react-components/package.json b/apps/vr-tests-react-components/package.json index 0066174fa29ec5..06065dcd367f06 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", 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 00000000000000..f20ec14c08bdef --- /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 00000000000000..8525468131ca6b --- /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 00000000000000..0c0a74a4d58f2e --- /dev/null +++ b/change/@fluentui-react-accordion-a88290b3-b03a-40b9-a8cc-d24ab80c5071.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "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 new file mode 100644 index 00000000000000..625eed59b787c5 --- /dev/null +++ b/change/@fluentui-react-avatar-c63280cc-55c6-4360-aa31-5ced2bd439ae.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "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 new file mode 100644 index 00000000000000..5564405c8077fc --- /dev/null +++ b/change/@fluentui-react-components-6b800570-deea-41a1-a565-0987a0589347.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "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-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 00000000000000..37916659eda227 --- /dev/null +++ b/change/@fluentui-react-conformance-griffel-7dbc04a7-7597-4437-a96b-cbde034b0fe0.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "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 new file mode 100644 index 00000000000000..6e98650d420eb1 --- /dev/null +++ b/change/@fluentui-react-tabs-7eea6ae2-201d-49d4-8749-15add0838235.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "fix missing dependencies and lint warnings", + "packageName": "@fluentui/react-tabs", + "email": "martinhochel@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/package.json b/package.json index 49769501c4beff..c57469a10e5d8c 100644 --- a/package.json +++ b/package.json @@ -90,6 +90,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", @@ -176,10 +177,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", @@ -418,6 +419,14 @@ "ci-info", "node-fetch" ] + }, + { + "packages": [ + "@fluentui/react-conformance-griffel" + ], + "dependencies": [ + "@fluentui/react-conformance" + ] } ] } diff --git a/packages/cra-template/.eslintrc.json b/packages/cra-template/.eslintrc.json index 8a66911c1ed56b..efb1ca6d6e8af1 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 e1341137b8e55b..5d2137e6070d42 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 00000000000000..d0cebca8137d02 --- /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"] +} diff --git a/packages/eslint-plugin/src/configs/react.js b/packages/eslint-plugin/src/configs/react.js index 984800edbf8877..8c34586c924e77 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,8 @@ const getOverrides = () => [ { files: [...configHelpers.devDependenciesFiles], rules: { - 'import/no-extraneous-dependencies': ['error', { packageDir: ['.', gitRoot] }], + // TODO: https://github.com/microsoft/fluentui/issues/21999 + 'import/no-extraneous-dependencies': 'off', }, }, ]; diff --git a/packages/react-accordion/package.json b/packages/react-accordion/package.json index 9138411ed0cc04..7afbfa6a15c2cb 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", diff --git a/packages/react-avatar/package.json b/packages/react-avatar/package.json index 85d71e980e072a..25469f86e25d0e 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" diff --git a/packages/react-components/config/pre-copy.json b/packages/react-components/config/pre-copy.json index ef3caf24f777ae..840125f4b3b702 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 4fe490521de8d0..00000000000000 --- a/packages/react-components/src/unstable/tsconfig.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "include": ["index.ts"] -} diff --git a/packages/react-conformance-griffel/package.json b/packages/react-conformance-griffel/package.json index 8d7415188f2da8..d48756a229c617 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.11.0", "@griffel/react": "1.0.0", "tslib": "^2.1.0" }, diff --git a/packages/react-tabs/package.json b/packages/react-tabs/package.json index e113266683f232..9eeb03459f187c 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 a487c2ac063bd1..338bad00531255 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 3395923eed53c9..e6878cb512dc5a 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 b7186ac07a0254..354870957e1b9b 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 b93f0b20cbafb9..b2db464f6ec79c 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 99191b94588052..660fd7b039a106 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 1f2e80e952aac5..94ab9f5376ef37 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; diff --git a/scripts/tasks/copy.ts b/scripts/tasks/copy.ts index 6e1c6efc163273..7a86709ae79bcb 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'); } } diff --git a/yarn.lock b/yarn.lock index ed5caf10ecc210..901907e0a75ae2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6773,7 +6773,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== @@ -6781,6 +6781,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" @@ -9225,11 +9234,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" @@ -10129,7 +10133,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== @@ -10621,14 +10625,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" @@ -11411,32 +11407,32 @@ 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== +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 "^2.6.9" - resolve "^1.13.1" + debug "^3.2.7" + resolve "^1.20.0" -eslint-import-resolver-typescript@2.4.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== +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.1.1" - glob "^7.1.6" + debug "^4.3.1" + glob "^7.1.7" is-glob "^4.0.1" - resolve "^1.17.0" + 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== +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 "^2.6.9" - pkg-dir "^2.0.0" + 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" @@ -11463,24 +11459,24 @@ 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: - 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== +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== dependencies: - array-includes "^3.1.1" - array.prototype.flat "^1.2.3" - contains-path "^0.1.0" + array-includes "^3.1.4" + array.prototype.flat "^1.2.5" debug "^2.6.9" - doctrine "1.5.0" - eslint-import-resolver-node "^0.3.4" - eslint-module-utils "^2.6.0" + 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.1" - read-pkg-up "^2.0.0" - resolve "^1.17.0" - tsconfig-paths "^3.9.0" + object.values "^1.1.5" + resolve "^1.20.0" + tsconfig-paths "^3.12.0" eslint-plugin-jest@23.20.0, eslint-plugin-jest@^23.13.2: version "23.20.0" @@ -17442,16 +17438,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" @@ -20468,13 +20454,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" @@ -20587,13 +20566,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" @@ -21857,14 +21829,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" @@ -21882,15 +21846,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" @@ -22565,7 +22520,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== @@ -25216,6 +25171,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"