From a22c43650b4ed67323a9d6b72d4348f9fee0840e Mon Sep 17 00:00:00 2001 From: Mishig Davaadorj Date: Mon, 25 Sep 2023 00:24:40 +0200 Subject: [PATCH 1/6] Implement node ci for sveltekit --- .github/workflows/lint-svelte-kit.yml | 30 +++++++++++++++++++ kit/.prettierrc | 1 - kit/package-lock.json | 14 +++++++++ kit/package.json | 6 ++-- kit/src/lib/CodeBlock.svelte | 1 + kit/src/lib/CopyButton.svelte | 2 +- kit/src/lib/CourseFloatingBanner.svelte | 4 +-- kit/src/lib/DocNotebookDropdown.svelte | 7 +++-- kit/src/lib/Docstring.svelte | 10 +++---- kit/src/lib/Dropdown.svelte | 6 +--- kit/src/lib/DropdownEntry.svelte | 2 +- kit/src/lib/DropdownMenu.svelte | 6 ++-- kit/src/lib/FrameworkContentBlock.svelte | 13 ++++---- kit/src/lib/FrameworkSwitch.svelte | 10 +++---- kit/src/lib/FrameworkSwitchCourse.svelte | 6 ++-- kit/src/lib/InferenceApi.svelte | 12 ++++---- kit/src/lib/PipelineIcon.svelte | 10 +++---- .../IconImageClassification.svelte | 8 ++--- .../IconSentenceSimilarity.svelte | 4 +-- .../PipelineIcons/IconTextGeneration.svelte | 4 +-- kit/src/lib/TokenizersLanguageContent.svelte | 8 ++--- kit/src/lib/Tooltip.svelte | 2 +- kit/src/lib/pipeline.ts | 4 ++- kit/src/lib/stores.ts | 7 ++--- kit/src/lib/tooltip.ts | 2 +- kit/src/lib/types.ts | 9 ++++++ 26 files changed, 116 insertions(+), 72 deletions(-) create mode 100644 .github/workflows/lint-svelte-kit.yml diff --git a/.github/workflows/lint-svelte-kit.yml b/.github/workflows/lint-svelte-kit.yml new file mode 100644 index 00000000..528bd0a4 --- /dev/null +++ b/.github/workflows/lint-svelte-kit.yml @@ -0,0 +1,30 @@ +name: SvelteKit Lint +on: + pull_request: + push: + branches: + - main + +jobs: + lint: + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: "18" + + - name: Install dependencies + run: npm install ci + working-directory: kit + + - name: Checking lint/format errors + run: npm run lint + working-directory: kit + + - name: Checking type errors + run: npm run check + working-directory: kit \ No newline at end of file diff --git a/kit/.prettierrc b/kit/.prettierrc index 7b1b699c..de36577e 100644 --- a/kit/.prettierrc +++ b/kit/.prettierrc @@ -3,6 +3,5 @@ "trailingComma": "es5", "printWidth": 100, "plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"], - "pluginSearchDirs": ["."], "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] } diff --git a/kit/package-lock.json b/kit/package-lock.json index ecfe86f9..18048c03 100644 --- a/kit/package-lock.json +++ b/kit/package-lock.json @@ -14,6 +14,8 @@ "@tailwindcss/aspect-ratio": "^0.4.2", "@tailwindcss/forms": "^0.5.6", "@tailwindcss/typography": "^0.5.10", + "@types/js-yaml": "^4.0.6", + "@types/node": "^20.6.5", "@typescript-eslint/eslint-plugin": "^6.7.2", "autoprefixer": "^10.4.14", "cheerio": "^1.0.0-rc.12", @@ -758,12 +760,24 @@ "integrity": "sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==", "dev": true }, + "node_modules/@types/js-yaml": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.6.tgz", + "integrity": "sha512-ACTuifTSIIbyksx2HTon3aFtCKWcID7/h3XEmRpDYdMCXxPbl+m9GteOJeaAkiAta/NJaSFuA7ahZ0NkwajDSw==", + "dev": true + }, "node_modules/@types/json-schema": { "version": "7.0.13", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.13.tgz", "integrity": "sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ==", "dev": true }, + "node_modules/@types/node": { + "version": "20.6.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.6.5.tgz", + "integrity": "sha512-2qGq5LAOTh9izcc0+F+dToFigBWiK1phKPt7rNhOqJSr35y8rlIBjDwGtFSgAI6MGIhjwOVNSQZVdJsZJ2uR1w==", + "dev": true + }, "node_modules/@types/pug": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/pug/-/pug-2.0.6.tgz", diff --git a/kit/package.json b/kit/package.json index a7b70f09..ceb60586 100644 --- a/kit/package.json +++ b/kit/package.json @@ -8,8 +8,8 @@ "preview": "vite preview", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", - "lint": "prettier --plugin-search-dir . --check . && eslint .", - "format": "prettier --plugin-search-dir . --write ." + "lint": "prettier --check --plugin prettier-plugin-svelte .", + "format": "prettier --write --plugin prettier-plugin-svelte ." }, "devDependencies": { "@sveltejs/adapter-auto": "^2.0.0", @@ -18,6 +18,8 @@ "@tailwindcss/aspect-ratio": "^0.4.2", "@tailwindcss/forms": "^0.5.6", "@tailwindcss/typography": "^0.5.10", + "@types/js-yaml": "^4.0.6", + "@types/node": "^20.6.5", "@typescript-eslint/eslint-plugin": "^6.7.2", "autoprefixer": "^10.4.14", "cheerio": "^1.0.0-rc.12", diff --git a/kit/src/lib/CodeBlock.svelte b/kit/src/lib/CodeBlock.svelte index 17405de9..2c3e72df 100644 --- a/kit/src/lib/CodeBlock.svelte +++ b/kit/src/lib/CodeBlock.svelte @@ -18,6 +18,7 @@ on:focus={handleMouseOver} on:mouseout={handleMouseOut} on:blur={handleMouseOut} + role="button" >