- 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
78 lines
2.8 KiB
JavaScript
78 lines
2.8 KiB
JavaScript
import { createRule } from '../utils/index.js';
|
|
import { parseStyleAttributeValue } from '../utils/css-utils/index.js';
|
|
export default createRule('require-optimized-style-attribute', {
|
|
meta: {
|
|
docs: {
|
|
description: 'require style attributes that can be optimized',
|
|
category: 'Best Practices',
|
|
recommended: false
|
|
},
|
|
schema: [],
|
|
messages: {
|
|
shorthand: 'It cannot be optimized because style attribute is specified using shorthand.',
|
|
comment: 'It cannot be optimized because contains comments.',
|
|
interpolationKey: 'It cannot be optimized because property of style declaration contain interpolation.',
|
|
complex: 'It cannot be optimized because too complex.'
|
|
},
|
|
type: 'suggestion'
|
|
},
|
|
create(context) {
|
|
return {
|
|
SvelteShorthandAttribute(node) {
|
|
if (node.key.name !== 'style') {
|
|
return;
|
|
}
|
|
context.report({
|
|
node,
|
|
messageId: 'shorthand'
|
|
});
|
|
},
|
|
SvelteAttribute(node) {
|
|
if (node.key.name !== 'style' || !node.value?.length) {
|
|
return;
|
|
}
|
|
const root = parseStyleAttributeValue(node, context);
|
|
if (!root) {
|
|
context.report({
|
|
node,
|
|
messageId: 'complex'
|
|
});
|
|
return;
|
|
}
|
|
for (const child of root.nodes) {
|
|
if (child.type === 'decl') {
|
|
if (child.unknownInterpolations.length) {
|
|
context.report({
|
|
node,
|
|
loc: child.loc,
|
|
messageId: 'complex'
|
|
});
|
|
}
|
|
else if (child.prop.interpolations.length) {
|
|
context.report({
|
|
node,
|
|
loc: child.prop.loc,
|
|
messageId: 'interpolationKey'
|
|
});
|
|
}
|
|
}
|
|
else if (child.type === 'comment') {
|
|
context.report({
|
|
node,
|
|
loc: child.loc,
|
|
messageId: 'comment'
|
|
});
|
|
}
|
|
else {
|
|
context.report({
|
|
node,
|
|
loc: child.loc,
|
|
messageId: 'complex'
|
|
});
|
|
}
|
|
}
|
|
}
|
|
};
|
|
}
|
|
});
|