UNPKG

eslint-plugin-mdx

Version:
26 lines • 922 B
import path from 'node:path'; import { ENABLED_OPTION_SCHEMA, getRuleConfig } from './helpers.js'; export const noFileNameConsecutiveDashes = { meta: { type: 'problem', docs: { description: 'Disallow consecutive dashes in file names', }, schema: [ENABLED_OPTION_SCHEMA], }, create(context) { const config = getRuleConfig(context, 'no-file-name-consecutive-dashes'); if (!config) { return {}; } const stem = path.basename(context.filename, path.extname(context.filename)); if (/-{2,}/u.test(stem)) { context.report({ loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 0 } }, message: 'Unexpected consecutive dashes in a file name, expected `-`', }); } return {}; }, }; //# sourceMappingURL=no-file-name-consecutive-dashes.js.map