generated from layer5io/layer5-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #362 from layer5io/361-eslint
build(repo): Setup `eslint` in root workspace
- Loading branch information
Showing
71 changed files
with
1,795 additions
and
2,676 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
browser: true, | ||
es6: true | ||
}, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:react-hooks/recommended', | ||
'plugin:storybook/recommended' | ||
], | ||
plugins: ['react'], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: 'module', | ||
requireConfigFile: false | ||
}, | ||
settings: { | ||
react: { | ||
version: 'detect' | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,31 @@ | ||
name: Linting and formatting | ||
name: Lint check | ||
|
||
on: | ||
push: | ||
branches: | ||
- "*" | ||
pull_request: | ||
branches: | ||
- "*" | ||
push: | ||
branches: | ||
- '*' | ||
pull_request: | ||
branches: | ||
- '*' | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/[email protected] | ||
lint: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [16, 18, 20] | ||
|
||
- name: Set up Node.js ${{ matrix.node-version }} | ||
uses: actions/[email protected] | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Install dependencies | ||
run: yarn install | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Run Lint | ||
run: yarn lint && yarn format:check && yarn lint-staged | ||
- name: Set up Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Install dependencies | ||
run: yarn install | ||
|
||
- name: Run Lint | ||
run: yarn lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,3 +36,4 @@ packages/design-system/node_modules/** | |
**/storybook-static/** | ||
lerna-debug.log | ||
pub.sh | ||
.eslintcache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
# Ignore artifacts: | ||
**/dist/** | ||
**/coverage/** | ||
**/.cache/** | ||
**/.cache/** | ||
**/.github/** | ||
**/.yarn/** | ||
site/public | ||
.yarnrc.yml | ||
.eslintrc.*js |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,56 @@ | ||
import { | ||
Button, | ||
Dialog, | ||
DialogActions, | ||
DialogContent, | ||
DialogTitle, | ||
IconButton, | ||
Typography | ||
} from '@layer5/sistent-components'; | ||
import { CloseIcon } from '@layer5/sistent-svg'; | ||
import React from 'react'; | ||
|
||
export default function DefaultModal() { | ||
const [open, setOpen] = React.useState(false); | ||
|
||
const handleClickOpen = () => { | ||
setOpen(true); | ||
}; | ||
const handleClose = () => { | ||
setOpen(false); | ||
}; | ||
|
||
return ( | ||
<React.Fragment> | ||
<Button variant="contained" onClick={handleClickOpen}> | ||
Open Dialog | ||
</Button> | ||
<Dialog onClose={handleClose} open={open}> | ||
<DialogTitle>Modal Title</DialogTitle> | ||
<IconButton onClick={handleClose} sx={{ position: 'absolute', right: 8, top: 8 }}> | ||
<CloseIcon width={24} height={24} /> | ||
</IconButton> | ||
<DialogContent dividers> | ||
<Typography gutterBottom> | ||
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis | ||
in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. | ||
</Typography> | ||
<Typography gutterBottom> | ||
Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis | ||
lacus vel augue laoreet rutrum faucibus dolor auctor. | ||
</Typography> | ||
<Typography gutterBottom> | ||
Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel | ||
scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus | ||
auctor fringilla. | ||
</Typography> | ||
</DialogContent> | ||
<DialogActions> | ||
<Button variant="contained" autoFocus onClick={handleClose}> | ||
Save changes | ||
</Button> | ||
</DialogActions> | ||
</Dialog> | ||
</React.Fragment> | ||
); | ||
} | ||
|
||
Button, | ||
Dialog, | ||
DialogActions, | ||
DialogContent, | ||
DialogTitle, | ||
IconButton, | ||
Typography | ||
} from '@layer5/sistent-components'; | ||
import { CloseIcon } from '@layer5/sistent-svg'; | ||
import React from 'react'; | ||
|
||
export default function DefaultModal() { | ||
const [open, setOpen] = React.useState(false); | ||
|
||
const handleClickOpen = () => { | ||
setOpen(true); | ||
}; | ||
const handleClose = () => { | ||
setOpen(false); | ||
}; | ||
|
||
return ( | ||
<React.Fragment> | ||
<Button variant="contained" onClick={handleClickOpen}> | ||
Open Dialog | ||
</Button> | ||
<Dialog onClose={handleClose} open={open}> | ||
<DialogTitle>Modal Title</DialogTitle> | ||
<IconButton onClick={handleClose} sx={{ position: 'absolute', right: 8, top: 8 }}> | ||
<CloseIcon width={24} height={24} /> | ||
</IconButton> | ||
<DialogContent dividers> | ||
<Typography gutterBottom> | ||
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis | ||
in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. | ||
</Typography> | ||
<Typography gutterBottom> | ||
Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis | ||
lacus vel augue laoreet rutrum faucibus dolor auctor. | ||
</Typography> | ||
<Typography gutterBottom> | ||
Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel | ||
scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus | ||
auctor fringilla. | ||
</Typography> | ||
</DialogContent> | ||
<DialogActions> | ||
<Button variant="contained" autoFocus onClick={handleClose}> | ||
Save changes | ||
</Button> | ||
</DialogActions> | ||
</Dialog> | ||
</React.Fragment> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { ResponsiveDataTable } from "./ResponsiveDataTable"; | ||
export { ResponsiveDataTable } from './ResponsiveDataTable'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from './ResponsiveDataTable'; | ||
export * from './ResponsiveDataTable'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,45 @@ | ||
import { useSelector, useDispatch } from "react-redux"; | ||
import createEmotionCache from "@/styles/createEmotionCache"; | ||
import createEmotionCache from '@/styles/createEmotionCache'; | ||
import { darkTheme, lightTheme } from '@/styles/themes/theme'; | ||
import { CacheProvider } from '@emotion/react'; | ||
import { CssBaseline, ThemeProvider, createTheme } from '@mui/material'; | ||
import { darkTheme, lightTheme } from "@/styles/themes/theme"; | ||
import { useMemo } from "react"; | ||
import { useMemo } from 'react'; | ||
import { useSelector } from 'react-redux'; | ||
|
||
const clientSideEmotionCache = createEmotionCache(); | ||
|
||
export function AppThemeProvider({ children, emotionCache = clientSideEmotionCache }) { | ||
// const dispatch = useDispatch(); | ||
// const dispatch = useDispatch(); | ||
|
||
const mode = useSelector((state) => state.theme.darkTheme ? "dark" : "light") | ||
const mode = useSelector((state) => (state.theme.darkTheme ? 'dark' : 'light')); | ||
|
||
const theme = useMemo( | ||
() => | ||
createTheme({ | ||
palette: { | ||
mode, | ||
primary: { | ||
...(mode === 'light' ? lightTheme.palette.primary : darkTheme.palette.primary), | ||
}, | ||
secondary: { | ||
main: '#EE5351', | ||
}, | ||
background: { | ||
...(mode === 'light' ? lightTheme.palette.background : darkTheme.palette.background), | ||
}, | ||
text: { | ||
...(mode === 'light' ? lightTheme.palette.text : darkTheme.palette.text), | ||
}, | ||
}, | ||
}), | ||
[mode], | ||
); | ||
const theme = useMemo( | ||
() => | ||
createTheme({ | ||
palette: { | ||
mode, | ||
primary: { | ||
...(mode === 'light' ? lightTheme.palette.primary : darkTheme.palette.primary) | ||
}, | ||
secondary: { | ||
main: '#EE5351' | ||
}, | ||
background: { | ||
...(mode === 'light' ? lightTheme.palette.background : darkTheme.palette.background) | ||
}, | ||
text: { | ||
...(mode === 'light' ? lightTheme.palette.text : darkTheme.palette.text) | ||
} | ||
} | ||
}), | ||
[mode] | ||
); | ||
|
||
return ( | ||
<CacheProvider value={emotionCache}> | ||
<ThemeProvider theme={theme}> | ||
<CssBaseline /> | ||
{children} | ||
</ThemeProvider> | ||
</CacheProvider> | ||
); | ||
} | ||
return ( | ||
<CacheProvider value={emotionCache}> | ||
<ThemeProvider theme={theme}> | ||
<CssBaseline /> | ||
{children} | ||
</ThemeProvider> | ||
</CacheProvider> | ||
); | ||
} |
Oops, something went wrong.