Skip to content
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

Setup Prettier and Husky #52

Merged
merged 14 commits into from
Aug 30, 2023
Merged
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore artifacts:
dist
coverage

13 changes: 7 additions & 6 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"semi": true,
"tabWidth": 2,
"printWidth": 100,
"singleQuote": true,
"trailingComma": "none",
"jsxBracketSameLine": true
"semi": true,
"tabWidth": 2,
Copy link
Member

Choose a reason for hiding this comment

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

"printWidth": 100,
"singleQuote": true,
"trailingComma": "none",
"jsxBracketSameLine": true,
"plugins": ["prettier-plugin-organize-imports"]
}
18 changes: 15 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,25 @@
"@changesets/cli": "^2.26.2"
},
"devDependencies": {
"prettier": "^3.0.2"
"eslint": "^8.48.0",
"husky": "^8.0.3",
"prettier": "^3.0.2",
"prettier-plugin-organize-imports": "^3.2.3"
},
"scripts": {
"build-all": "yarn workspaces run build",
"format": "prettier --write \"**/*.{ts,tsx,md}\" --config ./.prettierrc",
"format:check": "prettier --check \"**/*.{ts,tsx,md}\" --config ./.prettierrc",
"format:write": "prettier --write \"**/*.{ts,tsx,md}\" --config ./.prettierrc",
"changeset": "changeset",
"version-packages": "changeset version",
"release": "yarn run build-all && changeset publish"
"release": "yarn run build-all && changeset publish",
"postinstall": "husky install",
"prepack": "pinst --disable",
"postpack": "pinst --enable"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"eslint --fix"
]
}
}
12 changes: 6 additions & 6 deletions packages/components/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"semi": true,
"tabWidth": 2,
"printWidth": 100,
"singleQuote": true,
"trailingComma": "none",
"jsxBracketSameLine": true
"semi": true,
"tabWidth": 2,
"printWidth": 100,
"singleQuote": true,
"trailingComma": "none",
"jsxBracketSameLine": true
}
2 changes: 1 addition & 1 deletion packages/components/src/appbar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AppBarProps, AppBar as MuiAppBar } from '@mui/material';
import React from 'react';
import { AppBar as MuiAppBar, AppBarProps } from '@mui/material';

export function AppBar(props: AppBarProps) {
return <MuiAppBar {...props} />;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AvatarProps, Avatar as MuiAvatar } from '@mui/material';
import React from 'react';
import { Avatar as MuiAvatar, AvatarProps } from '@mui/material';

export function Avatar(props: AvatarProps) {
return <MuiAvatar {...props} />;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/box.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BoxProps, Box as MuiBox } from '@mui/material';
import React from 'react';
import { Box as MuiBox, BoxProps } from '@mui/material';

export function Box(props: BoxProps) {
return <MuiBox {...props} />;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/button.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Button } from '@mui/material';
import * as React from 'react';

export const BaseButton = (_props: any) => {
return <Button variant="contained">Hello world</Button>;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/chip.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ChipProps, Chip as MuiChip } from '@mui/material';
import React from 'react';
import { Chip as MuiChip, ChipProps } from '@mui/material';

export function Chip(props: ChipProps) {
return <MuiChip {...props} />;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DialogProps, Dialog as MuiDialog } from '@mui/material';
import React from 'react';
import { Dialog as MuiDialog, DialogProps } from '@mui/material';

export function Dialog(props: DialogProps) {
return <MuiDialog {...props} />;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/dialogactions.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DialogActionsProps, DialogActions as MuiDialogActions } from '@mui/material';
import React from 'react';
import { DialogActions as MuiDialogActions, DialogActionsProps } from '@mui/material';

export function DialogActions(props: DialogActionsProps) {
return <MuiDialogActions {...props} />;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/dialogcontent.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DialogContentProps, DialogContent as MuiDialogContent } from '@mui/material';
import React from 'react';
import { DialogContent as MuiDialogContent, DialogContentProps } from '@mui/material';

export function DialogContent(props: DialogContentProps) {
return <MuiDialogContent {...props} />;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/dialogcontenttext.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DialogContentTextProps, DialogContentText as MuiDialogContentText } from '@mui/material';
import React from 'react';
import { DialogContentText as MuiDialogContentText, DialogContentTextProps } from '@mui/material';

export function DialogContentText(props: DialogContentTextProps) {
return <MuiDialogContentText {...props} />;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/dialogtitle.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DialogTitleProps, DialogTitle as MuiDialogTitle } from '@mui/material';
import React from 'react';
import { DialogTitle as MuiDialogTitle, DialogTitleProps } from '@mui/material';

export function DialogTitle(props: DialogTitleProps) {
return <MuiDialogTitle {...props} />;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/divider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DividerProps, Divider as MuiDivider } from '@mui/material';
import React from 'react';
import { Divider as MuiDivider, DividerProps } from '@mui/material';

export function Divider(props: DividerProps) {
return <MuiDivider {...props} />;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/drawer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DrawerProps, Drawer as MuiDrawer } from '@mui/material';
import React from 'react';
import { Drawer as MuiDrawer, DrawerProps } from '@mui/material';

export function Drawer(props: DrawerProps) {
return <MuiDrawer {...props} />;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/iconbutton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IconButton as MuiIconButton, IconButtonProps } from '@mui/material';
import { IconButtonProps, IconButton as MuiIconButton } from '@mui/material';
import React from 'react';

export function IconButton(props: IconButtonProps) {
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export { AppBar } from './appbar';
export { Avatar } from './avatar';
export { BaseButton } from './button';
export { Box } from './box';
export { BaseButton } from './button';
export { Chip } from './chip';
export { Dialog } from './dialog';
export { DialogActions } from './dialogactions';
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/paper.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Paper as MuiPaper, PaperProps } from '@mui/material';
import React from 'react';

export function Paper(props: PaperProps) {
return <MuiPaper {...props}>{props.children}</MuiPaper>;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/tab.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Tab as MuiTab, TabProps } from '@mui/material';
import React from 'react';

export function Tab(props: TabProps) {
return <MuiTab {...props} />;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/toolbar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Toolbar as MuiToolbar, ToolbarProps } from '@mui/material';
import React from 'react';

export function Toolbar(props: ToolbarProps) {
return <MuiToolbar {...props} />;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/tooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Tooltip as MuiTooltip, TooltipProps } from '@mui/material';
import React from 'react';

export function Tooltip(props: TooltipProps) {
return <MuiTooltip {...props} />;
Expand Down
44 changes: 22 additions & 22 deletions packages/design-system/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
module.exports = {
env: {
browser: true,
es2021: true
},
extends: ['standard-with-typescript', 'plugin:react/recommended', 'plugin:prettier/recommended'],
overrides: [
{
env: {
node: true
},
files: ['.eslintrc.{js,cjs}'],
parserOptions: {
sourceType: 'script'
}
}
],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module'
},
plugins: ['react'],
rules: {}
env: {
browser: true,
es2021: true
},
extends: ['standard-with-typescript', 'plugin:react/recommended', 'plugin:prettier/recommended'],
overrides: [
{
env: {
node: true
},
files: ['.eslintrc.{js,cjs}'],
parserOptions: {
sourceType: 'script'
}
}
],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module'
},
plugins: ['react'],
rules: {}
};
12 changes: 6 additions & 6 deletions packages/design-system/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"semi": true,
"tabWidth": 2,
"printWidth": 100,
"singleQuote": true,
"trailingComma": "none",
"jsxBracketSameLine": true
"semi": true,
"tabWidth": 2,
"printWidth": 100,
"singleQuote": true,
"trailingComma": "none",
"jsxBracketSameLine": true
}
18 changes: 9 additions & 9 deletions packages/design-system/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/** @type { import('@storybook/react-vite').StorybookConfig } */
const config = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
staticDirs: ["../public"],
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
staticDirs: ['../public'],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions'
],
framework: {
name: "@storybook/react-vite",
options: {},
name: '@storybook/react-vite',
options: {}
},
docs: {
autodocs: "tag",
},
autodocs: 'tag'
}
};
export default config;
20 changes: 10 additions & 10 deletions packages/design-system/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { CssBaseline, ThemeProvider } from "@mui/material";
import { lightTheme, darkTheme } from "../src/stories/themes/app";
import { withThemeFromJSXProvider } from "@storybook/addon-styling";
import { CssBaseline, ThemeProvider } from '@mui/material';
import { lightTheme, darkTheme } from '../src/stories/themes/app';
import { withThemeFromJSXProvider } from '@storybook/addon-styling';

/** @type { import('@storybook/react').Preview } */
const preview = {
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
date: /Date$/
}
}
}
};

export default preview;
Expand All @@ -23,8 +23,8 @@ export const decorators = [
light: lightTheme,
dark: darkTheme
},
defaultTheme: "light",
defaultTheme: 'light',
Provider: ThemeProvider,
GlobalStyles: CssBaseline
}),
})
];
2 changes: 1 addition & 1 deletion packages/design-system/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
12 changes: 6 additions & 6 deletions packages/design-system/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { BaseButton } from '@layer5/sistent-components';

function App() {
return (
<div className="App">
<BaseButton>Hello</BaseButton>
Welcome To Sistent Design System for Layer5
</div>
);
return (
<div className="App">
<BaseButton>Hello</BaseButton>
Welcome To Sistent Design System for Layer5
</div>
);
}

export default App;
14 changes: 7 additions & 7 deletions packages/design-system/src/main.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';

ReactDOM.createRoot(document.getElementById("root")).render(
<React.StrictMode>
<App />
</React.StrictMode>
ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
<App />
</React.StrictMode>
);
Loading