Skip to content

Commit

Permalink
clean up code and set up better linting
Browse files Browse the repository at this point in the history
  • Loading branch information
gskorokhod committed Aug 18, 2024
1 parent 9068824 commit 4a348f6
Show file tree
Hide file tree
Showing 189 changed files with 3,152 additions and 2,618 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
name: Build test
on:
workflow_dispatch: # can be triggered manually
pull_request: # and for PRs
jobs:
build_site:
runs-on: ubuntu-latest
steps:
- name: Checkout
workflow_dispatch: # can be triggered manually
pull_request: # and for PRs
jobs:
build_site:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install dependencies
- name: Install dependencies
run: npm install
- name: build
env:
BASE_PATH: '/${{ github.event.repository.name }}'
- name: build
env:
BASE_PATH: "/${{ github.event.repository.name }}"
run: |
npm run build
33 changes: 16 additions & 17 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
name: Deploy to GitHub Pages
on:
workflow_dispatch: # can be triggered manually
push:
branches: 'main'
jobs:
build_site:
runs-on: ubuntu-latest
steps:
- name: Checkout
workflow_dispatch: # can be triggered manually
push:
branches: "main"
jobs:
build_site:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install dependencies
- name: Install dependencies
run: npm install
- name: build
env:
BASE_PATH: '/${{ github.event.repository.name }}'
- name: build
env:
BASE_PATH: "/${{ github.event.repository.name }}"
run: |
npm run build
- name: Deploy to the gh-pages branch
Expand All @@ -27,4 +27,3 @@ jobs:
branch: gh-pages
folder: build
clean: true

4 changes: 2 additions & 2 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ name: ESLint

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
branches: ["main"]
# schedule: If we need to run this regularly, we can uncomment this
# - cron: '33 8 * * 0'

Expand Down
4 changes: 1 addition & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
"trailingComma": "none",
"printWidth": 100,
"tabWidth": 2,
"plugins": [
"prettier-plugin-svelte"
],
"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
"overrides": [
{
"files": "*.svelte",
Expand Down
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "firefox",
"request": "launch",
"reAttach": true,
"name": "Run Firefox debugger",
"url": "http://localhost:5173/",
"webRoot": "${workspaceFolder}"
}
]
}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This app is written in Typescript for type-safety. See: [svelte & typescript](ht
- [Playwright](https://playwright.dev/) for end-to-end testing
- [Prettier](https://prettier.io/) for formatting
- ESLint for linting

See:

- [How do I test svelte apps?](https://svelte.dev/docs/faq#how-do-i-test-svelte-apps)
Expand All @@ -33,6 +33,7 @@ Install dependencies:
```
npm install
```

Run development server:

```bash
Expand Down
26 changes: 13 additions & 13 deletions components.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"$schema": "https://shadcn-svelte.com/schema.json",
"style": "default",
"tailwind": {
"config": "tailwind.config.js",
"css": "src/app.css",
"baseColor": "slate"
},
"aliases": {
"components": "$lib/components",
"utils": "$lib/utils"
},
"typescript": true
}
"$schema": "https://shadcn-svelte.com/schema.json",
"style": "default",
"tailwind": {
"config": "tailwind.config.js",
"css": "src/app.css",
"baseColor": "slate"
},
"aliases": {
"components": "$lib/components",
"utils": "$lib/utils"
},
"typescript": true
}
67 changes: 38 additions & 29 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,42 @@
import js from '@eslint/js';
import ts from 'typescript-eslint';
import svelte from 'eslint-plugin-svelte';
import prettier from 'eslint-config-prettier';
import globals from 'globals';
import js from "@eslint/js";
import prettier from "eslint-config-prettier";
import perfectionist from 'eslint-plugin-perfectionist'
import sonarjs from "eslint-plugin-sonarjs";
import svelte from "eslint-plugin-svelte";
import globals from "globals";
import ts from "typescript-eslint";

/** @type {import('eslint').Linter.FlatConfig[]} */
export default [
js.configs.recommended,
...ts.configs.recommended,
...svelte.configs['flat/recommended'],
prettier,
...svelte.configs['flat/prettier'],
{
languageOptions: {
globals: {
...globals.browser,
...globals.node
}
}
},
{
files: ['**/*.svelte'],
languageOptions: {
parserOptions: {
parser: ts.parser
}
}
},
{
ignores: ['build/', '.svelte-kit/', 'dist/', 'src/lib/components/ui']
}
js.configs.recommended,
...ts.configs.recommended,
...svelte.configs["flat/recommended"],
prettier,
...svelte.configs["flat/prettier"],
sonarjs.configs.recommended,
perfectionist.configs["recommended-natural"],
{
rules: {
"sonarjs/no-duplicate-string": "warn"
}
},
{
languageOptions: {
globals: {
...globals.browser,
...globals.node
}
}
},
{
files: ["**/*.svelte"],
languageOptions: {
parserOptions: {
parser: ts.parser
}
}
},
{
ignores: ["build/", ".svelte-kit/", "dist/", "src/lib/components/ui"]
}
];
Loading

0 comments on commit 4a348f6

Please sign in to comment.