Files
headroom/frontend/node_modules/eslint-plugin-svelte/lib/rules/no-unused-svelte-ignore.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

64 lines
2.4 KiB
JavaScript

import { getSvelteCompileWarnings } from '../shared/svelte-compile-warns/index.js';
import { createRule } from '../utils/index.js';
import { getSvelteIgnoreItems } from '../shared/svelte-compile-warns/ignore-comment.js';
import { VERSION as SVELTE_VERSION } from 'svelte/compiler';
import semver from 'semver';
export default createRule('no-unused-svelte-ignore', {
meta: {
docs: {
description: 'disallow unused svelte-ignore comments',
category: 'Best Practices',
recommended: true
},
schema: [],
messages: {
unused: 'svelte-ignore comment is used, but not warned',
missingCode: 'svelte-ignore comment must include the code'
},
type: 'suggestion'
},
create(context) {
const sourceCode = context.sourceCode;
if (!sourceCode.parserServices.isSvelte) {
return {};
}
const ignoreComments = [];
for (const item of getSvelteIgnoreItems(context)) {
if (item.code == null) {
context.report({
node: item.token,
messageId: 'missingCode'
});
}
else {
ignoreComments.push(item);
}
}
if (!ignoreComments.length) {
return {};
}
const warnings = getSvelteCompileWarnings(context);
if (warnings.kind === 'error') {
return {};
}
for (const unused of warnings.unusedIgnores) {
if (unused.code === 'reactive-component' && semver.satisfies(SVELTE_VERSION, '<5')) {
// Svelte v4 `reactive-component` warnings are not emitted
// when we use the `generate: false` compiler option.
// This is probably not the intended behavior of Svelte v4, but it's not going to be fixed,
// so as a workaround we'll ignore the `reactive-component` warnings.
// See https://github.com/sveltejs/eslint-plugin-svelte/issues/1192
continue;
}
context.report({
loc: {
start: sourceCode.getLocFromIndex(unused.range[0]),
end: sourceCode.getLocFromIndex(unused.range[1])
},
messageId: 'unused'
});
}
return {};
}
});