Skip to content

Commit

Permalink
Adds type and lint checks to CI (#903)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Afonso <[email protected]>
  • Loading branch information
atilafassina and danieljcafonso authored Sep 27, 2024
1 parent f996fa9 commit faf1ccd
Show file tree
Hide file tree
Showing 21 changed files with 520 additions and 209 deletions.
32 changes: 0 additions & 32 deletions .eslintrc.cjs

This file was deleted.

45 changes: 45 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"ignorePatterns": ["node_modules/", "dist/"],
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:solid/typescript"
],
"overrides": [
{
"env": {
"node": true
},
"files": [".eslintrc.{js,cjs}"],
"parserOptions": {
"sourceType": "script"
}
}
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "solid"],
"rules": {
"quotes": ["error", "double"],
"semi": "warn",
"@typescript-eslint/no-unused-vars": [
"error",
{
"args": "all",
"argsIgnorePattern": "^_",
"caughtErrors": "all",
"caughtErrorsIgnorePattern": "^_",
"destructuredArrayIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"ignoreRestSiblings": true
}
]
}
}
71 changes: 71 additions & 0 deletions .github/workflows/static_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: 🔍 Lint / Type Checks

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
- run: pnpm i
- uses: actions/cache/save@v4
with:
path: |
node_modules
~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}

typecheck:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
- uses: actions/cache/restore@v4
with:
path: |
node_modules
~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Generate virtual modules
run: pnpm sync
- name: TypeScript check
run: pnpm check:types

lint:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
- uses: actions/cache/restore@v4
with:
path: |
node_modules
~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: ESLint check
run: pnpm check:lint
3 changes: 2 additions & 1 deletion app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export default defineConfig({
crawlLinks: true,
autoSubfolderIndex: false,
failOnError: true,
// eslint-disable-next-line no-useless-escape
ignore: [/\{\getPath}/, /.*?emojiSvg\(.*/],
},
},
Expand All @@ -67,7 +68,7 @@ export default defineConfig({
docsData(),
vinxiMdx.withImports({})({
define: {
"import.meta.env": `'import.meta.env'`,
"import.meta.env": "'import.meta.env'",
},
jsx: true,
jsxImportSource: "solid-js",
Expand Down
13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"start": "vinxi start",
"e2e": "npx playwright test",
"build:lunaria": "lunaria build",
"preview:lunaria": "lunaria preview"
"preview:lunaria": "lunaria preview",
"check:lint": "eslint .",
"check:types": "tsc --noEmit"
},
"dependencies": {
"@kobalte/core": "^0.13.6",
Expand Down Expand Up @@ -47,17 +49,18 @@
"@orama/crawly": "^0.0.4",
"@tailwindcss/typography": "^0.5.15",
"@types/node": "^20.16.5",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"@typescript-eslint/eslint-plugin": "^8.7.0",
"@typescript-eslint/parser": "^8.7.0",
"autoprefixer": "^10.4.20",
"eslint": "^8.57.0",
"eslint": "^8.57.1",
"eslint-plugin-solid": "^0.13.2",
"prettier": "3.2.5",
"rehype-raw": "^7.0.0",
"remark-expressive-code": "^0.33.5",
"remark-frontmatter": "^5.0.0",
"remark-gfm": "^3.0.0",
"tailwindcss": "^3.4.11"
"tailwindcss": "^3.4.11",
"typescript": "^5.6.2"
},
"engines": {
"node": ">=18",
Expand Down
Loading

0 comments on commit faf1ccd

Please sign in to comment.