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

Migrate from ESLint to Biome #52

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
7f2e1a4
DELETE OLD FOLDER
bdotsamir Apr 15, 2024
07a1515
migrate eslint -> biome
bdotsamir Apr 15, 2024
9d3be0c
create Splittable component
bdotsamir Apr 15, 2024
d07f1f4
eslint: for the love of pete please dear god work
bdotsamir Apr 15, 2024
787b5db
linting all around
bdotsamir Apr 15, 2024
54f3f4f
Panel: use solid Show component rather than conditional rendering
bdotsamir Apr 15, 2024
d039cac
MemoryContext: use solid primitive mouse position because my own impl…
bdotsamir Apr 15, 2024
f2fca98
MemoryContext: turn panelsStore into an object containing panels & is…
bdotsamir Apr 15, 2024
4f2df70
Implement Splittable with a simple test case
bdotsamir Apr 15, 2024
94bc1fe
Splitable: start work on context
bdotsamir Apr 16, 2024
1db2a76
Massive work on Splittable / Panel resizing!
bdotsamir Apr 16, 2024
b286e79
splitable: allow multiple children, more consistent panel resizing
JackDotJS Apr 16, 2024
c07eceb
splitable: fix missing vertical resizing logic
JackDotJS Apr 16, 2024
77a34bd
splitable: hide split lines when not hovering or dragging
JackDotJS Apr 16, 2024
0542a72
splitable: added some comments
JackDotJS Apr 16, 2024
f745529
build(deps): bump h2 from 0.3.25 to 0.3.26 in /src-tauri
dependabot[bot] Apr 16, 2024
0c5a6a6
Merge pull request #53 from JackDotJS/dependabot/cargo/src-tauri/h2-0…
JackDotJS Apr 16, 2024
5b99221
Splitable.module.css: add 80ms transition into color on splitline hover
bdotsamir Apr 16, 2024
f32d5e4
migrate eslint -> biome
bdotsamir Apr 15, 2024
fde23a8
Merge branch 'feat/biome' of github.com:JackDotJS/node-studio into fe…
bdotsamir Apr 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
build/
build/
dist/
14 changes: 7 additions & 7 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"parserOptions": {
"ecmaVersion": 2020
"ecmaVersion": 2020,
"ecmaFeatures": {
"jsx": true
}
},
"overrides": [
{
Expand All @@ -10,6 +13,7 @@
}
}
],
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"solid"
Expand All @@ -32,10 +36,6 @@
"SwitchCase": 1
}
],
"quotes": [
"warn",
"backtick"
],
"semi": [
"warn",
"always"
Expand All @@ -55,8 +55,8 @@
"ignoreReadBeforeAssign": false
}
],
"no-unused-vars": "error",
"@typescript-eslint/no-unused-vars": [ "error" ],
"no-unused-vars": "warn",
"@typescript-eslint/no-unused-vars": "warn",
"no-var": "warn",
"require-atomic-updates": "off",
"no-empty": "off",
Expand Down
74 changes: 74 additions & 0 deletions biome.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"$schema": "https://biomejs.dev/schemas/1.7.0/schema.json",
"organizeImports": { "enabled": true },
"linter": {
"enabled": true,
"rules": {
"recommended": false,
"complexity": {
"noExtraBooleanCast": "error",
"noMultipleSpacesInRegularExpressionLiterals": "error",
"noUselessCatch": "error",
"noWith": "error"
},
"correctness": {
"noConstAssign": "error",
"noConstantCondition": "error",
"noEmptyCharacterClassInRegex": "error",
"noEmptyPattern": "error",
"noGlobalObjectCalls": "error",
"noInnerDeclarations": "error",
"noInvalidConstructorSuper": "error",
"noInvalidUseBeforeDeclaration": "error",
"noNewSymbol": "error",
"noNonoctalDecimalEscape": "error",
"noPrecisionLoss": "error",
"noSelfAssign": "error",
"noSetterReturn": "error",
"noSwitchDeclarations": "off",
"noUndeclaredVariables": "error",
"noUnreachable": "error",
"noUnreachableSuper": "error",
"noUnsafeFinally": "error",
"noUnsafeOptionalChaining": "error",
"noUnusedLabels": "error",
"noUnusedVariables": "error",
"useIsNan": "error",
"useValidForDirection": "error",
"useYield": "error",
// Do not explicitly set "children" in props.
// For example:
// <Component children={children} /> ❌
"noChildrenProp": "error"
},
"style": { "noVar": "warn", "useConst": "warn" },
"suspicious": {
"noAssignInExpressions": "error",
"noAsyncPromiseExecutor": "error",
"noCatchAssign": "error",
"noClassAssign": "error",
"noCompareNegZero": "error",
"noConsoleLog": "off",
"noControlCharactersInRegex": "error",
"noDuplicateCase": "error",
"noDuplicateClassMembers": "error",
"noDuplicateObjectKeys": "error",
"noDuplicateParameters": "error",
"noEmptyBlockStatements": "off",
"noFallthroughSwitchClause": "error",
"noFunctionAssign": "error",
"noGlobalAssign": "error",
"noImportAssign": "error",
"noMisleadingCharacterClass": "error",
"noPrototypeBuiltins": "error",
"noRedeclare": "error",
"noShadowRestrictedNames": "error",
"noUnsafeNegation": "error",
"useGetterReturn": "error",
"useValidTypeof": "error"
}
},
"ignore": ["**/build/", "./dist/**/*", "./src-tauri/**/*"]
},
"overrides": [{ "include": ["*.mjs"] }]
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"solid-styled-components": "^0.28.5"
},
"devDependencies": {
"@biomejs/biome": "1.7.0",
"@solid-devtools/overlay": "^0.30.1",
"@tauri-apps/cli": "^1.5.11",
"@typescript-eslint/eslint-plugin": "^5.62.0",
Expand Down
91 changes: 91 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 26 additions & 17 deletions src/MemoryContext.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { JSX, createContext, useContext } from "solid-js";
import { createStore } from "solid-js/store";
import NodeStudioProject from "./classes/project";
import { MousePosition, useMousePosition } from "./util/mousePosition";
// import { MousePosition, useMousePosition } from "./util/mousePosition"; // Broken
import { useMousePosition, MousePositionInside } from "@solid-primitives/mouse";

export interface IInstrument {
name: string,
Expand All @@ -24,54 +25,62 @@ export interface IMemory {
[x: string]: any // TODO: **REMOVE THIS LINE WHEN PROJECT IS DONE!**
}

type PanelFunction = () => JSX.Element;
type SplitableFunction = () => JSX.Element;

export const MemoryContext = createContext<{
masterAnalyser: AnalyserNode,
audioContext: AudioContext,

panels: (PanelFunction)[],
addPanel(NewPanel: PanelFunction): void,
removePanel(OldPanel: PanelFunction): void,
readonly panels: (SplitableFunction)[],
addPanel(NewPanel: SplitableFunction): void, // eslint-disable-line no-unused-vars
removePanel(OldPanel: SplitableFunction): void, // eslint-disable-line no-unused-vars

mousePosition: MousePosition
readonly isEditingPanels: boolean,
toggleEditingPanels(): void,

mousePosition: MousePositionInside
}>();

export function useMemoryContext() {
const context = useContext(MemoryContext);
if (!context) throw new Error(`useMemoryContext: MemoryContext is undefined!`);

return context;
}

export function MemoryProvider(props: { children: JSX.Element }) {
const audioContext = new window.AudioContext();
const masterAnalyser = audioContext.createAnalyser();

const [panelsStore, setPanelsStore] = createStore(
[] as PanelFunction[]
);
const [memoryStore, setMemoryStore] = createStore({
panels: [] as SplitableFunction[],
isEditingPanels: false
});

const memory = {
audioContext,
masterAnalyser,

panels: panelsStore,
addPanel(NewPanel: PanelFunction) {
get panels() { return memoryStore.panels; },
addPanel(NewPanel: SplitableFunction) {
console.log("Adding a panel...");
return setPanelsStore([...panelsStore, NewPanel]);
return setMemoryStore("panels", memoryStore.panels.length, () => NewPanel);
},
removePanel(OldPanel: PanelFunction) {
removePanel(OldPanel: SplitableFunction) {
console.log("Removing a panel...");
return setPanelsStore(panelsStore.filter((panel) => panel !== OldPanel));
return setMemoryStore("panels", memoryStore.panels.filter((panel) => panel !== OldPanel));
},
get isEditingPanels() { return memoryStore.isEditingPanels; },
toggleEditingPanels() {
setMemoryStore("isEditingPanels", (e) => !e);
},

mousePosition: useMousePosition()
}
};

return (
<MemoryContext.Provider value={memory}>
{props.children}
</MemoryContext.Provider>
)
);
}
20 changes: 17 additions & 3 deletions src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import styles from "../css/Header.module.css";
import Panel from "./Panel";
import SpectrumGraph from "./SpectrumGraph";
import WaveformGraph from "./WaveformGraph";
import Splitable from "./Splitable";

export default function Header() {

Expand All @@ -17,10 +18,23 @@ export default function Header() {
<button>Track</button>
<button>Help</button>
<button onClick={() => {
memoryContext.addPanel(() => <Panel />);
memoryContext.addPanel(() => {
return (
// TEMPORARY
<Splitable type="vertical">
<Panel />
<Splitable type="horizontal">
<Panel />
<Panel />
</Splitable>
<Panel />
<Panel />
</Splitable>
);
});
// memoryContext.setPanels([...memoryContext.panels, <Panel />]);
console.log(memoryContext.panels);
}}>+ Panel</button>
}}>+ 🍌</button>

<input
style={{ flex: 1 }}
Expand All @@ -32,5 +46,5 @@ export default function Header() {
<SpectrumGraph />

</div>
)
);
}
Loading
Loading