chore: add eslint, prettier and a CI pipeline

This commit is contained in:
Ashhhleyyy 2022-11-10 14:56:31 +00:00
parent 5c2b5fe673
commit 1543f0ac79
Signed by: ash
GPG key ID: 83B789081A0878FB
7 changed files with 1106 additions and 1 deletions

38
.drone.yml Normal file
View file

@ -0,0 +1,38 @@
kind: pipeline
type: docker
name: Build
platform:
os: linux
arch: arm64
steps:
- name: Install dependencies
image: node-pnpm:16-alpine
commands:
- pnpm install --frozen-lockfile
- name: Check formatting
image: node-pnpm:16-alpine
commands:
- pnpm format:check
- name: Lint code
image: node-pnpm:16-alpine
commands:
- pnpm lint
- name: Build site
image: node-pnpm:16-alpine
commands:
- pnpm build
- name: Deploy site
image: alpine
commands:
- apk add curl ca-certificates zip
- cd dist && zip -r ../deploy.zip * && cd ..
- 'curl --fail --upload-file deploy.zip -H "Authorization: token $GITEA_TOKEN" https://git.ashhhleyyy.dev/api/packages/ash/generic/secsan/$DRONE_COMMIT_SHA/secsan.zip'
environment:
GITEA_TOKEN:
from_secret: GITEA_TOKEN
trigger:
event: [push]
branch: [main]

34
.eslintignore Normal file
View file

@ -0,0 +1,34 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
# lockfile
pnpm-lock.yaml
# CI
.pnpm-store
.drone.yml
# Config
.eslintrc.cjs
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

26
.eslintrc.cjs Normal file
View file

@ -0,0 +1,26 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: [
'eslint:recommended',
'preact',
'plugin:@typescript-eslint/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: ['@typescript-eslint'],
rules: {
'@typescript-eslint/no-non-null-assertion': 'off',
},
settings: {
jest: { version: 29 }
}
};

31
.prettierignore Normal file
View file

@ -0,0 +1,31 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
# lockfile
pnpm-lock.yaml
# CI
.pnpm-store
.drone.yml
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

8
.prettierrc Normal file
View file

@ -0,0 +1,8 @@
{
"jsxSingleQuote": true,
"semi": true,
"tabWidth": 4,
"useTabs": false,
"trailingComma": "es5",
"singleQuote": true
}

View file

@ -7,7 +7,10 @@
"dev": "vite", "dev": "vite",
"build": "tsc && vite build", "build": "tsc && vite build",
"preview": "vite preview", "preview": "vite preview",
"test": "vitest" "test": "vitest",
"format": "prettier --write .",
"format:check": "prettier --check .",
"lint": "eslint . --max-warnings 0"
}, },
"dependencies": { "dependencies": {
"@preact/signals": "^1.1.2", "@preact/signals": "^1.1.2",
@ -16,6 +19,11 @@
"devDependencies": { "devDependencies": {
"@preact/preset-vite": "^2.4.0", "@preact/preset-vite": "^2.4.0",
"@types/node": "^18.11.9", "@types/node": "^18.11.9",
"@typescript-eslint/eslint-plugin": "^5.42.1",
"@typescript-eslint/parser": "^5.42.1",
"eslint": "^8.27.0",
"eslint-config-preact": "^1.3.0",
"prettier": "^2.7.1",
"typescript": "^4.6.4", "typescript": "^4.6.4",
"vite": "^3.2.3", "vite": "^3.2.3",
"vite-plugin-pwa": "^0.13.3", "vite-plugin-pwa": "^0.13.3",

File diff suppressed because it is too large Load diff