eslint-plugin-mdx
Version:
ESLint Plugin for MDX
28 lines • 936 B
JavaScript
import { ENABLED_OPTION_SCHEMA, getRuleConfig } from './helpers.js';
export const definitionSpacing = {
meta: {
type: 'layout',
docs: {
description: 'Enforce spacing in definition labels',
},
schema: [ENABLED_OPTION_SCHEMA],
},
create(context) {
const config = getRuleConfig(context, 'definition-spacing');
if (!config) {
return {};
}
return {
MDDefinition(node) {
const match = / {2,}/u.exec(node.label);
if (match) {
context.report({
loc: node.loc,
message: `Unexpected \`${match[0].length}\` consecutive spaces in definition label, expected \`1\` space, remove \`${match[0].length - 1}\` spaces`,
});
}
},
};
},
};
//# sourceMappingURL=definition-spacing.js.map