- 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
68 lines
2.4 KiB
JavaScript
68 lines
2.4 KiB
JavaScript
import { getShared } from '../shared/index.js';
|
|
import { createRule } from '../utils/index.js';
|
|
import { isRegExp, toRegExp } from '../utils/regexp.js';
|
|
export default createRule('system', {
|
|
meta: {
|
|
docs: {
|
|
description: 'system rule for working this plugin',
|
|
category: 'System',
|
|
recommended: 'base'
|
|
},
|
|
schema: [],
|
|
messages: {},
|
|
type: 'problem'
|
|
},
|
|
create(context) {
|
|
const shared = getShared(context.filename);
|
|
if (!shared)
|
|
return {};
|
|
const directives = shared.newCommentDirectives({
|
|
ruleId: 'svelte/system'
|
|
});
|
|
const ignoreWarnings = context.settings?.svelte?.ignoreWarnings;
|
|
if (ignoreWarnings && !Array.isArray(ignoreWarnings)) {
|
|
context.report({
|
|
loc: { line: 1, column: 0 },
|
|
message: 'The `settings.svelte.ignoreWarnings` must be an array.'
|
|
});
|
|
return {};
|
|
}
|
|
const ignoreTests = [];
|
|
for (const ignoreWarning of Array.isArray(ignoreWarnings) ? ignoreWarnings : []) {
|
|
if (typeof ignoreWarning !== 'string') {
|
|
context.report({
|
|
loc: { line: 1, column: 0 },
|
|
message: 'The array element in the `settings.svelte.ignoreWarnings` must be a string.'
|
|
});
|
|
return {};
|
|
}
|
|
if (isRegExp(ignoreWarning)) {
|
|
const regexp = toRegExp(ignoreWarning);
|
|
ignoreTests.push((ruleId) => regexp.test(ruleId));
|
|
}
|
|
else {
|
|
ignoreTests.push((ruleId) => ruleId === ignoreWarning);
|
|
}
|
|
}
|
|
/** Checks wether given rule is ignore rule or not */
|
|
function isIgnoreRule(ruleId) {
|
|
return ignoreTests.some((test) => test(ruleId));
|
|
}
|
|
directives.disableBlock({ line: 1, column: 0 }, isIgnoreRule, {
|
|
loc: { line: 1, column: 0 }
|
|
});
|
|
return {
|
|
SvelteScriptElement(node) {
|
|
directives.enableBlock(node.startTag.loc.end, isIgnoreRule, {
|
|
loc: node.startTag.loc.end
|
|
});
|
|
if (node.endTag) {
|
|
directives.disableBlock(node.endTag.loc.start, isIgnoreRule, {
|
|
loc: node.endTag.loc.start
|
|
});
|
|
}
|
|
}
|
|
};
|
|
}
|
|
});
|