Skip to content

Commit

Permalink
chore: move the project to sveltekit 2 - has no impact on the generat…
Browse files Browse the repository at this point in the history
…ed component
  • Loading branch information
orefalo committed Jun 13, 2024
1 parent e9366a7 commit 4186e36
Show file tree
Hide file tree
Showing 18 changed files with 1,880 additions and 1,997 deletions.
37 changes: 0 additions & 37 deletions .eslintrc.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#pnpm test
# pnpm test
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,17 +206,17 @@ To build the docs for production-ready version, you need to run `pnpm build`, an

### Developing

After setting (or update) the environment (discussed in the previous section), you may also excecute SvelteKit in development mode by running `pnpm dev`. This will open a Vite server that automatically changes the result in the browser when the code is updated (hot reload).
After setting (or update) the environment (discussed in the previous section), you may also excecute SvelteKit in development mode by running `pnpm dev`. This will open a Vite server that automatically changes the result in the browser when the code is updated.

### Commiting changes

We have very precise rules over how our git commit messages are formatted. This leads to **more readable messages** that are easy to follow when looking through the **project history**. We use the git messages to **auto-generate the change log**.
* run `pnpm commit`

The enforcement is made possible by the enablement of several tools which, when put together, enable strict goverance.
We have very precise rules over how our git commit messages are formatted. This leads to **more readable messages** that are easy to follow when looking through the **project history**. We use the git messages to **auto-generate the change log**.

Commits are accepted, as long as they comply to the _commit message format_ described below.

We also require the code to be well-formatted and to pass linting(i.e. minimal ts&svelte checks, plus additional code styling rules). Don't worry, the code is automatically being formatted and verified every time you commit your changes. In addition, when you push your commits to Github(by a PR or directly to the repo), your code will be verfied again by Github Actions with even more checks.
When you push your commits to Github (by a PR or directly to the repo), your code will be verfied again by Github Actions with code formatting and linting checks. be sure to properly use `pnpm format` and `pnpm lint`

To ease the development and to enforce the process of formatting the code, perform checks and formatting the commit message, you're advised to commit using the following steps:

Expand Down
75 changes: 75 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
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';

const __dirname = import.meta.dirname;
// import { readGitignoreFiles } from './scripts/read-gitignore-files.js';
// import { readGitignoreFiles } from 'eslint-ignore';
import pkg from 'eslint-gitignore';
const { readGitignoreFiles } = pkg;

function removeDuplicates(arr) {
return arr.filter((value, index, self) => self.indexOf(value) === index);
}

/** @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,
NodeJS: true
}
}
},
{
files: ['**/*.svelte'],
languageOptions: {
parserOptions: {
parser: ts.parser
}
}
},
{
ignores: removeDuplicates([
...readGitignoreFiles({ cwd: __dirname }),
'build/',
'**/.svelte-kit/',
'dist/',
'package/',
'**/_app/'
])
},
{
rules: {
// eqeqeq: 'error',
'prefer-const': ['error', { ignoreReadBeforeAssign: true }],
'@typescript-eslint/no-explicit-any': 'off',
// const _a = 'unused, with underscore, no warning'
// const b = 'unused, no underscore, warning'
// note you must disable the base rule
// as it can report incorrect errors
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'warn', // or "error"
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_'
}
],
// We need to use {@html} in the demo site for code highlight
'svelte/no-at-html-tags': 'off',
// css is global and incorrectly reported as unused by the linter
'svelte/valid-compile': 'off'
}
}
];
27 changes: 14 additions & 13 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@
"name": "example",
"version": "0.0.1",
"private": true,
"type": "module",
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"dev": "vite dev",
"preview": "vite preview"
},
"devDependencies": {
"@sveltejs/adapter-static": "^2.0.3",
"@sveltejs/kit": "^1.22.4",
"svelte": "^4.1.2",
"svelte-check": "^3.4.6",
"svelte-splitpanes": "^0.8.0",
"tslib": "^2.6.1",
"typescript": "^4.9.5",
"vite": "^4.4.8"
},
"type": "module"
"@sveltejs/adapter-static": "^3.0.1",
"@sveltejs/kit": "^2.5.10",
"@sveltejs/vite-plugin-svelte": "^3.1.1",
"svelte": "^4.2.18",
"svelte-check": "^3.8.0",
"svelte-splitpanes": "^0.8.2",
"tslib": "^2.6.3",
"typescript": "^5.4.5",
"vite": "^5.2.13"
}
}
Loading

0 comments on commit 4186e36

Please sign in to comment.