Skip to content

Commit

Permalink
chore: improve linting/formating workflow (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
colinlienard authored Jul 8, 2023
1 parent 95b5678 commit ac35f53
Show file tree
Hide file tree
Showing 55 changed files with 2,140 additions and 471 deletions.
3 changes: 1 addition & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ node_modules
.env
.env.*
!.env.example
/src-tauri

# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock

/src-tauri
16 changes: 14 additions & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
plugins: ['svelte3', '@typescript-eslint'],
plugins: ['svelte3', '@typescript-eslint', 'import'],
ignorePatterns: ['*.cjs'],
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
settings: {
Expand All @@ -19,6 +19,18 @@ module.exports = {
},
rules: {
'@typescript-eslint/no-unused-vars': [1, { argsIgnorePattern: '^_' }],
'no-console': ['warn', { allow: ['error'] }]
'no-console': ['warn', { allow: ['error'] }],
'import/order': [
'warn',
{
groups: ['external', 'unknown', 'internal', 'sibling', 'parent'],
pathGroups: [
{ pattern: '$.*', group: 'unknown' },
{ pattern: '~/lib/*', group: 'internal' }
],
alphabetize: { order: 'asc', caseInsensitive: true },
'newlines-between': 'never'
}
]
}
};
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
- name: Install dependencies
run: pnpm install
- name: Typecheck
run: pnpm check
run: pnpm typecheck
build-front:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ node_modules
.env
.env.*
!.env.example
src-tauri/target
/src-tauri

# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
Expand Down
14 changes: 14 additions & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example
/src-tauri

# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock
22 changes: 22 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"extends": ["stylelint-config-standard-scss", "stylelint-config-idiomatic-order"],
"plugins": ["stylelint-prettier"],
"overrides": [
{
"files": ["*.svelte"],
"extends": "stylelint-config-html/svelte"
}
],
"rules": {
"color-function-notation": "legacy",
"custom-property-empty-line-before": "never",
"no-descending-specificity": null,
"property-no-vendor-prefix": null,
"selector-pseudo-class-no-unknown": [
true,
{
"ignorePseudoClasses": ["global"]
}
]
}
}
7 changes: 6 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"recommendations": ["svelte.svelte-vscode", "dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
"recommendations": [
"svelte.svelte-vscode",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"stylelint.vscode-stylelint"
]
}
6 changes: 4 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": true,
"source.fixAll.stylelint": true
},
"eslint": {
"validate": ["svelte"]
},
"[svelte]": {
"editor.defaultFormatter": "svelte.svelte-vscode"
},
"svelte.enable-ts-plugin": true
"svelte.enable-ts-plugin": true,
"stylelint.validate": ["scss", "svelte"]
}
28 changes: 16 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@
"build": "vite build",
"build:tauri": "APP_ENV=tauri tauri build",
"build:vercel": "APP_ENV=vercel vite build",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"dev": "vite dev",
"dev:tauri": "APP_ENV=tauri tauri dev",
"format": "prettier --plugin-search-dir . --write .",
"lint": "pnpm lint:ts && pnpm lint:rs",
"lint-fix": "prettier --write . && eslint --fix . && stylelint --fix \"src/**/*.{scss,svelte}\"",
"lint:rs": "mkdir build && cd src-tauri && cargo clippy -- -Dwarnings --no-deps; cargo fmt -- --check",
"lint:ts": "prettier --plugin-search-dir . --check . && eslint --max-warnings=0 .",
"lint:ts": "prettier --check . && eslint --max-warnings=0 . && stylelint --max-warnings=0 \"src/**/*.{scss,svelte}\"",
"prepare": "svelte-kit sync",
"preview": "vite preview"
"preview": "vite preview",
"typecheck": "svelte-check --tsconfig ./tsconfig.json"
},
"dependencies": {
"@tauri-apps/api": "^1.4.0",
Expand All @@ -26,21 +24,27 @@
"devDependencies": {
"@sveltejs/adapter-static": "^2.0.2",
"@sveltejs/adapter-vercel": "^3.0.1",
"@sveltejs/kit": "^1.21.0",
"@sveltejs/kit": "^1.22.1",
"@tauri-apps/cli": "^1.4.0",
"@typescript-eslint/eslint-plugin": "^5.60.1",
"@typescript-eslint/parser": "^5.60.1",
"@typescript-eslint/eslint-plugin": "^5.61.0",
"@typescript-eslint/parser": "^5.61.0",
"eslint": "^8.44.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-svelte3": "^4.0.0",
"prettier": "^2.8.8",
"prettier-plugin-svelte": "^2.10.1",
"sass": "^1.63.6",
"svelte": "^4.0.1",
"svelte-check": "^3.4.4",
"stylelint": "^15.10.1",
"stylelint-config-html": "^1.1.0",
"stylelint-config-idiomatic-order": "^9.0.0",
"stylelint-config-standard-scss": "^10.0.0",
"stylelint-prettier": "^3.0.0",
"svelte": "^4.0.5",
"svelte-check": "^3.4.5",
"tslib": "^2.6.0",
"typescript": "^5.1.6",
"vite": "^4.3.9"
"vite": "^4.4.2"
},
"packageManager": "pnpm@8.6.0"
}
Loading

1 comment on commit ac35f53

@vercel
Copy link

@vercel vercel bot commented on ac35f53 Jul 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.