Skip to content

fix: ESlint config #630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/lint-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:
uses: MetaMask/action-checkout-and-setup@v1
with:
is-high-risk-environment: false
- name: Setup
# The Tailwind Prettier plugin requires the Tailwind preset to be built, as the plugin depends on the configuration provided by the preset for linting to function correctly.
run: yarn workspace @metamask/design-system-tailwind-preset build
Comment on lines +39 to +41
Copy link
Contributor Author

@georgewrmarshall georgewrmarshall May 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This update to our linting step is required for ensuring that the Tailwind Prettier plugin operates correctly. By running yarn workspace @metamask/design-system-tailwind-preset build, we ensure that the Tailwind preset is built and its configuration is available. Without this step, the Tailwind Prettier plugin would fail to lint properly since it relies on the preset's configuration to validate styles accurately.

Without this update our CI will fail at the linting step. yarn lint will also fail locally if the tailwind preset is not built.

Screenshot 2025-05-12 at 4 03 40 PM

- run: yarn lint
- name: Require clean working directory
shell: bash
Expand Down
35 changes: 0 additions & 35 deletions apps/storybook-react-native/.eslintrc.js

This file was deleted.

1 change: 0 additions & 1 deletion apps/storybook-react-native/.storybook/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as SystemUI from 'expo-system-ui';
import './config';
import { getStorybookUI } from '@storybook/react-native';
import registerRootComponent from 'expo/build/launch/registerRootComponent';
Expand Down
3 changes: 2 additions & 1 deletion apps/storybook-react/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import path, { join, dirname } from 'path';
/**
* This function is used to resolve the absolute path of a package.
* It is needed in projects that are set up within a monorepo.
*
* @param value
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Comment on lines +7 to -8
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lint fix: adding jsdocs and removing old rule

function getAbsolutePath(value: string): any {
return dirname(require.resolve(join(value, 'package.json')));
}
Expand Down
7 changes: 5 additions & 2 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@

## Linting

Run `yarn lint` to lint all files and show possible violations.
[ESLint](https://eslint.org) v9 (via [MetaMask's shared ESLint configurations](https://github.com/MetaMask/eslint-config)) is used to check for code quality issues, and [Prettier](https://prettier.io/docs/en/) is used to format files.

Run `yarn lint:fix` to fix any automatically fixable violations.
If you need to customize the behavior of ESLint, see `eslint.config.mjs` in the root.

- Run `yarn lint` to lint all files and show possible violations across the monorepo.
- Run `yarn lint:fix` to fix any automatically fixable violations.
Comment on lines -24 to +29
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updating documentation


## Performing operations across the monorepo

Expand Down
136 changes: 136 additions & 0 deletions eslint-warning-thresholds.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created to ensure we aren't introducing more eslint violations thanks to @mcmire's implementation in Core's eslint fix PR MetaMask/core#5132

"packages/design-system-react-native/global.d.ts": {
"@typescript-eslint/naming-convention": 1
},
"packages/design-system-react-native/src/components/BadgeCount/BadgeCount.test.tsx": {
"jest/prefer-strict-equal": 1
},
"packages/design-system-react-native/src/components/BadgeIcon/BadgeIcon.test.tsx": {
"jest/prefer-strict-equal": 1
},
"packages/design-system-react-native/src/components/BadgeWrapper/BadgeWrapper.tsx": {
"@typescript-eslint/no-unused-vars": 1
},
"packages/design-system-react-native/src/components/Button/Button.test.tsx": {
"no-empty-function": 1
},
"packages/design-system-react-native/src/types/index.ts": {
"@typescript-eslint/no-shadow": 4
},
"packages/design-system-react/global.d.ts": {
"@typescript-eslint/naming-convention": 1
},
"packages/design-system-react/scripts/create-component/create-component.test.ts": {
"jest/no-conditional-in-test": 2
},
"packages/design-system-react/scripts/generate-icons-index.test.ts": {
"@typescript-eslint/no-base-to-string": 1,
"@typescript-eslint/no-shadow": 1
},
"packages/design-system-react/src/components/AvatarAccount/AvatarAccount.tsx": {
"import-x/no-named-as-default-member": 1
},
"packages/design-system-react/src/components/AvatarBase/AvatarBase.tsx": {
"import-x/no-named-as-default-member": 1
},
"packages/design-system-react/src/components/AvatarFavicon/AvatarFavicon.tsx": {
"import-x/no-named-as-default-member": 1
},
"packages/design-system-react/src/components/AvatarIcon/AvatarIcon.test.tsx": {
"import-x/no-named-as-default-member": 1
},
"packages/design-system-react/src/components/AvatarIcon/AvatarIcon.tsx": {
"import-x/no-named-as-default-member": 1
},
"packages/design-system-react/src/components/AvatarNetwork/AvatarNetwork.tsx": {
"import-x/no-named-as-default-member": 1
},
"packages/design-system-react/src/components/AvatarToken/AvatarToken.tsx": {
"import-x/no-named-as-default-member": 1
},
"packages/design-system-react/src/components/BadgeCount/BadgeCount.tsx": {
"import-x/no-named-as-default-member": 1
},
"packages/design-system-react/src/components/BadgeIcon/BadgeIcon.test.tsx": {
"import-x/no-named-as-default-member": 1
},
"packages/design-system-react/src/components/BadgeIcon/BadgeIcon.tsx": {
"import-x/no-named-as-default-member": 1
},
"packages/design-system-react/src/components/BadgeNetwork/BadgeNetwork.tsx": {
"import-x/no-named-as-default-member": 1
},
"packages/design-system-react/src/components/BadgeStatus/BadgeStatus.test.tsx": {
"import-x/no-named-as-default-member": 1
},
"packages/design-system-react/src/components/BadgeStatus/BadgeStatus.tsx": {
"import-x/no-named-as-default-member": 1
},
"packages/design-system-react/src/components/BadgeWrapper/BadgeWrapper.tsx": {
"import-x/no-named-as-default-member": 1
},
"packages/design-system-react/src/components/Button/Button.test.tsx": {
"import-x/no-named-as-default-member": 3
},
"packages/design-system-react/src/components/Button/Button.tsx": {
"import-x/no-named-as-default-member": 1
},
"packages/design-system-react/src/components/Button/variants/ButtonPrimary/ButtonPrimary.tsx": {
"import-x/no-named-as-default-member": 1
},
"packages/design-system-react/src/components/Button/variants/ButtonSecondary/ButtonSecondary.tsx": {
"import-x/no-named-as-default-member": 1
},
"packages/design-system-react/src/components/Button/variants/ButtonTertiary/ButtonTertiary.test.tsx": {
"import-x/no-named-as-default-member": 1
},
"packages/design-system-react/src/components/Button/variants/ButtonTertiary/ButtonTertiary.tsx": {
"import-x/no-named-as-default-member": 1
},
"packages/design-system-react/src/components/ButtonBase/ButtonBase.tsx": {
"import-x/no-named-as-default-member": 1
},
"packages/design-system-react/src/components/ButtonIcon/ButtonIcon.tsx": {
"import-x/no-named-as-default-member": 1
},
"packages/design-system-react/src/components/Icon/template.test.ts": {
"@typescript-eslint/no-base-to-string": 1,
"jest/no-conditional-in-test": 1
},
"packages/design-system-react/src/components/TextButton/TextButton.tsx": {
"import-x/no-named-as-default-member": 1
},
"packages/design-system-react/src/components/temp-components/Jazzicon/Jazzicon.utilities.ts": {
"jsdoc/require-param-description": 3,
"jsdoc/require-returns": 3
},
"packages/design-system-react/src/types/index.ts": {
"@typescript-eslint/no-shadow": 7
},
"packages/design-system-tailwind-preset/src/colors.test.ts": {
"jest/no-conditional-in-test": 1
},
"packages/design-system-tailwind-preset/src/index.test.ts": {
"jest/no-conditional-in-test": 3
},
"packages/design-system-tailwind-preset/src/typography.test.ts": {
"jest/no-conditional-in-test": 1
},
"packages/design-system-twrnc-preset/src/Theme/Theme.providers.tsx": {
"no-empty-function": 2
},
"packages/design-tokens/src/js/brandColor/brandColor.test.ts": {
"jest/no-conditional-in-test": 2
},
"packages/design-tokens/stories/Typography.stories.tsx": {
"@typescript-eslint/no-unused-vars": 2
},
"scripts/create-package/utils.test.ts": {
"@typescript-eslint/no-unsafe-enum-comparison": 3,
"import-x/no-named-as-default-member": 2,
"jest/no-conditional-in-test": 1
},
"scripts/create-package/utils.ts": {
"@typescript-eslint/no-unsafe-enum-comparison": 5
}
}
Loading
Loading