From e01468fd59e0e4eb4586d7e1b63cfbea3d14ac0f Mon Sep 17 00:00:00 2001 From: mainframev Date: Mon, 4 Sep 2023 17:20:17 +0200 Subject: [PATCH] chore: update @typescript-eslint and typescript chore: fix eslint errors after @typescript-eslint update chore: update dedent dep chore: include internal as a config into eslint and rise typescript ver chore: remove errors and warnings docs(eslint-plugin): update README.md Update packages/orbit-components/cypress/integration/index.tsx Co-authored-by: Daniel Sil chore: add allowImportingTsExtensions to tsconfig chore(InputSelect): rewrite type to interface chore(Stack): remove spaceAfter from Tablet story --- .eslintrc.cjs | 12 + docs/lib.es5.d.ts | 2 +- docs/src/components/Navbar/index.tsx | 3 - package.json | 11 +- .../.eslintrc.cjs | 17 +- .../eslint-plugin-orbit-components/README.md | 28 ++- .../jest.config.cjs | 3 +- .../package.json | 6 +- .../src/__tests__/buttonHasTitle.test.ts | 25 +- .../src/__tests__/defaultTheme.test.ts | 26 +- .../src/__tests__/isUniqueId.test.ts | 8 +- .../src/__tests__/noCustomColors.test.ts | 6 +- .../src/__tests__/noCustomTypography.test.ts | 12 +- .../__tests__/preferSingleDestructure.test.ts | 8 +- .../src/__tests__/rtlUtils.test.ts | 32 ++- .../src/__tests__/tsconfig.json | 9 - .../src/__tests__/unnecessaryText.test.ts | 45 ++-- .../src/__tests__/useClient.test.ts | 1 + .../src/__tests__/useRtl.test.ts | 20 +- .../src/configs/internal.ts | 1 + .../src/index.ts | 2 + .../src/ruleTester.ts | 15 +- .../src/rules/buttonHasTitle.ts | 97 +++++--- .../src/rules/defaultTheme.ts | 61 ++--- .../src/rules/noCustomColors.ts | 26 +- .../src/rules/noCustomTypography.ts | 30 ++- .../src/rules/preferSingleDestructure.ts | 39 +-- .../src/rules/rtlUtils.ts | 59 +++-- .../src/rules/uniqueId.ts | 34 ++- .../src/rules/unnecessaryText.ts | 41 +-- .../src/rules/useClient.ts | 3 +- .../src/rules/useRtl.ts | 37 +-- .../src/utils/detectOriginalOrbitName.ts | 7 +- .../src/utils/ruleCreator.ts | 2 +- .../tsconfig.json | 14 +- packages/orbit-components/.eslintrc.cjs | 4 +- .../orbit-components/config/fetchIcons.mts | 25 +- .../cypress/integration/index.tsx | 3 +- .../AirportIllustration.stories.tsx | 4 +- .../CallOutBanner/CallOutBanner.stories.tsx | 1 - .../src/Dialog/Dialog.stories.tsx | 1 - .../src/Illustration/Illustration.stories.tsx | 1 - .../src/InputField/InputField.stories.tsx | 1 - .../orbit-components/src/InputFile/index.tsx | 2 +- .../src/InputSelect/helpers.ts | 10 +- .../src/Modal/Modal.stories.tsx | 1 - .../src/OrbitProvider/index.tsx | 1 + .../hooks/useLockScrolling/lock-scrolling.ts | 1 - .../components/ButtonPrimitiveContent.tsx | 33 +++ .../InputField/InputField.stories.tsx | 1 - packages/orbit-components/tsconfig.json | 7 +- packages/orbit-design-tokens/tsconfig.json | 3 +- packages/orbit-tracking/tsconfig.json | 3 +- scripts/checks.mts | 2 +- tsconfig.base.json | 3 +- yarn.lock | 234 ++++++++++++------ 56 files changed, 670 insertions(+), 413 deletions(-) delete mode 100644 packages/eslint-plugin-orbit-components/src/__tests__/tsconfig.json mode change 100755 => 100644 packages/eslint-plugin-orbit-components/src/ruleTester.ts create mode 100644 packages/orbit-components/src/primitives/ButtonPrimitive/components/ButtonPrimitiveContent.tsx diff --git a/.eslintrc.cjs b/.eslintrc.cjs index f8ef95ec53..2de949407b 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -5,6 +5,7 @@ const CONFIGS = [ "plugin:react-hooks/recommended", "plugin:prettier/recommended", "plugin:tailwindcss/recommended", + "plugin:orbit-components/internal", ]; module.exports = { @@ -48,6 +49,8 @@ module.exports = { "no-await-in-loop": "off", "tailwindcss/classnames-order": "off", "tailwindcss/no-custom-classname": [1, { whitelist: ["(orbit\\-).*", "chromatic-ignore"] }], + // to improve performance locally + // https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/FAQ.md#my-linting-feels-really-slow ...(!process.env.CI ? { "import/no-named-as-default": "off", @@ -72,9 +75,12 @@ module.exports = { "plugin:@typescript-eslint/recommended", "prettier", ], + plugins: ["@typescript-eslint"], + parser: "@typescript-eslint/parser", parserOptions: { extraFileExtensions: [".mts"], tsconfigRootDir: __dirname, + // https://typescript-eslint.io/linting/typed-linting/ project: [ "./tsconfig.scripts.json", "./tsconfig.json", @@ -98,7 +104,13 @@ module.exports = { "@typescript-eslint/consistent-type-definitions": ["error", "interface"], "@typescript-eslint/no-empty-interface": "off", "@typescript-eslint/prefer-readonly-parameter-types": "off", + "@typescript-eslint/no-unsafe-argument": "warn", + "@typescript-eslint/no-explicit-any": "warn", + "@typescript-eslint/no-duplicate-enum-values": "warn", "@typescript-eslint/no-empty-function": "off", + "@typescript-eslint/no-floating-promises": "off", + "@typescript-eslint/no-misused-promises": "off", + "@typescript-eslint/no-unsafe-call": "off", "no-unused-vars": "off", "@typescript-eslint/no-unused-vars": [ "error", diff --git a/docs/lib.es5.d.ts b/docs/lib.es5.d.ts index d94feb4496..f83319e2e0 100644 --- a/docs/lib.es5.d.ts +++ b/docs/lib.es5.d.ts @@ -21,5 +21,5 @@ interface Array { * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. */ - filter(predicate: BooleanConstructor, thisArg?: any): Exclude[]; + filter(predicate: BooleanConstructor, thisArg?: unknown): Exclude[]; } diff --git a/docs/src/components/Navbar/index.tsx b/docs/src/components/Navbar/index.tsx index d63d1220f8..bd7279a43c 100644 --- a/docs/src/components/Navbar/index.tsx +++ b/docs/src/components/Navbar/index.tsx @@ -223,7 +223,6 @@ const Navbar = ({ location, docNavigation }: Props) => { role="tab" aria-selected={activeTab === "navigation"} aria-controls="navbar-tabpanel-navigation" - id="navbar-tab-navigation" type="button" onClick={() => setActiveTab("navigation")} > @@ -233,7 +232,6 @@ const Navbar = ({ location, docNavigation }: Props) => { role="tab" aria-selected={activeTab === "bookmarks"} aria-controls="navbar-tabpanel-bookmarks" - id="navbar-tab-bookmarks" type="button" onClick={() => setActiveTab("bookmarks")} > @@ -276,7 +274,6 @@ const Navbar = ({ location, docNavigation }: Props) => {