Skip to content

Commit

Permalink
chore: enable sb linting (#786)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoavniran authored Nov 11, 2024
1 parent fe1b46b commit 2f4cf5f
Show file tree
Hide file tree
Showing 45 changed files with 161 additions and 104 deletions.
2 changes: 1 addition & 1 deletion .github/actions/actions-token-unused/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = async ({ core }) => {
const runtimeToken = process.env.ACTIONS_RUNTIME_TOKEN;
core.setOutput("runtimeToken", runtimeToken);

const resultsUrl = process.env.ACTIONS_RESULTS_URL
const resultsUrl = process.env.ACTIONS_RESULTS_URL;
core.setOutput("resultsUrl", resultsUrl);

core.info("Got GH Actions Tokens and set into step output");
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/versionLog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ const extractVersionLog = async () => {
} catch (ex) {
core.setFailed(ex.message);
}
}
};

extractVersionLog()
extractVersionLog();

// github = require("@actions/github"),
//core.getInput('who-to-greet');
1 change: 1 addition & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint storybook/story-exports:0 storybook/csf-component:0*/
import path from "path";
import type { StorybookConfig } from "@storybook/react-webpack5";

Expand Down
2 changes: 1 addition & 1 deletion cypress/component/upload-preview-ctest.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const ItemPreviewWithCrop = withRequestPreSendUpdate((props) => {

const WithFlush = () => {
useBatchAddListener(() => {
console.log("FLUSH!!!!!")
console.log("FLUSH!!!!!");
flushSync();
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { interceptWithDelay, interceptWithHandler } from "../intercept";
import { interceptWithDelay } from "../intercept";
import uploadFile from "../uploadFile";
import { CHUNK_START, CHUNK_FINISH } from "../../constants";
import { WAIT_X_LONG } from "../../constants";
import { interceptFormData } from "cypress-intercept-formdata";

describe("ChunkedSender - Progress", () => {
const fileName = "flower.jpg";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe("ChunkedUploady - WithChunkEventHooks", () => {
expect(Object.getOwnPropertySymbols(logLine[0].uploadData)).to.have.lengthOf(0, "CHUNK_FINISH uploadData - shouldnt have proxy symbols");
});
});
}
};

it("should use chunked uploady with unique id", () => {
cy.visitStory(
Expand All @@ -57,7 +57,7 @@ describe("ChunkedUploady - WithChunkEventHooks", () => {
);

intercept();
doTest()
doTest();
});

it("should use chunked uploady with async chunk hooks", () => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/intercept.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const interceptWithDelay = (delay = 100, alias = "uploadReq", url = UPLOA
}, alias, url, method);

const intercept = (url = UPLOAD_URL, method = DEFAULT_METHOD, resOptions, alias = "uploadReq") => {
const handler = (typeof resOptions === "function") ? resOptions : createResponse(resOptions)
const handler = (typeof resOptions === "function") ? resOptions : createResponse(resOptions);

cy.log(`intercepting url: ${url} with method: ${method}`);

Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/selectFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const selectFiles = (fixtureName, triggerSelector, alias, cb, {
fileName: !i ? usedFileName : usedFileName.replace(".", `${i + 1}.`),
}));

const inputSelector = aliasAsInput ? `@${alias}` : `input[type="file"]`
const inputSelector = aliasAsInput ? `@${alias}` : `input[type="file"]`;
get(inputSelector)
.selectFile(files, { force, action })
.then(cb);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ describe("TusUploady - Simple", () => {
cy.get("@resumeReq")
.then((req) => {
expect(req).to.be.null;
})
});
}, "#upload-button");
}, "#upload-button");
});
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/tus-uploady/TusUploady-retry-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe("TusUploady - With Retry", () => {
});

//made-up resume offset so we know resume happened after failure
const resumeOffset = "200123"
const resumeOffset = "200123";

intercept(`${uploadUrl}/123`, "HEAD", {
headers: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe("TusUploady - Send Data", () => {
tusSendOnCreate: true,
}
);
}
};

const runTest = (chunkSize, isFileSmallerThanChunk = false) => {
loadStory(chunkSize);
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/tus-uploady/tusIntercept.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ export const tusIntercept = (uploadUrl) => {
"Upload-Length": "1",
},
}, "resumeReq");
}
};

2 changes: 1 addition & 1 deletion cypress/integration/umd/core-ui-umd-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe("UMD UI CORE - Bundle", () => {
});

it("should use uploady and upload file", () => {
intercept()
intercept();

uploadFile(fileName, () => {
cy.wait("@uploadReq")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe("UploadButton - Form", () => {
"uploadButton",
"with-form",
{ useMock: false }
)
);
});

it("should submit form with upload and other fields", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe("UploadButton - With Styled Component", () => {
uploadFile(fileName, () => {
cy.get("@uploadButton")
.should("have.css", "background-color", "rgb(1, 9, 22)")
.should("have.css", "color", "rgb(176, 177, 179)")
.should("have.css", "color", "rgb(176, 177, 179)");

cy.waitShort();
cy.storyLog().assertFileItemStartFinish(fileName, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("UploadDropZone - Simple", () => {
const test = "!23";

loadStory();
cy.setUploadOptions({ userData: { test} });
cy.setUploadOptions({ userData: { test } });

dropFile(fileName, () => {
cy.waitExtraShort();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe("UploadDropZone - Custom Remove", () => {

it("should remove the drag overlay", () => {
cy.get("#upload-drop-zone")
.trigger("dragenter", { dataTransfer: { items: [ { kind: "file" } ]} });
.trigger("dragenter", { dataTransfer: { items: [ { kind: "file" } ] } });

cy.get(".dropIndicator")
.should("be.visible");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ describe("UploadDropZone - shouldHandleDrag for files only", () => {
it("should not show drag overlay if not all files", () => {
cy.get("#upload-drop-zone")
.should("be.visible")
.trigger("dragenter", { dataTransfer: { items: [ { kind: "dummy" } ]} });
.trigger("dragenter", { dataTransfer: { items: [ { kind: "dummy" } ] } });

cy.get(".dropIndicator")
.should("not.be.visible");

cy.get("#upload-drop-zone")
.trigger("dragenter", { dataTransfer: { items: [ { kind: "file" } ]} });
.trigger("dragenter", { dataTransfer: { items: [ { kind: "file" } ] } });

cy.get(".dropIndicator")
.should("be.visible");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ describe("UploadDropZone - Keep Drag on Child", () => {
cy.visitStory("uploadDropZone", "with-child-element");

cy.get("#upload-drop-zone")
.trigger("dragenter", { dataTransfer: { items: [ { kind: "file" } ]} });
.trigger("dragenter", { dataTransfer: { items: [ { kind: "file" } ] } });

cy.get(".drag-over #dnd-child")
.should("be.visible");
Expand All @@ -12,10 +12,10 @@ describe("UploadDropZone - Keep Drag on Child", () => {
.trigger("dragleave");

cy.get(".drag-over #dnd-child")
.should("not.exist")
.should("not.exist");

cy.get("#upload-drop-zone")
.trigger("dragenter", { dataTransfer: { items: [ { kind: "file" } ]} });
.trigger("dragenter", { dataTransfer: { items: [ { kind: "file" } ] } });

cy.get(".drag-over #dnd-child")
.should("be.visible");
Expand All @@ -24,7 +24,7 @@ describe("UploadDropZone - Keep Drag on Child", () => {
.trigger("dragleave");

cy.get("#dnd-child")
.trigger("dragenter", { dataTransfer: { items: [ { kind: "file" } ]} });
.trigger("dragenter", { dataTransfer: { items: [ { kind: "file" } ] } });

cy.get(".drag-over #dnd-child")
.should("be.visible");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe("UploadPaste - Window Listener", () => {
it("should upload pasted file from anywhere on the page", () => {
loadPage();
//wait for body to render first
cy.get("#storybook-root button")
cy.get("#storybook-root button");

cy.get("body")
.pasteFile(fileName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe("UploadPreview - Crop", () => {

//have to use autoupload false since react18 - in cypress, upload doesnt cause preSend HOC's effect to run on time - need another click
cy.setUploadOptions({ autoUpload: false });
}
};

it("should show upload crop before upload", () => {
loadPage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe("UploadPreview - Simple", () => {
cy.visitStory(
"uploadPreview",
"simple",
{ customArgs: { maxPreviewSize: 1000 }}
{ customArgs: { maxPreviewSize: 1000 } }
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe("UploadPreview - Simple - Multiple files", () => {
.should("be.visible")
.should("have.length", 3)
.invoke("attr", "src")
.should("match", /blob:/)
.should("match", /blob:/);
}, 3, "button");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ export {
CROPPED_MAX_SIZE,
examineCroppedUploadReq,
examineFullUploadRequest,
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe("Uploader - PreSend Tests", () => {
cy.expect(request.headers).to.include({ "x-test": "aaa" });
})
.its("request.url")
.should("include", "?test=a")
.should("include", "?test=a");


cy.wait("@uploadReq")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe("Uploader - recover from sender error test", () => {
it("should upload again after unexpected sender error", () => {
uploadFile(fileName, () => {
uploadFile(fileName, () => {
cy.waitMedium()
cy.waitMedium();

cy.storyLog().assertLogPattern(ITEM_START, { times: 2 });
cy.storyLog().assertLogPattern(ITEM_ERROR, { times: 2 });
Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/uploady/Uploady-custom-success-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("Uploady - Custom Success", () => {
cy.setUploadOptions({ isSuccessfulCall: (xhr) => xhr.status === 308 });

uploadFile(fileName, () => {
cy.wait("@uploadReq")
cy.wait("@uploadReq");

cy.waitShort();
cy.storyLog().assertFileItemStartFinish(fileName, 1);
Expand All @@ -44,7 +44,7 @@ describe("Uploady - Custom Success", () => {
cy.setUploadOptions({ isSuccessfulCall: async (xhr) => xhr.status === 308 });

uploadFile(fileName, () => {
cy.wait("@uploadReq")
cy.wait("@uploadReq");

cy.waitShort();
cy.storyLog().assertFileItemStartFinish(fileName, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe("Uploady - Custom Response Formatter", () => {
intercept();

uploadFile(fileName, () => {
cy.wait("@uploadReq")
cy.wait("@uploadReq");

cy.storyLog().assertLogEntryContains(2, {
uploadResponse: {
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/uploady/Uploady-simple-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe("Uploady - Simple", () => {
intercept();

uploadFile(fileName, () => {
cy.wait("@uploadReq")
cy.wait("@uploadReq");

cy.storyLog().assertFileItemStartFinish(fileName, 1);

Expand Down
4 changes: 2 additions & 2 deletions cypress/support/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
// Alternatively you can use CommonJS syntax:
// require('./commands')
import "cypress-intercept-formdata";
import { mount } from "cypress/react18"
import { mount } from "cypress/react18";

Cypress.Commands.add("mount", mount)
Cypress.Commands.add("mount", mount);

// Example use:
// cy.mount(<MyComponent />)
14 changes: 7 additions & 7 deletions cypress/support/storyLog.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ Cypress.Commands.add("customAssertLogEntry", { prevSubject: true }, (storyLog, e
logLine = logLine.args.slice(1);
} else {
const item = storyLog.find((item) => item.args[0] === eventName);
expect(item, `expect to find log line for event: ${eventName}`).to.not.be.undefined
expect(item, `expect to find log line for event: ${eventName}`).to.not.be.undefined;
logLine = item.args.slice(1);
}
} catch (ex) {
throw new StoryLogError(`Failed to custom assert log entry: ${eventName}. log[${storyLog.length} items]: ${JSON.stringify(storyLog)}`, ex)
throw new StoryLogError(`Failed to custom assert log entry: ${eventName}. log[${storyLog.length} items]: ${JSON.stringify(storyLog)}`, ex);
}

asserter(logLine, storyLog._env);
Expand All @@ -153,14 +153,14 @@ const assertLogPattern = (storyLog, pattern, options = {}) => {
}, []);

if (~options.index) {
const inLine = matches.find(({index}) => index === options.index);
const inLine = matches.find(({ index }) => index === options.index);
expect(inLine.index, `expect pattern match to be in index: ${options.index}`).to.eq(options.index);
} else {
if (between[0] === between[1]) {
expect(matches.length).to.equal(options.times, `expect to find match: ${pattern} in log ${options.times} times`);
} else {
expect(matches.length).least(between[0], `expect to find match: ${pattern} in log at least: ${between[0]} times`);
expect(matches.length).most(between[1], `expect to find match: ${pattern} in log at most: ${between[1]} times`)
expect(matches.length).most(between[1], `expect to find match: ${pattern} in log at most: ${between[1]} times`);
}

if (options.different) {
Expand All @@ -171,18 +171,18 @@ const assertLogPattern = (storyLog, pattern, options = {}) => {
return same;
});

expect(found, "expect pattern matches to all be different").to.be.undefined
expect(found, "expect pattern matches to all be different").to.be.undefined;
}
}

return cy.wrap(matches);
}
};

Cypress.Commands.add("assertLogPattern", { prevSubject: true }, assertLogPattern);

Cypress.Commands.add("assertNoLogPattern", { prevSubject: true }, (storyLog, pattern, options = {}) =>
assertLogPattern(storyLog, pattern, { ...options, times: 0 }));

Cypress.Commands.add("resetStoryLog", {prevSubject: true}, (storyLog) => {
Cypress.Commands.add("resetStoryLog", { prevSubject: true }, (storyLog) => {
storyLog.splice(0, storyLog.length);
});
Loading

0 comments on commit 2f4cf5f

Please sign in to comment.