dukeluo / eslint-plugin-check-file

ESLint rules for consistent filename and folder. Allows you to enforce a consistent naming pattern for the filename and folder.

Home Page:https://www.npmjs.com/package/eslint-plugin-check-file

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Snake case - files starting with numbers

richard-mihalovic opened this issue · comments

Hi in our project we use SNAKE CASE and we have some files named like this:

0123.js
0001_file.js

Eslint shows these files like errors. Is there a reason why the file names can't start with number or be numbers only ?

/**
 * @example hello, hello_world
 */
const SNAKE_CASE = '+([a-z])*([a-z0-9])*(_+([a-z0-9]))';
commented

Hi @richard-mihalovic. In general, the convention for snake case naming does not permit identifiers to start with a number. While there is no specific technical limitation preventing file names from starting with a number or being numbers only, it is worth noting that it can hinder readability and make the code less intuitive to understand.

If, for some specific reason, you insist on using file names that start with numbers or consist entirely of numbers, you have the flexibility to define your own custom glob pattern to accommodate your case.