Files
headroom/frontend/node_modules/eslint-plugin-svelte/lib/rules/no-unknown-style-directive-property.js
Santhosh Janardhanan de2d83092e feat: Reinitialize frontend with SvelteKit and TypeScript
- 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
2026-02-17 16:19:59 -05:00

62 lines
2.1 KiB
JavaScript

import { createRule } from '../utils/index.js';
import { all as allKnownCSSProperties } from 'known-css-properties';
import { toRegExp } from '../utils/regexp.js';
import { hasVendorPrefix } from '../utils/css-utils/index.js';
export default createRule('no-unknown-style-directive-property', {
meta: {
docs: {
description: 'disallow unknown `style:property`',
category: 'Possible Errors',
recommended: true
},
schema: [
{
type: 'object',
properties: {
ignoreProperties: {
type: 'array',
items: {
type: 'string'
},
uniqueItems: true,
minItems: 1
},
ignorePrefixed: { type: 'boolean' }
},
additionalProperties: false
}
],
messages: {
unknown: "Unexpected unknown style directive property '{{property}}'."
},
type: 'problem'
},
create(context) {
const ignoreProperties = [...(context.options[0]?.ignoreProperties ?? [])].map(toRegExp);
const ignorePrefixed = context.options[0]?.ignorePrefixed ?? true;
const knownProperties = new Set(allKnownCSSProperties);
/** Checks whether given name is valid */
function validName(name) {
return (name.startsWith('--') ||
knownProperties.has(name) ||
ignoreProperties.some((r) => r.test(name)) ||
(ignorePrefixed && hasVendorPrefix(name)));
}
return {
SvelteStyleDirective(node) {
const prop = node.key.name;
if (validName(prop.name)) {
return;
}
context.report({
node: prop,
messageId: 'unknown',
data: {
property: prop.name
}
});
}
};
}
});