Skip to content

Commit

Permalink
chore: Write tests (#2)
Browse files Browse the repository at this point in the history
* chore: write tests

* chore: setup GitHub workflows

* chore: update eslint

* chore: CI

* increase vitest timeout

* prettier
  • Loading branch information
dulnan authored Oct 17, 2024
1 parent 98cf7e9 commit dfd06e4
Show file tree
Hide file tree
Showing 35 changed files with 8,719 additions and 8,562 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

9 changes: 0 additions & 9 deletions .eslintrc.cjs

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: ci

on:
push:
branches:
- main
pull_request:
branches:
- main

permissions: {}

jobs:
ci:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- run: npm ci

# https://github.com/vitejs/vite/blob/main/.github/workflows/ci.yml#L62
# Install playwright's binary under custom directory to cache
- name: Set Playwright path
run:
echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/playwright-bin" >>
$GITHUB_ENV

- name: Cache Playwright's binary
uses: actions/cache@v4
with:
# Playwright removes unused browsers automatically
# So does not need to add playwright version to key
key: ${{ runner.os }}-playwright-bin-v1
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}

- name: Install Playwright
# does not need to explicitly set chromium after https://github.com/microsoft/playwright/issues/14862 is solved
run: npx playwright-core install chromium

- run: npm run dev:prepare
- run: npm run typecheck
- run: npm run lint
- run: npm run prettier
- run: npm run test
- run: npm run prepack
- run: npm run dev:build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ lib
dist
.nuxt
playground/.nuxt
playground/.output
51 changes: 51 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'

// Run `npx @eslint/config-inspector` to inspect the resolved config interactively
export default createConfigForNuxt({
features: {
// Rules for module authors
tooling: true,
},
dirs: {
src: ['./playground'],
},
})
.override('nuxt/vue/rules', {
rules: {
'vue/no-v-html': 0,
'vue/multi-word-component-names': 'off',
'vue/no-empty-component-block': 'error',
'vue/padding-line-between-blocks': 'error',
'vue/no-v-for-template-key': 'error',
'vue/prefer-true-attribute-shorthand': 'error',
'vue/component-api-style': 'error',
'vue/block-lang': [
'error',
{
script: {
lang: 'ts',
},
},
],
'vue/block-order': [
'error',
{
order: [['script', 'template'], 'style'],
},
],
'vue/html-self-closing': [
'error',
{
html: {
void: 'always',
},
},
],
},
})
.override('nuxt/typescript/rules', {
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
},
})
Loading

0 comments on commit dfd06e4

Please sign in to comment.