Skip to content

Commit

Permalink
Merge pull request #11 from CriticalMoments/linting
Browse files Browse the repository at this point in the history
Linting
  • Loading branch information
scosman authored Jan 22, 2024
2 parents 8fdb7ff + 8caecf4 commit fde0506
Show file tree
Hide file tree
Showing 10 changed files with 263 additions and 16 deletions.
14 changes: 14 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ module.exports = {
ecmaVersion: 2020,
extraFileExtensions: ['.svelte']
},
overrides: [
{
files: ['*.svelte'],
parser: 'svelte-eslint-parser',
parserOptions: {
parser: {
// Specify a parser for each lang.
ts: '@typescript-eslint/parser',
js: 'espree',
typescript: '@typescript-eslint/parser'
}
}
}
],
env: {
browser: true,
es2017: true,
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Linting

on: [push]

env:
PUBLIC_SUPABASE_URL: 'https://fake_test_url.supabase.co'
PUBLIC_SUPABASE_ANON_KEY: 'fake_anon_key'
PRIVATE_SUPABASE_SERVICE_ROLE: 'fake_service_role'
PRIVATE_STRIPE_API_KEY: 'fake_strip_api_key'
PUBLIC_SITE_NAME: 'SaaS Starter Build Test'

jobs:
build_and_test:
name: Build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: NPM install
run: npm install

- name: Linting
run: npm run lint
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Build](https://github.com/CriticalMoments/CMSaasStarter/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/CriticalMoments/CMSaasStarter/actions/workflows/build.yml)
[![Format Check](https://github.com/CriticalMoments/CMSaasStarter/actions/workflows/format.yml/badge.svg?branch=main)](https://github.com/CriticalMoments/CMSaasStarter/actions/workflows/format.yml)
[![Linting](https://github.com/CriticalMoments/CMSaasStarter/actions/workflows/linting.yml/badge.svg?branch=main)](https://github.com/CriticalMoments/CMSaasStarter/actions/workflows/linting.yml)
[![License](https://img.shields.io/badge/License-MIT-brightgreen?labelColor=32383f)](https://github.com/CriticalMoments/CMSaasStarter/blob/main/LICENSE)

### SaaS Starter is an open source, fast, and free to host SaaS template / boilerplate
Expand Down Expand Up @@ -115,21 +116,29 @@ The result is a perfect Google PageSpeed Insights score in all categories!

### Get Started (Local Development)

To get started, fork this project!
To get started, fork and run this project!

```
## First fork the project on Github
git pull [Your Fork]
npm install
## Run the project
## Run the project locally in dev mode
npm run dev --
```

### Developer Environment

VSCode has a [nice plugin](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode).
VSCode has a [nice plugin](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode). [Extensions for other editors are available here.](https://sveltesociety.dev/tools#editor-support).

[Extensions for other editors are available here.](https://sveltesociety.dev/tools#editor-support)
Optionally add the lines below to the git hook file at the location `.git/hooks/pre-commit`. This will run linting and format checking before you commit. This ensures you find issues locally before the Github Action CI checks fail.

```
#!/bin/sh
set -e
npm run format_check
npm run lint
npm run build
```

### Setup Supabase

Expand Down
205 changes: 202 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/kit": "^1.27.6",
"@tailwindcss/typography": "^0.5.9",
"@typescript-eslint/parser": "^6.19.0",
"autoprefixer": "^10.4.15",
"daisyui": "^3.5.1",
"eslint": "^8.28.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
import { enhance, applyAction } from "$app/forms"
import { page } from "$app/stores"
export let data
let { session, supabase, profile } = data
const fieldError = (liveForm, name: String) => {
let errors = liveForm?.errorFields ?? []
return errors.includes(name)
Expand All @@ -20,7 +16,7 @@
export let dangerous = false
export let title: string = ""
export let message: string = ""
export let fields
export let fields: any
export let formTarget: string = ""
export let successTitle = "Success"
export let successBody = ""
Expand All @@ -31,7 +27,7 @@
const handleSubmit = () => {
loading = true
return async ({ update, result }) => {
let response = await update({ reset: false })
await update({ reset: false })
await applyAction(result)
loading = false
if (result.type === "success") {
Expand Down
Loading

0 comments on commit fde0506

Please sign in to comment.