Skip to content

Commit

Permalink
Use biome for linting + formatting code (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
majakomel committed Feb 20, 2024
1 parent a10bb8a commit 05f7487
Show file tree
Hide file tree
Showing 18 changed files with 168 additions and 1,357 deletions.
5 changes: 0 additions & 5 deletions .eslintignore

This file was deleted.

72 changes: 0 additions & 72 deletions .eslintrc.json

This file was deleted.

7 changes: 0 additions & 7 deletions .npmignore

This file was deleted.

1 change: 0 additions & 1 deletion .prettierignore

This file was deleted.

6 changes: 0 additions & 6 deletions .prettierrc

This file was deleted.

7 changes: 5 additions & 2 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import type { StorybookConfig } from '@storybook/react-vite'

const config: StorybookConfig = {
stories: ['../stories/**/*.mdx', '../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
stories: [
'../stories/**/*.mdx',
'../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)',
],
staticDirs: ['../src/fonts/'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-onboarding',
'@storybook/addon-interactions',
'@storybook/addon-mdx-gfm'
'@storybook/addon-mdx-gfm',
],
framework: {
name: '@storybook/react-vite',
Expand Down
25 changes: 25 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"formatter": {
"indentStyle": "space",
"indentWidth": 2
},
"javascript": {
"formatter": {
"semicolons": "asNeeded",
"quoteStyle": "single"
}
},
"files": {
"ignore": ["animations/*.json", "dist", "node_modules"]
}
}
14 changes: 1 addition & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@babel/preset-env": "^7.23.9",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@biomejs/biome": "1.5.3",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",
Expand All @@ -45,27 +46,14 @@
"@types/react-dom": "^18.2.19",
"@types/styled-system": "^5.1.22",
"@types/styled-system__css": "^5.0.21",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"babel-plugin-inline-react-svg": "^2.0.2",
"babel-plugin-styled-components": "^2.1.4",
"cheerio": "^1.0.0-rc.12",
"eslint": "^8.56.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.9.0",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.33.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-storybook": "^0.6.15",
"eslint-watch": "^8.0.0",
"gh-pages": "^6.1.1",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-styled-components": "^7.1.1",
"jest-svg-transformer": "^1.0.0",
"prettier": "^3.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^5.0.1",
Expand Down
12 changes: 9 additions & 3 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const mainBundle = {
format: 'esm',
interop: 'auto',
sourcemap: true,
}
},
],
plugins: [
del({
Expand All @@ -42,7 +42,13 @@ const mainBundle = {
commonjs(),
typescript({
tsconfig: './tsconfig.json',
exclude: ['node_modules', 'dist', '**/__test__/*', '**/__mocks__/*', '**/stories/*'],
exclude: [
'node_modules',
'dist',
'**/__test__/*',
'**/__mocks__/*',
'**/stories/*',
],
}),
copy({
targets: [
Expand Down Expand Up @@ -74,7 +80,7 @@ const iconBundle = {
format: 'esm',
interop: 'auto',
sourcemap: true,
}
},
],
plugins: [
peerDepsExternal(),
Expand Down
2 changes: 1 addition & 1 deletion src/__test__/Icons.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ describe('Icons', () => {
</Flex>
)
})}
</div>
</div>,
)

for (let i = 0; i < Object.keys(icons).length; i += 1) {
Expand Down
1 change: 0 additions & 1 deletion src/bin/create-icons.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* global require, __dirname */
/* eslint-disable no-console */
// Inspired from: https://github.com/react-icons/react-icons and changed

const fs = require('fs')
Expand Down
5 changes: 2 additions & 3 deletions src/components/MultiSelectCreatable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import React, {
KeyboardEventHandler,
useEffect,
} from 'react'
import { MultiValue } from 'react-select'
import CreatableSelect from 'react-select/creatable'
import { SelectProps as SP } from 'types'
import { MultiValue } from 'react-select'
import theme from '../theme'
import { getMarginProps, omitMarginProps } from '../utils'
import Box from './Box'
import Text from './Text'
import ErrorMessage from './ErrorMessage'
import Text from './Text'

interface Option {
readonly label: string
Expand Down Expand Up @@ -51,7 +51,6 @@ const MultiSelectCreatable = forwardRef(

const handleKeyDown: KeyboardEventHandler = (event) => {
if (!inputValue) return
// eslint-disable-next-line default-case
switch (event.key) {
case 'Enter':
case 'Tab':
Expand Down
12 changes: 6 additions & 6 deletions src/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const theme = {
outline: '2px solid',
outlineColor: 'primary',
outlineOffset: '1px',
}
},
},
default: {
color: 'white',
Expand Down Expand Up @@ -238,17 +238,17 @@ const theme = {
},
small: {
fontSize: 14,
lineHeight: "20px",
lineHeight: '20px',
// height: 32,
px: 3,
py: "4px",
py: '4px',
'.icon': {
fontSize: 20,
},
},
medium: {
fontSize: 1,
lineHeight: "22px",
lineHeight: '22px',
// height: 40,
px: 24,
py: 7,
Expand All @@ -258,7 +258,7 @@ const theme = {
},
large: {
fontSize: 2,
lineHeight: "26px",
lineHeight: '26px',
// height: 48,
px: 4,
py: 9,
Expand All @@ -268,7 +268,7 @@ const theme = {
},
xLarge: {
fontSize: 2,
lineHeight: "26px",
lineHeight: '26px',
// height: 60,
px: 5,
py: 15,
Expand Down
1 change: 0 additions & 1 deletion src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { BoxKnownProps } from 'types'

// const dsProps = [...systemProps, 'sx', 'variant']
Expand Down
18 changes: 15 additions & 3 deletions stories/Checkbox.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,21 @@ export const Default: Story = {
export const Example = () => {
return (
<Box width="200px">
<Checkbox mb={2} name="checkbox1" label="Checkbox1 checkbox1 checkbox1 checkbox1 checkbox1" />
<Checkbox mb={4} name="checkbox2" label="Checkbox2 checkbox2 checkbox2 checkbox2 checkbox2" />
<Checkbox name="checkbox3" label="Checkbox3 checkbox3 checkbox3 checkbox3 checkbox3" reverse />
<Checkbox
mb={2}
name="checkbox1"
label="Checkbox1 checkbox1 checkbox1 checkbox1 checkbox1"
/>
<Checkbox
mb={4}
name="checkbox2"
label="Checkbox2 checkbox2 checkbox2 checkbox2 checkbox2"
/>
<Checkbox
name="checkbox3"
label="Checkbox3 checkbox3 checkbox3 checkbox3 checkbox3"
reverse
/>
</Box>
)
}
2 changes: 1 addition & 1 deletion stories/OONIIcons.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const Default = {
render: () => (
<Flex flexWrap="wrap">
{Object.keys(OONIIcons).map((k) => {
const Icon = OONIIcons[k as IconType]
const Icon = OONIIcons[k as IconType]
return (
<Box key={k} width={1 / 5} pb={3}>
<Icon size={50} />
Expand Down
6 changes: 3 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vite'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
});
})
Loading

0 comments on commit 05f7487

Please sign in to comment.