mirror of
https://github.com/spacedriveapp/spacedrive
synced 2024-07-08 08:22:53 +00:00
Add eslint to @sd/client & fix types
This commit is contained in:
parent
959783b08a
commit
f7afb9ac2b
7
packages/client/.eslintrc.js
Normal file
7
packages/client/.eslintrc.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
module.exports = {
|
||||
...require('@sd/config/eslint-react.js'),
|
||||
parserOptions: {
|
||||
tsconfigRootDir: __dirname,
|
||||
project: './tsconfig.json'
|
||||
}
|
||||
};
|
|
@ -8,7 +8,7 @@
|
|||
],
|
||||
"scripts": {
|
||||
"test": "jest",
|
||||
"lint": "TIMING=1 eslint src --fix",
|
||||
"lint": "eslint src/**/*.{ts,tsx} && tsc --noEmit",
|
||||
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { PropsWithChildren, createContext, useCallback, useContext, useMemo } from 'react';
|
||||
import { proxy, subscribe, useSnapshot } from 'valtio';
|
||||
import { subscribe, useSnapshot } from 'valtio';
|
||||
|
||||
import { useBridgeQuery } from '../rspc';
|
||||
import { valtioPersist } from '../stores';
|
||||
|
@ -81,7 +81,7 @@ export const useCurrentLibrary = () => {
|
|||
}
|
||||
|
||||
return current;
|
||||
}, [libraries, currentLibraryUuid]); // TODO: This runs when the 'libraries' change causing the whole app to re-render which is cringe.
|
||||
}, [libraries, currentLibraryUuid, switchLibrary]); // TODO: This runs when the 'libraries' change causing the whole app to re-render which is cringe.
|
||||
|
||||
return {
|
||||
library,
|
||||
|
|
|
@ -10,7 +10,7 @@ export function normiCustomHooks(
|
|||
{ contextSharing }: NormiOptions,
|
||||
nextHooks?: () => CustomHooks
|
||||
): () => CustomHooks {
|
||||
let normiCache = getNormiCache(contextSharing ?? false);
|
||||
const normiCache = getNormiCache(contextSharing ?? false);
|
||||
const next = nextHooks?.();
|
||||
|
||||
// TODO: Handle manual modifications to the query cache
|
||||
|
|
|
@ -6,8 +6,8 @@ export type OmitDistributive<T, K extends PropertyKey> = T extends any
|
|||
? Id<OmitRecursively<T, K>>
|
||||
: T
|
||||
: never;
|
||||
export type Id<T> = {} & { [P in keyof T]: T[P] }; // Cosmetic use only makes the tooltips expand the type can be removed
|
||||
export type OmitRecursively<T extends any, K extends PropertyKey> = Omit<
|
||||
export type Id<T> = object & { [P in keyof T]: T[P] }; // Cosmetic use only makes the tooltips expand the type can be removed
|
||||
export type OmitRecursively<T, K extends PropertyKey> = Omit<
|
||||
{ [P in keyof T]: OmitDistributive<T[P], K> },
|
||||
K
|
||||
>;
|
||||
|
|
|
@ -59,7 +59,7 @@ export function normaliseValueForStorage(value: any, rootElem: boolean): any {
|
|||
} else if (typeof value === 'object') {
|
||||
if ('$id' in value && '$type' in value) {
|
||||
if (rootElem) {
|
||||
let v = Object.assign({}, value);
|
||||
const v = Object.assign({}, value);
|
||||
delete v.$id;
|
||||
delete v.$type;
|
||||
|
||||
|
@ -144,7 +144,7 @@ export function loadDataFromCache(value: any, normiCache: NormiCache): any {
|
|||
} else if (typeof value === 'object') {
|
||||
if ('$id' in value && '$type' in value) {
|
||||
// if (rootElem) {
|
||||
let v = Object.assign({}, value);
|
||||
const v = Object.assign({}, value);
|
||||
delete v.$id;
|
||||
delete v.$type;
|
||||
|
||||
|
|
Loading…
Reference in a new issue