/* This file is generated by scripts/process-messages/index.js. Do not edit! */
import { warnings, ignore_stack, ignore_map, warning_filter } from './state.js';
import { CompileDiagnostic } from './utils/compile_diagnostic.js';
/** @typedef {{ start?: number, end?: number }} NodeLike */
class InternalCompileWarning extends CompileDiagnostic {
name = 'CompileWarning';
/**
* @param {string} code
* @param {string} message
* @param {[number, number] | undefined} position
*/
constructor(code, message, position) {
super(code, message, position);
}
}
/**
* @param {null | NodeLike} node
* @param {string} code
* @param {string} message
*/
function w(node, code, message) {
let stack = ignore_stack;
if (node) {
stack = ignore_map.get(node) ?? ignore_stack;
}
if (stack && stack.at(-1)?.has(code)) return;
const warning = new InternalCompileWarning(code, message, node && node.start !== undefined ? [node.start, node.end ?? node.start] : undefined);
if (!warning_filter(warning)) return;
warnings.push(warning);
}
export const codes = [
'a11y_accesskey',
'a11y_aria_activedescendant_has_tabindex',
'a11y_aria_attributes',
'a11y_autocomplete_valid',
'a11y_autofocus',
'a11y_click_events_have_key_events',
'a11y_consider_explicit_label',
'a11y_distracting_elements',
'a11y_figcaption_index',
'a11y_figcaption_parent',
'a11y_hidden',
'a11y_img_redundant_alt',
'a11y_incorrect_aria_attribute_type',
'a11y_incorrect_aria_attribute_type_boolean',
'a11y_incorrect_aria_attribute_type_id',
'a11y_incorrect_aria_attribute_type_idlist',
'a11y_incorrect_aria_attribute_type_integer',
'a11y_incorrect_aria_attribute_type_token',
'a11y_incorrect_aria_attribute_type_tokenlist',
'a11y_incorrect_aria_attribute_type_tristate',
'a11y_interactive_supports_focus',
'a11y_invalid_attribute',
'a11y_label_has_associated_control',
'a11y_media_has_caption',
'a11y_misplaced_role',
'a11y_misplaced_scope',
'a11y_missing_attribute',
'a11y_missing_content',
'a11y_mouse_events_have_key_events',
'a11y_no_abstract_role',
'a11y_no_interactive_element_to_noninteractive_role',
'a11y_no_noninteractive_element_interactions',
'a11y_no_noninteractive_element_to_interactive_role',
'a11y_no_noninteractive_tabindex',
'a11y_no_redundant_roles',
'a11y_no_static_element_interactions',
'a11y_positive_tabindex',
'a11y_role_has_required_aria_props',
'a11y_role_supports_aria_props',
'a11y_role_supports_aria_props_implicit',
'a11y_unknown_aria_attribute',
'a11y_unknown_role',
'bidirectional_control_characters',
'legacy_code',
'unknown_code',
'options_deprecated_accessors',
'options_deprecated_immutable',
'options_missing_custom_element',
'options_removed_enable_sourcemap',
'options_removed_hydratable',
'options_removed_loop_guard_timeout',
'options_renamed_ssr_dom',
'custom_element_props_identifier',
'export_let_unused',
'legacy_component_creation',
'non_reactive_update',
'perf_avoid_inline_class',
'perf_avoid_nested_class',
'reactive_declaration_invalid_placement',
'reactive_declaration_module_script_dependency',
'state_referenced_locally',
'store_rune_conflict',
'css_unused_selector',
'attribute_avoid_is',
'attribute_global_event_reference',
'attribute_illegal_colon',
'attribute_invalid_property_name',
'attribute_quoted',
'bind_invalid_each_rest',
'block_empty',
'component_name_lowercase',
'element_implicitly_closed',
'element_invalid_self_closing_tag',
'event_directive_deprecated',
'node_invalid_placement_ssr',
'script_context_deprecated',
'script_unknown_attribute',
'slot_element_deprecated',
'svelte_component_deprecated',
'svelte_element_invalid_this',
'svelte_self_deprecated'
];
/**
* Avoid using accesskey
* @param {null | NodeLike} node
*/
export function a11y_accesskey(node) {
w(node, 'a11y_accesskey', `Avoid using accesskey\nhttps://svelte.dev/e/a11y_accesskey`);
}
/**
* An element with an aria-activedescendant attribute should have a tabindex value
* @param {null | NodeLike} node
*/
export function a11y_aria_activedescendant_has_tabindex(node) {
w(node, 'a11y_aria_activedescendant_has_tabindex', `An element with an aria-activedescendant attribute should have a tabindex value\nhttps://svelte.dev/e/a11y_aria_activedescendant_has_tabindex`);
}
/**
* `<%name%>` should not have aria-* attributes
* @param {null | NodeLike} node
* @param {string} name
*/
export function a11y_aria_attributes(node, name) {
w(node, 'a11y_aria_attributes', `\`<${name}>\` should not have aria-* attributes\nhttps://svelte.dev/e/a11y_aria_attributes`);
}
/**
* '%value%' is an invalid value for 'autocomplete' on ``
* @param {null | NodeLike} node
* @param {string} value
* @param {string} type
*/
export function a11y_autocomplete_valid(node, value, type) {
w(node, 'a11y_autocomplete_valid', `'${value}' is an invalid value for 'autocomplete' on \`\`\nhttps://svelte.dev/e/a11y_autocomplete_valid`);
}
/**
* Avoid using autofocus
* @param {null | NodeLike} node
*/
export function a11y_autofocus(node) {
w(node, 'a11y_autofocus', `Avoid using autofocus\nhttps://svelte.dev/e/a11y_autofocus`);
}
/**
* Visible, non-interactive elements with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as `