-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
chore: linting fixes #261
chore: linting fixes #261
Changes from all commits
031edad
6da1a97
b4dd256
ba39d3f
4fb1b7e
425d17f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,10 +21,11 @@ | |
"create-component:react": "yarn workspace @metamask/design-system-react create-component", | ||
"create-package": "ts-node scripts/create-package", | ||
"lint": "yarn lint:eslint && yarn lint:misc --check && yarn constraints && yarn lint:dependencies", | ||
"lint:clear-cache": "rimraf .eslintcache", | ||
"lint:dependencies": "depcheck && yarn dedupe --check", | ||
"lint:dependencies:fix": "depcheck && yarn dedupe", | ||
"lint:eslint": "eslint . --cache --ext js,cjs,mjs,ts", | ||
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write && yarn constraints --fix && yarn lint:dependencies:fix", | ||
"lint:eslint": "eslint . --cache --ext js,cjs,mjs,ts,tsx", | ||
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. Added |
||
"lint:fix": "yarn lint:clear-cache && yarn lint:eslint --fix && yarn lint:misc --write && yarn constraints --fix && yarn lint:dependencies:fix", | ||
"lint:misc": "prettier '**/*.json' '**/*.md' '!**/CHANGELOG.old.md' '**/*.yml' '!.yarnrc.yml' '!merged-packages/**' --ignore-path .prettierignore", | ||
"prepack": "./scripts/prepack.sh", | ||
"prepare-preview-builds": "./scripts/prepare-preview-builds.sh", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module.exports = { | ||
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. Added This ESLint configuration extends the root config but adds browser-specific settings. The root ESLint config is Node.js-focused, so this configuration:
|
||
extends: ['../../.eslintrc.js'], | ||
env: { | ||
browser: true, | ||
node: false, | ||
}, | ||
rules: { | ||
'no-restricted-globals': 'off', | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['**/*.{ts,tsx}'], | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: ['./tsconfig.json'], | ||
}, | ||
}, | ||
], | ||
}; |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import React from 'react'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { action } from '@storybook/addon-actions'; | ||
import React from 'react'; | ||
|
||
import README from './README.mdx'; | ||
import { Text } from './Text'; | ||
import { | ||
TextVariant, | ||
|
@@ -11,7 +12,7 @@ import { | |
OverflowWrap, | ||
TextColor, | ||
} from './Text.types'; | ||
import README from './README.mdx'; | ||
|
||
const meta: Meta<typeof Text> = { | ||
title: 'React Components/Text', | ||
component: Text, | ||
|
@@ -167,7 +168,13 @@ export const AsChild: Story = { | |
<span>Text rendered as span</span> | ||
</Text> | ||
<Text asChild className="block"> | ||
<button type="button" onClick={action('button-clicked')}> | ||
<button | ||
type="button" | ||
onClick={() => { | ||
// eslint-disable-next-line no-alert, no-restricted-globals | ||
alert('button-clicked'); | ||
}} | ||
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. This was previously using storybook-actions but once we add it as a dev dependency it clashes with the @storybook/addon-actions version we can fix it in a subsequent PR |
||
> | ||
Text rendered as button | ||
</button> | ||
</Text> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,7 @@ | |
"devDependencies": { | ||
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. Adding missing dev dependency |
||
"@metamask/auto-changelog": "^3.4.4", | ||
"@metamask/design-system-react": "workspace:^", | ||
"@storybook/react": "^8.3.5", | ||
"@ts-bridge/cli": "^0.5.1", | ||
"@types/jest": "^27.4.1", | ||
"@types/node": "^16.18.54", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
import React from 'react'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { Text, TextColor } from '@metamask/design-system-react'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import React from 'react'; | ||
|
||
import README from './Shadows.mdx'; | ||
|
||
interface ShadowSwatchProps { | ||
type ShadowSwatchProps = { | ||
children: React.ReactNode; | ||
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. use type instead of interface |
||
className?: string; | ||
} | ||
}; | ||
|
||
const ShadowSwatch: React.FC<ShadowSwatchProps> = ({ | ||
children, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import React from 'react'; | ||
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 fixes |
||
|
||
import { lightTheme as lightThemeJS, darkTheme as darkThemeJS } from '../src'; | ||
import brandColor from '../src/figma/brandColors.json'; | ||
import { ColorSwatch, ColorSwatchGroup } from './components'; | ||
import README from './ThemeColors.mdx'; | ||
import { | ||
getCSSVariablesFromStylesheet, | ||
getContrastYIQ, | ||
getJSColors, | ||
useJsonColor, | ||
} from './test-utils'; | ||
import README from './ThemeColors.mdx'; | ||
|
||
export default { | ||
const meta = { | ||
title: 'Design Tokens/Color/Theme Colors', | ||
component: ColorSwatchGroup, | ||
parameters: { | ||
|
@@ -20,6 +20,8 @@ export default { | |
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
export const FigmaLightTheme = { | ||
render: () => { | ||
const { lightTheme } = useJsonColor(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
/* eslint-disable no-restricted-globals */ | ||
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 fixes and ignoring no-restriced-globals so we can get the CSS variables from the stylesheet for typography CSS variables |
||
|
||
import { Text } from '@metamask/design-system-react'; | ||
import type { StoryFn, Meta } from '@storybook/react'; | ||
import React from 'react'; | ||
import { StoryFn, Meta } from '@storybook/react'; | ||
import { typography } from '../src/js/typography'; | ||
|
||
import { fontSizes } from '../src/js/typography/fontSizes'; | ||
import { lineHeights } from '../src/js/typography/lineHeights'; | ||
import { typography } from '../src/js/typography'; | ||
import { fontFamilies } from '../src/js/typography/fontFamilies'; | ||
import { fontSizes } from '../src/js/typography/fontSizes'; | ||
import { fontWeights } from '../src/js/typography/fontWeights'; | ||
import { letterSpacing } from '../src/js/typography/letterSpacing'; | ||
|
||
import { Text } from '@metamask/design-system-react'; | ||
|
||
import { lineHeights } from '../src/js/typography/lineHeights'; | ||
import README from './Typography.mdx'; | ||
|
||
export default { | ||
const meta: Meta<typeof Text> = { | ||
title: 'Design Tokens/Typography/Typography', | ||
parameters: { | ||
docs: { | ||
page: README, | ||
}, | ||
}, | ||
} as Meta<typeof Text>; | ||
}; | ||
|
||
export default meta; | ||
export const FontFamily: StoryFn<typeof Text> = (...args) => { | ||
const styles = { | ||
displayMD: { | ||
|
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.
disabled a rule to make our eslintrc file more readable
Before
After