-
-
Notifications
You must be signed in to change notification settings - Fork 4
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
fix: ESlint config #630
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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'))); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updating documentation |
||
|
||
## Performing operations across the monorepo | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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.