mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
Merge pull request #36 from utopia-os/lint-catchall
feat(other): lint catchall
This commit is contained in:
commit
66f1c328e7
@ -25,7 +25,7 @@ module.exports = {
|
|||||||
'import',
|
'import',
|
||||||
'promise',
|
'promise',
|
||||||
// 'security',
|
// 'security',
|
||||||
// 'no-catch-all',
|
'no-catch-all',
|
||||||
'react',
|
'react',
|
||||||
'react-hooks',
|
'react-hooks',
|
||||||
],
|
],
|
||||||
@ -44,7 +44,7 @@ module.exports = {
|
|||||||
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
|
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
|
||||||
'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies
|
'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies
|
||||||
'react/react-in-jsx-scope': 'off', // Disable requirement for React import
|
'react/react-in-jsx-scope': 'off', // Disable requirement for React import
|
||||||
// 'no-catch-all/no-catch-all': 'error',
|
'no-catch-all/no-catch-all': 'error',
|
||||||
'no-console': 'error',
|
'no-console': 'error',
|
||||||
'no-debugger': 'error',
|
'no-debugger': 'error',
|
||||||
camelcase: 'error',
|
camelcase: 'error',
|
||||||
|
|||||||
11
package-lock.json
generated
11
package-lock.json
generated
@ -45,6 +45,7 @@
|
|||||||
"eslint-import-resolver-typescript": "^3.6.3",
|
"eslint-import-resolver-typescript": "^3.6.3",
|
||||||
"eslint-plugin-import": "^2.31.0",
|
"eslint-plugin-import": "^2.31.0",
|
||||||
"eslint-plugin-json": "^3.1.0",
|
"eslint-plugin-json": "^3.1.0",
|
||||||
|
"eslint-plugin-no-catch-all": "^1.1.0",
|
||||||
"eslint-plugin-prettier": "^5.2.1",
|
"eslint-plugin-prettier": "^5.2.1",
|
||||||
"eslint-plugin-promise": "^6.1.1",
|
"eslint-plugin-promise": "^6.1.1",
|
||||||
"eslint-plugin-react": "^7.31.8",
|
"eslint-plugin-react": "^7.31.8",
|
||||||
@ -2372,6 +2373,16 @@
|
|||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/eslint-plugin-no-catch-all": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/eslint-plugin-no-catch-all/-/eslint-plugin-no-catch-all-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-VkP62jLTmccPrFGN/W6V7a3SEwdtTZm+Su2k4T3uyJirtkm0OMMm97h7qd8pRFAHus/jQg9FpUpLRc7sAylBEQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"peerDependencies": {
|
||||||
|
"eslint": ">=2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/eslint-plugin-prettier": {
|
"node_modules/eslint-plugin-prettier": {
|
||||||
"version": "5.2.1",
|
"version": "5.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz",
|
||||||
|
|||||||
@ -33,6 +33,7 @@
|
|||||||
"eslint-import-resolver-typescript": "^3.6.3",
|
"eslint-import-resolver-typescript": "^3.6.3",
|
||||||
"eslint-plugin-import": "^2.31.0",
|
"eslint-plugin-import": "^2.31.0",
|
||||||
"eslint-plugin-json": "^3.1.0",
|
"eslint-plugin-json": "^3.1.0",
|
||||||
|
"eslint-plugin-no-catch-all": "^1.1.0",
|
||||||
"eslint-plugin-prettier": "^5.2.1",
|
"eslint-plugin-prettier": "^5.2.1",
|
||||||
"eslint-plugin-promise": "^6.1.1",
|
"eslint-plugin-promise": "^6.1.1",
|
||||||
"eslint-plugin-react": "^7.31.8",
|
"eslint-plugin-react": "^7.31.8",
|
||||||
|
|||||||
@ -28,6 +28,7 @@ export const ContextWrapper = ({ children }) => {
|
|||||||
try {
|
try {
|
||||||
// eslint-disable-next-line react-hooks/rules-of-hooks
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
||||||
location = useLocation()
|
location = useLocation()
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
location = null
|
location = null
|
||||||
}
|
}
|
||||||
|
|||||||
@ -69,6 +69,7 @@ export const AuthProvider = ({ userApi, children }: AuthProviderProps) => {
|
|||||||
setLoading(false)
|
setLoading(false)
|
||||||
return me
|
return me
|
||||||
} else return undefined
|
} else return undefined
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
return undefined
|
return undefined
|
||||||
|
|||||||
@ -63,6 +63,7 @@ export const SearchControl = () => {
|
|||||||
try {
|
try {
|
||||||
const { data } = await axios.get(`https://photon.komoot.io/api/?q=${value}&limit=5`)
|
const { data } = await axios.get(`https://photon.komoot.io/api/?q=${value}&limit=5`)
|
||||||
setGeoResults(data.features)
|
setGeoResults(data.features)
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(error)
|
console.log(error)
|
||||||
|
|||||||
@ -70,6 +70,7 @@ export function ItemFormPopup(props: ItemFormPopupProps) {
|
|||||||
try {
|
try {
|
||||||
await props.layer.api?.updateItem!({ ...formItem, id: props.item.id })
|
await props.layer.api?.updateItem!({ ...formItem, id: props.item.id })
|
||||||
success = true
|
success = true
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(error.toString())
|
toast.error(error.toString())
|
||||||
}
|
}
|
||||||
@ -101,6 +102,7 @@ export function ItemFormPopup(props: ItemFormPopupProps) {
|
|||||||
name: formItem.name ? formItem.name : user?.first_name,
|
name: formItem.name ? formItem.name : user?.first_name,
|
||||||
}))
|
}))
|
||||||
success = true
|
success = true
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(error.toString())
|
toast.error(error.toString())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,6 +63,7 @@ export const ItemViewPopup = forwardRef((props: ItemViewPopupProps, ref: any) =>
|
|||||||
props.item.layer?.onlyOnePerOwner &&
|
props.item.layer?.onlyOnePerOwner &&
|
||||||
(await props.item.layer.api?.updateItem!({ id: props.item.id, position: null }))
|
(await props.item.layer.api?.updateItem!({ id: props.item.id, position: null }))
|
||||||
success = true
|
success = true
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(error.toString())
|
toast.error(error.toString())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -89,6 +89,7 @@ function useSelectPositionManager(): {
|
|||||||
position: null,
|
position: null,
|
||||||
})
|
})
|
||||||
success = true
|
success = true
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(error.toString())
|
toast.error(error.toString())
|
||||||
}
|
}
|
||||||
@ -113,6 +114,7 @@ function useSelectPositionManager(): {
|
|||||||
position: updatedItem.position,
|
position: updatedItem.position,
|
||||||
})
|
})
|
||||||
success = true
|
success = true
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(error.toString())
|
toast.error(error.toString())
|
||||||
}
|
}
|
||||||
@ -134,6 +136,7 @@ function useSelectPositionManager(): {
|
|||||||
try {
|
try {
|
||||||
await markerClicked.layer?.api?.updateItem!(updatedItem)
|
await markerClicked.layer?.api?.updateItem!(updatedItem)
|
||||||
success = true
|
success = true
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(error.toString())
|
toast.error(error.toString())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,6 +63,7 @@ export const submitNewItem = async (
|
|||||||
await layer?.api?.createItem!({ ...formItem, id: uuid, type, parent: item.id })
|
await layer?.api?.createItem!({ ...formItem, id: uuid, type, parent: item.id })
|
||||||
await linkItem(uuid)
|
await linkItem(uuid)
|
||||||
success = true
|
success = true
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(error.toString())
|
toast.error(error.toString())
|
||||||
}
|
}
|
||||||
@ -84,6 +85,7 @@ export const linkItem = async (id: string, item, updateItem) => {
|
|||||||
try {
|
try {
|
||||||
await item?.layer?.api?.updateItem!(updatedItem)
|
await item?.layer?.api?.updateItem!(updatedItem)
|
||||||
success = true
|
success = true
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(error.toString())
|
toast.error(error.toString())
|
||||||
}
|
}
|
||||||
@ -101,6 +103,7 @@ export const unlinkItem = async (id: string, item, updateItem) => {
|
|||||||
try {
|
try {
|
||||||
await item?.layer?.api?.updateItem!(updatedItem)
|
await item?.layer?.api?.updateItem!(updatedItem)
|
||||||
success = true
|
success = true
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(error.toString())
|
toast.error(error.toString())
|
||||||
}
|
}
|
||||||
@ -124,6 +127,7 @@ export const handleDelete = async (
|
|||||||
try {
|
try {
|
||||||
await item.layer?.api?.deleteItem!(item.id)
|
await item.layer?.api?.deleteItem!(item.id)
|
||||||
success = true
|
success = true
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(error.toString())
|
toast.error(error.toString())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -91,6 +91,7 @@ export const OverlayItemsIndexPage = ({
|
|||||||
try {
|
try {
|
||||||
await layer?.api?.createItem!({ ...formItem, id: uuid })
|
await layer?.api?.createItem!({ ...formItem, id: uuid })
|
||||||
success = true
|
success = true
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(error.toString())
|
toast.error(error.toString())
|
||||||
}
|
}
|
||||||
@ -108,6 +109,7 @@ export const OverlayItemsIndexPage = ({
|
|||||||
try {
|
try {
|
||||||
await layer?.api?.deleteItem!(item.id)
|
await layer?.api?.deleteItem!(item.id)
|
||||||
success = true
|
success = true
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(error.toString())
|
toast.error(error.toString())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,6 +34,7 @@ export async function reverseGeocode(lat: number, lon: number): Promise<string>
|
|||||||
// Formatiere die Adresse
|
// Formatiere die Adresse
|
||||||
const formattedAddress = `${street} ${houseNumber}, ${city}`.trim()
|
const formattedAddress = `${street} ${houseNumber}, ${city}`.trim()
|
||||||
return formattedAddress || ''
|
return formattedAddress || ''
|
||||||
|
// eslint-disable-next-line no-catch-all/no-catch-all
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.error('Error:', error)
|
console.error('Error:', error)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user