1.0.24 • Published 9 months ago
@guusje4525/eslint-plugin v1.0.24
Eslint plugin
This eslint plugin adds 4 additional rules:
Check for wrong mui imports. In @mui/material or @mui/icons-material you should not use named imports. More info here
Wrong:
import { Box } from "@mui/material"Correct:
import Box from "@mui/material/Box"No inline functions in JSX are allowed. All logic should exists elsewhere, like a store.
Wrong:
const myComponent = <div>
<button onClick={() => console.log('button was clicked')}>my button</button>
</div>Correct:
const store = ....
const myComponent = <div>
<button onClick={store.buttonClickHandler}>my button</button>
</div>A map in JSX should contain a key
Wrong:
const myComponent = <div>
{
myArray.map(item => <h1>Hello, I am item</h1>)
}
</div>Correct:
const myComponent = <div>
{
myArray.map(item => <h1 key={item.id}>Hello, I am item</h1>)
}
</div>Every .go() query in electrodb should contain the parameter 'pages'
Wrong:
await MyEntity.query.client({} as any).go()Correct:
await MyEntity.query.client({} as any).go({ pages: 'all' })Use correct store name (mobx)
Wrong:
const store = useAuthStore()
const store = useStore(sp => new AuthStore(sp))Correct:
const authStore = useAuthStore()
const authStore = useStore(sp => new AuthStore(sp))Your eslint config file should look something like this:
module.exports = {
plugins: ['@guusje4525'],
rules: {
'@guusje4525/mui-import-checker': 'warn',
'@guusje4525/no-inline-functions-in-jsx': 'warn',
'@guusje4525/jsx-key': 'warn',
'@guusje4525/go-method-should-have-pages': 'warn'
},
}1.0.19
1 year ago
1.0.22
9 months ago
1.0.21
10 months ago
1.0.20
10 months ago
1.0.24
9 months ago
1.0.23
9 months ago
1.0.18
2 years ago
1.0.17
2 years ago
1.0.16
2 years ago
1.0.15
2 years ago
1.0.14
2 years ago
1.0.13
2 years ago
1.0.9
2 years ago
1.0.8
2 years ago
1.0.7
2 years ago
1.0.11
2 years ago
1.0.10
2 years ago
1.0.12
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago