Skip to content

Commit

Permalink
get all the basic parts working
Browse files Browse the repository at this point in the history
  • Loading branch information
mcnuttandrew committed Jan 16, 2025
1 parent 07df996 commit 9255373
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
8 changes: 7 additions & 1 deletion apps/lil-buddy/src/linting/FocusedTest.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
: lint.expectedFailingTests[focusedTest.index]
: null;
$: lintRun = testPal
? runLint(lint, {}, testPal)
? runLint(
lint,
{
computeBlame: lint.blameMode !== "none",
},
testPal
)
: ({
result: { kind: "invalid" } as LintResult,
error: null,
Expand Down
27 changes: 19 additions & 8 deletions apps/lil-buddy/src/stores/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,18 @@ interface StoreData {
}

const InitialStore: StoreData = {
lints: PREBUILT_LINTS,
lints: PREBUILT_LINTS.map((x) => {
delete x.customProgram;
return {
...x,
expectedFailingTests: (x.expectedFailingTests || []).map(
colorPalToStringPal
),
expectedPassingTests: (x.expectedPassingTests || []).map(
colorPalToStringPal
),
};
}) as any as LintProgram[],
focusedLint: false,
currentChecks: [],
loadState: "idle",
Expand Down Expand Up @@ -48,12 +59,12 @@ function deserializeStore(store: any) {
return {
...store,
lints: store.lints.map((x: any) => ({
requiredTags: [],
taskTypes: [],
...x,
expectedFailingTests: (x.expectedFailingTests || []).map(
stringPalToColorPal
),
expectedFailingTests: (x.expectedFailingTests || []).map((x) => {
const newPal = stringPalToColorPal(x);
console.log(newPal.colors, x.colors);
return newPal;
}),
expectedPassingTests: (x.expectedPassingTests || []).map(
stringPalToColorPal
),
Expand All @@ -68,14 +79,14 @@ function addDefaults(store: Partial<StoreData>): StoreData {
return storeData as StoreData;
}

const storeName = "lil-buddy-store-x4";
const storeName = "lil-buddy-store";
function createStore() {
const target =
localStorage.getItem(storeName) || JSON.stringify(InitialStore);
let storeData: StoreData = deserializeStore(addDefaults(JSON.parse(target)));

// persist new store to storage
localStorage.setItem(storeName, JSON.stringify(deserializeStore(storeData)));
localStorage.setItem(storeName, JSON.stringify(serializeStore(storeData)));
// create store
const { subscribe, update } = writable<StoreData>(storeData);
let undoStack: StoreData[] = [];
Expand Down

0 comments on commit 9255373

Please sign in to comment.