- Delete old Vite+Svelte frontend - Initialize new SvelteKit project with TypeScript - Configure Tailwind CSS v4 + DaisyUI - Implement JWT authentication with auto-refresh - Create login page with form validation (Zod) - Add protected route guards - Update Docker configuration for single-stage build - Add E2E tests with Playwright (6/11 passing) - Fix Svelte 5 reactivity with $state() runes Known issues: - 5 E2E tests failing (timing/async issues) - Token refresh implementation needs debugging - Validation error display timing
36 lines
1.3 KiB
JavaScript
36 lines
1.3 KiB
JavaScript
import { createRule } from '../utils/index.js';
|
|
import { extractStoreReferences } from './reference-helpers/svelte-store.js';
|
|
export default createRule('require-stores-init', {
|
|
meta: {
|
|
docs: {
|
|
description: 'require initial value in store',
|
|
category: 'Best Practices',
|
|
// Please refer to the following before setting recommended to true.
|
|
// https://github.com/sveltejs/eslint-plugin-svelte/issues/1073
|
|
recommended: false
|
|
},
|
|
schema: [],
|
|
messages: {
|
|
storeDefaultValue: `Always set a default value for svelte stores.`
|
|
},
|
|
type: 'suggestion'
|
|
},
|
|
create(context) {
|
|
return {
|
|
Program() {
|
|
for (const { node, name } of extractStoreReferences(context)) {
|
|
const minArgs = name === 'writable' || name === 'readable' ? 1 : name === 'derived' ? 3 : 0;
|
|
if (node.arguments.length >= minArgs ||
|
|
node.arguments.some((arg) => arg.type === 'SpreadElement')) {
|
|
continue;
|
|
}
|
|
context.report({
|
|
node,
|
|
messageId: 'storeDefaultValue'
|
|
});
|
|
}
|
|
}
|
|
};
|
|
}
|
|
});
|