Files
headroom/frontend/node_modules/eslint-plugin-svelte/lib/rules/no-spaces-around-equal-signs-in-attribute.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

54 lines
1.8 KiB
JavaScript

import { createRule } from '../utils/index.js';
export default createRule('no-spaces-around-equal-signs-in-attribute', {
meta: {
docs: {
description: 'disallow spaces around equal signs in attribute',
category: 'Stylistic Issues',
recommended: false,
conflictWithPrettier: true
},
schema: [],
fixable: 'whitespace',
messages: {
noSpaces: 'Unexpected spaces found around equal signs.'
},
type: 'layout'
},
create(ctx) {
const source = ctx.sourceCode;
/**
* Returns source text between attribute key and value, and range of that source
*/
function getAttrEq(node) {
const keyRange = node.key.range;
const eqSource = /^[\s=]*/u.exec(source.text.slice(keyRange[1], node.range[1]))[0];
const valueStart = keyRange[1] + eqSource.length;
return [eqSource, [keyRange[1], valueStart]];
}
/**
* Returns true if string contains whitespace characters
*/
function containsWhitespace(string) {
return /\s/u.test(string);
}
return {
'SvelteAttribute, SvelteDirective, SvelteStyleDirective, SvelteSpecialDirective'(node) {
const [eqSource, range] = getAttrEq(node);
if (!containsWhitespace(eqSource))
return;
const loc = {
start: source.getLocFromIndex(range[0]),
end: source.getLocFromIndex(range[1])
};
ctx.report({
loc,
messageId: 'noSpaces',
*fix(fixer) {
yield fixer.replaceTextRange(range, '=');
}
});
}
};
}
});