@toptal/davinci-dir-lint
Linter for folder structure and naming.
Usage
Use it by installing yarn add @toptal/davinci-syntax
in your project.
davinci-syntax lint dir .
Configuration
The package comes with the default configuration:
{
"namespaces/*/*": "regex:^(apps|libs)$",
"namespaces": "kebab-case",
"apps": "kebab-case",
"libs": "kebab-case",
"hosts": "kebab-case"
}
Which means:
-
"namespaces/*/*": "regex:^(apps|libs)$"
✅ Valid:namespaces | └─── billing | └─── apps | └─── libs
❌ Invalid:namespaces | └─── billing | └─── utils | └─── core
-
"namespaces": "kebab-case"
✅ Valid:namespaces | └───billing-product
❌ Invalid:namespaces | └───billingProduct
Right now it's possible to change the default configuration only by contribution to Davinci.
Rules
Regexp
Regexp validation for folder names.
Example:
{
"namespaces": "regex:^(apps|libs)$"
}
kebab-case
Validates that folder names are in kebab-case.
Example:
{
"apps": "kebab-case"
}