UNPKG

eslint-plugin-mdx

Version:
27 lines • 942 B
import path from 'node:path'; import { ENABLED_OPTION_SCHEMA, getRuleConfig } from './helpers.js'; export const noFileNameArticles = { meta: { type: 'problem', docs: { description: 'Disallow articles at the start of file names', }, schema: [ENABLED_OPTION_SCHEMA], }, create(context) { const config = getRuleConfig(context, 'no-file-name-articles'); if (!config) { return {}; } const stem = path.basename(context.filename, path.extname(context.filename)); const match = /^(?:the|teh|an?)\b/iu.exec(stem); if (match) { context.report({ loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 0 } }, message: `Unexpected file name starting with \`${match[0]}\`, remove it`, }); } return {}; }, }; //# sourceMappingURL=no-file-name-articles.js.map