tidy-up-analysis
Rich Harris 1 year ago
parent 4e268e258f
commit af60821f1e

@ -8,15 +8,15 @@ import { merge } from '../visitors.js';
import Stylesheet from './css/Stylesheet.js';
import { warn } from '../../warnings.js';
import check_graph_for_cycles from './utils/check_graph_for_cycles.js';
import { validate_template } from './visitors/validate-template.js';
import { validate_a11y } from './visitors/validate-a11y.js';
import { validate_legacy } from './visitors/validate-legacy.js';
import { validate_runes } from './visitors/validate-runes.js';
import { common_visitors } from './visitors/common.js';
import { analyze_component_scope_legacy } from './visitors/analyze-component-scope-legacy.js';
import { analyze_component_scope_runes } from './visitors/analyze-component-scope-runes.js';
import { analyze_module_scope_runes } from './visitors/analyze-module-scope-runes.js';
import { validate_javascript_runes } from './visitors/validate-javascript-runes.js';
import { component_visitors } from './visitors/component.js';
import { validate_a11y } from './visitors/validate-a11y.js';
import { validate_legacy } from './visitors/validate-legacy.js';
import { validate_module } from './visitors/validate-module.js';
import { validate_runes } from './visitors/validate-runes.js';
import { validate_template } from './visitors/validate-template.js';
/**
* @param {import('#compiler').Script | null} script
@ -73,7 +73,7 @@ export function analyze_module(ast, options) {
/** @type {import('estree').Node} */ (ast),
{ scope },
// @ts-expect-error TODO clean this mess up
merge(set_scope(scopes), validate_javascript_runes, analyze_module_scope_runes)
merge(set_scope(scopes), validate_module, analyze_module_scope_runes)
);
/** @type {import('../types').RawWarning[]} */
@ -238,7 +238,7 @@ export function analyze_component(root, options) {
validate_a11y,
validate_runes,
analyze_component_scope_runes,
common_visitors
component_visitors
)
);
}
@ -283,7 +283,7 @@ export function analyze_component(root, options) {
validate_a11y,
validate_legacy,
analyze_component_scope_legacy,
common_visitors
component_visitors
)
);
}

@ -10,7 +10,7 @@ import { regex_starts_with_newline } from '../../patterns.js';
/**
* @param {Pick<import('#compiler').OnDirective, 'expression'| 'name' | 'modifiers'>} node
* @param {import('../types').Context} context
* @param {import('../types.js').Context} context
* @returns {null | import('#compiler').DelegatedEvent}
*/
function get_delegated_event(node, context) {
@ -123,7 +123,7 @@ function get_delegated_event(node, context) {
/**
* @param {import('estree').CallExpression} node
* @param {import('../types').Context} context
* @param {import('../types.js').Context} context
* @returns {boolean}
*/
function is_known_safe_call(node, context) {
@ -162,8 +162,8 @@ function is_known_safe_call(node, context) {
return false;
}
/** @type {import('../types').Visitors} */
export const common_visitors = {
/** @type {import('../types.js').Visitors} */
export const component_visitors = {
Attribute(node, context) {
if (node.value === true) return;

@ -5,9 +5,9 @@ import { validate_assignment, validate_call_expression, validate_export } from '
/**
* Validation that applies to .svelte.js files (TODO and <script context="module">?)
* @type {import('../types').Visitors}
* @type {import('../types.js').Visitors}
*/
export const validate_javascript_runes = {
export const validate_module = {
ExportSpecifier(node, { state }) {
validate_export(node, state.scope, node.local.name);
},

@ -1,7 +1,7 @@
import { error } from '../../../errors.js';
import { get_rune } from '../../scope.js';
import { validate_assignment, validate_call_expression, validate_export } from '../utils.js';
import { validate_javascript_runes } from './validate-javascript-runes.js';
import { validate_module } from './validate-module.js';
/**
* Validation that applies to components in runes mode
@ -93,5 +93,5 @@ export const validate_runes = {
}
},
// TODO move this
ClassBody: validate_javascript_runes.ClassBody
ClassBody: validate_module.ClassBody
};

Loading…
Cancel
Save