You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
775 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("../utils");
exports.default = (0, utils_1.createRule)('require-each-key', {
meta: {
docs: {
description: 'require keyed `{#each}` block',
category: 'Best Practices',
recommended: false
},
schema: [],
messages: { expectedKey: 'Each block should have a key' },
type: 'suggestion'
},
create(context) {
return {
SvelteEachBlock(node) {
if (node.key == null) {
context.report({
node,
messageId: 'expectedKey'
});
}
}
};
}
});