diff --git a/.github/actions/actions-token-unused/index.js b/.github/actions/actions-token-unused/index.js index 42a9fce94..1f0420514 100644 --- a/.github/actions/actions-token-unused/index.js +++ b/.github/actions/actions-token-unused/index.js @@ -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"); diff --git a/.github/actions/versionLog/index.js b/.github/actions/versionLog/index.js index 06c75959b..442d68cde 100644 --- a/.github/actions/versionLog/index.js +++ b/.github/actions/versionLog/index.js @@ -17,9 +17,9 @@ const extractVersionLog = async () => { } catch (ex) { core.setFailed(ex.message); } -} +}; -extractVersionLog() +extractVersionLog(); // github = require("@actions/github"), //core.getInput('who-to-greet'); diff --git a/.storybook/main.ts b/.storybook/main.ts index 6d6d86abf..147dc8cd2 100644 --- a/.storybook/main.ts +++ b/.storybook/main.ts @@ -1,3 +1,4 @@ +/* eslint storybook/story-exports:0 storybook/csf-component:0*/ import path from "path"; import type { StorybookConfig } from "@storybook/react-webpack5"; diff --git a/cypress/component/upload-preview-ctest.js b/cypress/component/upload-preview-ctest.js index 6dd855204..4369eed64 100644 --- a/cypress/component/upload-preview-ctest.js +++ b/cypress/component/upload-preview-ctest.js @@ -103,7 +103,7 @@ const ItemPreviewWithCrop = withRequestPreSendUpdate((props) => { const WithFlush = () => { useBatchAddListener(() => { - console.log("FLUSH!!!!!") + console.log("FLUSH!!!!!"); flushSync(); }); diff --git a/cypress/integration/chunked-sender/ChunkedSender-Progress-spec.js b/cypress/integration/chunked-sender/ChunkedSender-Progress-spec.js index ab316cd47..1599055e5 100644 --- a/cypress/integration/chunked-sender/ChunkedSender-Progress-spec.js +++ b/cypress/integration/chunked-sender/ChunkedSender-Progress-spec.js @@ -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"; diff --git a/cypress/integration/chunked-uploady/ChunkedUploady-WithChunkEventHooks-spec.js b/cypress/integration/chunked-uploady/ChunkedUploady-WithChunkEventHooks-spec.js index 5cfa534c0..e16373ed9 100644 --- a/cypress/integration/chunked-uploady/ChunkedUploady-WithChunkEventHooks-spec.js +++ b/cypress/integration/chunked-uploady/ChunkedUploady-WithChunkEventHooks-spec.js @@ -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( @@ -57,7 +57,7 @@ describe("ChunkedUploady - WithChunkEventHooks", () => { ); intercept(); - doTest() + doTest(); }); it("should use chunked uploady with async chunk hooks", () => { diff --git a/cypress/integration/intercept.js b/cypress/integration/intercept.js index c79e3678d..478757959 100644 --- a/cypress/integration/intercept.js +++ b/cypress/integration/intercept.js @@ -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}`); diff --git a/cypress/integration/selectFiles.js b/cypress/integration/selectFiles.js index 831b121c7..f5c24ffe4 100644 --- a/cypress/integration/selectFiles.js +++ b/cypress/integration/selectFiles.js @@ -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); diff --git a/cypress/integration/tus-uploady/TusUploady-resume-event-spec.js b/cypress/integration/tus-uploady/TusUploady-resume-event-spec.js index fc951ce8d..59f14eecb 100644 --- a/cypress/integration/tus-uploady/TusUploady-resume-event-spec.js +++ b/cypress/integration/tus-uploady/TusUploady-resume-event-spec.js @@ -101,7 +101,7 @@ describe("TusUploady - Simple", () => { cy.get("@resumeReq") .then((req) => { expect(req).to.be.null; - }) + }); }, "#upload-button"); }, "#upload-button"); }); diff --git a/cypress/integration/tus-uploady/TusUploady-retry-spec.js b/cypress/integration/tus-uploady/TusUploady-retry-spec.js index 92c4beebe..ad29d1691 100644 --- a/cypress/integration/tus-uploady/TusUploady-retry-spec.js +++ b/cypress/integration/tus-uploady/TusUploady-retry-spec.js @@ -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: { diff --git a/cypress/integration/tus-uploady/TusUploady-send-data-spec.js b/cypress/integration/tus-uploady/TusUploady-send-data-spec.js index 13a73d7e0..9bd10328f 100644 --- a/cypress/integration/tus-uploady/TusUploady-send-data-spec.js +++ b/cypress/integration/tus-uploady/TusUploady-send-data-spec.js @@ -17,7 +17,7 @@ describe("TusUploady - Send Data", () => { tusSendOnCreate: true, } ); - } + }; const runTest = (chunkSize, isFileSmallerThanChunk = false) => { loadStory(chunkSize); diff --git a/cypress/integration/tus-uploady/tusIntercept.js b/cypress/integration/tus-uploady/tusIntercept.js index 684c2fa9a..31807114a 100644 --- a/cypress/integration/tus-uploady/tusIntercept.js +++ b/cypress/integration/tus-uploady/tusIntercept.js @@ -21,5 +21,5 @@ export const tusIntercept = (uploadUrl) => { "Upload-Length": "1", }, }, "resumeReq"); -} +}; diff --git a/cypress/integration/umd/core-ui-umd-spec.js b/cypress/integration/umd/core-ui-umd-spec.js index b56264006..6f19f17b6 100644 --- a/cypress/integration/umd/core-ui-umd-spec.js +++ b/cypress/integration/umd/core-ui-umd-spec.js @@ -10,7 +10,7 @@ describe("UMD UI CORE - Bundle", () => { }); it("should use uploady and upload file", () => { - intercept() + intercept(); uploadFile(fileName, () => { cy.wait("@uploadReq") diff --git a/cypress/integration/upload-button/UploadButton-form-spec.js b/cypress/integration/upload-button/UploadButton-form-spec.js index 8d80bf5c9..45492f8b5 100644 --- a/cypress/integration/upload-button/UploadButton-form-spec.js +++ b/cypress/integration/upload-button/UploadButton-form-spec.js @@ -11,7 +11,7 @@ describe("UploadButton - Form", () => { "uploadButton", "with-form", { useMock: false } - ) + ); }); it("should submit form with upload and other fields", () => { diff --git a/cypress/integration/upload-button/UploadButton-styled-spec.js b/cypress/integration/upload-button/UploadButton-styled-spec.js index 8e0a350c6..7df061c7c 100644 --- a/cypress/integration/upload-button/UploadButton-styled-spec.js +++ b/cypress/integration/upload-button/UploadButton-styled-spec.js @@ -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); diff --git a/cypress/integration/upload-drop-zone/UploadDropZone-3rd-party-spec.js b/cypress/integration/upload-drop-zone/UploadDropZone-3rd-party-spec.js index 4ea15aad7..392a3e707 100644 --- a/cypress/integration/upload-drop-zone/UploadDropZone-3rd-party-spec.js +++ b/cypress/integration/upload-drop-zone/UploadDropZone-3rd-party-spec.js @@ -23,7 +23,7 @@ describe("UploadDropZone - Simple", () => { const test = "!23"; loadStory(); - cy.setUploadOptions({ userData: { test} }); + cy.setUploadOptions({ userData: { test } }); dropFile(fileName, () => { cy.waitExtraShort(); diff --git a/cypress/integration/upload-drop-zone/UploadDropZone-custom-remove-spec.js b/cypress/integration/upload-drop-zone/UploadDropZone-custom-remove-spec.js index 76b4e7daa..79bb8db4d 100644 --- a/cypress/integration/upload-drop-zone/UploadDropZone-custom-remove-spec.js +++ b/cypress/integration/upload-drop-zone/UploadDropZone-custom-remove-spec.js @@ -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"); diff --git a/cypress/integration/upload-drop-zone/UploadDropZone-handle-only-files-spec.js b/cypress/integration/upload-drop-zone/UploadDropZone-handle-only-files-spec.js index 63143cb14..df4244b7b 100644 --- a/cypress/integration/upload-drop-zone/UploadDropZone-handle-only-files-spec.js +++ b/cypress/integration/upload-drop-zone/UploadDropZone-handle-only-files-spec.js @@ -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"); diff --git a/cypress/integration/upload-drop-zone/UploadDropZone-keep-on-child-spec.js b/cypress/integration/upload-drop-zone/UploadDropZone-keep-on-child-spec.js index 51364057a..c3faf18f3 100644 --- a/cypress/integration/upload-drop-zone/UploadDropZone-keep-on-child-spec.js +++ b/cypress/integration/upload-drop-zone/UploadDropZone-keep-on-child-spec.js @@ -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"); @@ -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"); @@ -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"); diff --git a/cypress/integration/upload-paste/UploadPaste-window-spec.js b/cypress/integration/upload-paste/UploadPaste-window-spec.js index d362c9630..707d66a55 100644 --- a/cypress/integration/upload-paste/UploadPaste-window-spec.js +++ b/cypress/integration/upload-paste/UploadPaste-window-spec.js @@ -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); diff --git a/cypress/integration/upload-preview/UploadPreview-crop-spec.js b/cypress/integration/upload-preview/UploadPreview-crop-spec.js index 547fe8885..9f19528a2 100644 --- a/cypress/integration/upload-preview/UploadPreview-crop-spec.js +++ b/cypress/integration/upload-preview/UploadPreview-crop-spec.js @@ -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(); diff --git a/cypress/integration/upload-preview/UploadPreview-simple-fallback-spec.js b/cypress/integration/upload-preview/UploadPreview-simple-fallback-spec.js index 18423e632..f8e9602e2 100644 --- a/cypress/integration/upload-preview/UploadPreview-simple-fallback-spec.js +++ b/cypress/integration/upload-preview/UploadPreview-simple-fallback-spec.js @@ -7,7 +7,7 @@ describe("UploadPreview - Simple", () => { cy.visitStory( "uploadPreview", "simple", - { customArgs: { maxPreviewSize: 1000 }} + { customArgs: { maxPreviewSize: 1000 } } ); }); diff --git a/cypress/integration/upload-preview/UploadPreview-simple-multiple-spec.js b/cypress/integration/upload-preview/UploadPreview-simple-multiple-spec.js index 87c26a047..2061570ef 100644 --- a/cypress/integration/upload-preview/UploadPreview-simple-multiple-spec.js +++ b/cypress/integration/upload-preview/UploadPreview-simple-multiple-spec.js @@ -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"); }); }); diff --git a/cypress/integration/upload-preview/examineCroppedUploadReq.js b/cypress/integration/upload-preview/examineCroppedUploadReq.js index 30649f8bd..184e88d28 100644 --- a/cypress/integration/upload-preview/examineCroppedUploadReq.js +++ b/cypress/integration/upload-preview/examineCroppedUploadReq.js @@ -24,4 +24,4 @@ export { CROPPED_MAX_SIZE, examineCroppedUploadReq, examineFullUploadRequest, -} +}; diff --git a/cypress/integration/uploader/Uploader-no-prepare-pollute-spec.js b/cypress/integration/uploader/Uploader-no-prepare-pollute-spec.js index 0c1773f85..66b9230ea 100644 --- a/cypress/integration/uploader/Uploader-no-prepare-pollute-spec.js +++ b/cypress/integration/uploader/Uploader-no-prepare-pollute-spec.js @@ -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") diff --git a/cypress/integration/uploader/Uploader-recover-from-error-spec.js b/cypress/integration/uploader/Uploader-recover-from-error-spec.js index 1eae80bb5..797a32c5f 100644 --- a/cypress/integration/uploader/Uploader-recover-from-error-spec.js +++ b/cypress/integration/uploader/Uploader-recover-from-error-spec.js @@ -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 }); diff --git a/cypress/integration/uploady/Uploady-custom-success-spec.js b/cypress/integration/uploady/Uploady-custom-success-spec.js index dc4cab22d..1a052d58a 100644 --- a/cypress/integration/uploady/Uploady-custom-success-spec.js +++ b/cypress/integration/uploady/Uploady-custom-success-spec.js @@ -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); @@ -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); diff --git a/cypress/integration/uploady/Uploady-customResponseFormat-spec.js b/cypress/integration/uploady/Uploady-customResponseFormat-spec.js index ff312907e..f7ce7a0d3 100644 --- a/cypress/integration/uploady/Uploady-customResponseFormat-spec.js +++ b/cypress/integration/uploady/Uploady-customResponseFormat-spec.js @@ -16,7 +16,7 @@ describe("Uploady - Custom Response Formatter", () => { intercept(); uploadFile(fileName, () => { - cy.wait("@uploadReq") + cy.wait("@uploadReq"); cy.storyLog().assertLogEntryContains(2, { uploadResponse: { diff --git a/cypress/integration/uploady/Uploady-simple-spec.js b/cypress/integration/uploady/Uploady-simple-spec.js index 950a6ca74..d8eb9e9e0 100644 --- a/cypress/integration/uploady/Uploady-simple-spec.js +++ b/cypress/integration/uploady/Uploady-simple-spec.js @@ -22,7 +22,7 @@ describe("Uploady - Simple", () => { intercept(); uploadFile(fileName, () => { - cy.wait("@uploadReq") + cy.wait("@uploadReq"); cy.storyLog().assertFileItemStartFinish(fileName, 1); diff --git a/cypress/support/component.js b/cypress/support/component.js index c276e16fc..dd19df03e 100644 --- a/cypress/support/component.js +++ b/cypress/support/component.js @@ -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() diff --git a/cypress/support/storyLog.js b/cypress/support/storyLog.js index 805498194..188da1d92 100644 --- a/cypress/support/storyLog.js +++ b/cypress/support/storyLog.js @@ -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); @@ -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) { @@ -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); }); diff --git a/eslint.config.mjs b/eslint.config.mjs index cdd49e3ba..b72ea5fdd 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -3,12 +3,13 @@ import js from "@eslint/js"; import ts from "typescript-eslint"; import hermesParser from "hermes-eslint"; import importPlugin from "eslint-plugin-import"; -import react from "eslint-plugin-react"; -import jsxA11Y from "eslint-plugin-jsx-a11y"; -import reactHooks from "eslint-plugin-react-hooks"; -import noAsync from "eslint-plugin-no-async"; -import ftFlow from "eslint-plugin-ft-flow"; -import vitest from "eslint-plugin-vitest"; +import reactPlugin from "eslint-plugin-react"; +import jsxA11YPlugin from "eslint-plugin-jsx-a11y"; +import reactHooksPlugin from "eslint-plugin-react-hooks"; +import noAsyncPlugin from "eslint-plugin-no-async"; +import ftFlowPlugin from "eslint-plugin-ft-flow"; +import vitestPlugin from "eslint-plugin-vitest"; +import storybookPlugin from "eslint-plugin-storybook"; const JS_RULES_OVERRIDES = { quotes: [2, "double", { @@ -131,52 +132,73 @@ const JS_LANGUAGE_OPTIONS = { }; const SHARED_SETTINGS = { - ...ftFlow.configs.recommended.settings, + ...ftFlowPlugin.configs.recommended.settings, react: { version: "detect", flowVersion: "0.245", }, }; -const TS_CONFIG = ts.config( +const flatten = (configArr) => + configArr + .reduce((res, config) => { + res.rules = { + ...res.rules, + ...config.rules, + }; + res.languageOptions = { + ...res.languageOptions, + ...config.languageOptions, + }; + res.plugins = { + ...res.plugins, + ...config.plugins, + } + if (config.files) { + res.files = [ + ...(res.files || []), + ...config.files, + ]; + } + return res; + }, { rules: {}, languageOptions: {}, plugins: {}, files: undefined }); + +const TS_CONFIG = flatten(ts.config( js.configs.recommended, ...ts.configs.recommended, -).reduce((res, config) => { - res.rules = { - ...res.rules, - ...config.rules, - }; - res.languageOptions = { - ...res.languageOptions, - ...config.languageOptions, - }; - res.plugins = { - ...res.plugins, - ...config.plugins, - } +)); - return res; -}, { rules: {}, languageOptions: {}, plugins: {} }); +const SB_CONFIG = flatten(storybookPlugin.configs["flat/csf-strict"]); export default [ //Ignores { - ignores: ["**/lib/**", "**/dist/**", "**/*.story.js", "**/*.stories.js"], + ignores: [ + "**/lib/**", + "**/dist/**", + "**/*.story.js", + "**/*.stories.js", + "node_modules", + ".sb-static/**/*.*", + "bundle/*.*", + "cypress/examples/*.*", + "cypress/component/*.*", + ], }, //Source Code (JS/React) { ...js.configs.recommended, - files: ["**/*.js", "**/*.jsx"], - ignores: ["**/*.test.js", "**/*.test.jsx", "**/*.mock.js", "**/*.mock.jsx"], + files: ["packages/**/*.js", "packages/**/*.jsx"], + ignores: ["**/*.test.js", "**/*.test.jsx", "**/*.mock.js", "**/*.mock.jsx", "story-helpers/*.*"], "plugins": { - "ft-flow": ftFlow, - react, - "react-hooks": reactHooks, - "jsx-a11y": jsxA11Y, - "no-async": noAsync, + "ft-flow": ftFlowPlugin, + react: reactPlugin, + "react-hooks": reactHooksPlugin, + "jsx-a11y": jsxA11YPlugin, + "no-async": noAsyncPlugin, import: importPlugin, }, @@ -192,10 +214,10 @@ export default [ }, rules: { - ...react.configs.recommended.rules, - ...jsxA11Y.configs.recommended.rules, - ...reactHooks.configs.recommended.rules, - ...ftFlow.configs.recommended.rules, + ...reactPlugin.configs.recommended.rules, + ...jsxA11YPlugin.configs.recommended.rules, + ...reactHooksPlugin.configs.recommended.rules, + ...ftFlowPlugin.configs.recommended.rules, ...importPlugin.flatConfigs.recommended.rules, ...JS_RULES_OVERRIDES, @@ -207,10 +229,10 @@ export default [ //Unit Tests (VITEST) { - files: ["**/*.test.js", "**/*.test.jsx", "*.mock.jsx"], + files: ["packages/**/*.test.js", "packages/**/*.test.jsx", "packages/*.mock.jsx"], "plugins": { - vitest, + vitest: vitestPlugin, import: importPlugin, }, @@ -242,4 +264,40 @@ export default [ "no-async/no-async": 0 }, }, + + //Storybook + { + ...SB_CONFIG, + + files: [ + ...SB_CONFIG.files, + "story-helpers/*.js", + "story-helpers/*.jsx", + ], + + "plugins": { + "ft-flow": ftFlowPlugin, + react: reactPlugin, + ...SB_CONFIG.plugins, + }, + + ignores: ["packages/**/index.test-d.tsx", "/all-bundle-entry.js", "packages/**/src/**/*.js", "cypress/**/*.*"], + + languageOptions: { + ...JS_LANGUAGE_OPTIONS, + }, + + settings: { + ...SHARED_SETTINGS, + "ft-flow": { + "onlyFilesWithFlowAnnotation": true, + } + }, + + rules: { + ...SB_CONFIG.rules, + "storybook/default-exports": 0, + "no-console": 0, + } + } ]; diff --git a/package.json b/package.json index 1b3179a48..d05706eab 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "sb:serve": "http-server ./.sb-static -p 8001", "start": "pnpm sb:start", "flow": "flow --show-all-errors", - "lint": "eslint ./packages", + "lint": "eslint", "ensureTypes": "node scripts/ensureTypes.mjs", "types": "pnpm ensureTypes && tsc --outDir ./tstest", "test": "pnpm flow && pnpm lint && pnpm vitest:cov && pnpm types", diff --git a/scripts/extractChangeLogNotes.js b/scripts/extractChangeLogNotes.js index 7693ad29d..b9de9b87e 100644 --- a/scripts/extractChangeLogNotes.js +++ b/scripts/extractChangeLogNotes.js @@ -18,7 +18,7 @@ const extractChangelogNotesForVersion = (version) => { if (!~startIndex && tokens[i].tag === "h2" //use space so pre-release isn't matched against non-pre-release && tokens[i + 1]?.content.startsWith(version + " ")) { - startIndex = i + startIndex = i; } else if (!!~startIndex && tokens[i].tag === "h2" && tokens[i].type === "heading_open") { endIndex = i - 1; break; diff --git a/scripts/uploadyVersion.mjs b/scripts/uploadyVersion.mjs index fc3b4cf00..ba869b447 100644 --- a/scripts/uploadyVersion.mjs +++ b/scripts/uploadyVersion.mjs @@ -1,4 +1,4 @@ -import uploadyPkg from "../packages/ui/uploady/package.json" assert { type: "json" }; +import uploadyPkg from "../packages/ui/uploady/package.json" with { type: "json" }; const getUploadyVersion = () => { return uploadyPkg.version; diff --git a/story-helpers/ComponentsStyles.js b/story-helpers/ComponentsStyles.js index 6e9e9e7dc..3b6d996a3 100644 --- a/story-helpers/ComponentsStyles.js +++ b/story-helpers/ComponentsStyles.js @@ -28,4 +28,4 @@ const uploadUrlInputCss = css` export { uploadButtonCss, uploadUrlInputCss, -} +}; diff --git a/story-helpers/ProgressReportTable.js b/story-helpers/ProgressReportTable.jsx similarity index 99% rename from story-helpers/ProgressReportTable.js rename to story-helpers/ProgressReportTable.jsx index 3a920e1ce..bca8c85d5 100644 --- a/story-helpers/ProgressReportTable.js +++ b/story-helpers/ProgressReportTable.jsx @@ -29,7 +29,7 @@ const ProgressReportTable = ({ uploader }: { uploader: ?UploadyUploaderType }): return () => { if (uploader) { - console.log("UNREGISTERING uploader event listeners") + console.log("UNREGISTERING uploader event listeners"); offBatchProgress(); offItemProgress(); } diff --git a/story-helpers/ReactCropWithImage.js b/story-helpers/ReactCropWithImage.jsx similarity index 100% rename from story-helpers/ReactCropWithImage.js rename to story-helpers/ReactCropWithImage.jsx diff --git a/story-helpers/StoryAbortButton.jsx b/story-helpers/StoryAbortButton.jsx index 94b7126ab..fdd30e5bc 100644 --- a/story-helpers/StoryAbortButton.jsx +++ b/story-helpers/StoryAbortButton.jsx @@ -11,7 +11,7 @@ import { useItemFinalizeListener, } from "@rpldy/shared-ui"; -const ListItem = ({ id, file, state, index}) => { +const ListItem = ({ id, file, state, index }) => { const abortItem = useAbortItem(); return ( @@ -59,7 +59,7 @@ const StoryAbortButton = () => { } setBatches((prevBatches) => - prevBatches.map((b) => b.id === batch.id ? {...b, aborted: isAborted, finished: true } : b)); + prevBatches.map((b) => b.id === batch.id ? { ...b, aborted: isAborted, finished: true } : b)); }); useAllAbortListener(() => { @@ -96,7 +96,7 @@ const StoryAbortButton = () => { {items.map((item, i) => )} - + ; }; export default StoryAbortButton; diff --git a/story-helpers/UmdBundleScript.jsx b/story-helpers/UmdBundleScript.jsx index 45b3cb901..27153e12a 100644 --- a/story-helpers/UmdBundleScript.jsx +++ b/story-helpers/UmdBundleScript.jsx @@ -1,5 +1,5 @@ import React, { useState, memo } from "react"; -import useScript from "./useScript" +import useScript from "./useScript"; import { UMD_NAMES } from "./consts"; const BASE = "http://localhost:8009/", diff --git a/story-helpers/Welcome.js b/story-helpers/Welcome.jsx similarity index 91% rename from story-helpers/Welcome.js rename to story-helpers/Welcome.jsx index b45bd4958..c5b3fbc91 100644 --- a/story-helpers/Welcome.js +++ b/story-helpers/Welcome.jsx @@ -131,12 +131,12 @@ const WelcomeReactUploady = () => {