eslint-plugin-mdx
Version:
ESLint Plugin for MDX
26 lines • 953 B
JavaScript
import path from 'node:path';
import { ENABLED_OPTION_SCHEMA, getRuleConfig } from './helpers.js';
export const noFileNameMixedCase = {
meta: {
type: 'problem',
docs: {
description: 'Disallow mixed case in file names',
},
schema: [ENABLED_OPTION_SCHEMA],
},
create(context) {
const config = getRuleConfig(context, 'no-file-name-mixed-case');
if (!config) {
return {};
}
const stem = path.basename(context.filename, path.extname(context.filename));
if (stem && stem !== stem.toLowerCase() && stem !== stem.toUpperCase()) {
context.report({
loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 0 } },
message: 'Unexpected mixed case in file name, expected either lowercase or uppercase',
});
}
return {};
},
};
//# sourceMappingURL=no-file-name-mixed-case.js.map