lint-fs
raw JSON → 1.2.10 verified Fri May 01 auth: no javascript
A tool to lint file system structures using regular expressions, enabling enforcement of directory and file naming conventions and project layout rules. Current stable version is 1.2.10, released in early 2023 with ongoing minor updates. It uses a YAML configuration file (lint-fs.yaml) and runs via npx. Differentiates from other linters by focusing on file system structure rather than code content, supporting ECMAScript regex patterns for flexible rules.
Common errors
error Error: No configuration file found. Expected lint-fs.yaml in project root. ↓
cause Missing or misnamed configuration file.
fix
Create a lint-fs.yaml file in your project's root directory with valid rules.
error Error: Invalid regex pattern in rule 'xyz': / ... / ↓
cause Malformed regular expression in configuration.
fix
Provide a valid ECMAScript regex string in the pattern field (e.g., '^[a-z]+$').
error Error: require() of ES modules is not supported. ↓
cause Attempting to use the package as a CommonJS module.
fix
Use the CLI via npx, not require(). The package is an ES module.
Warnings
gotcha Configuration file must be named lint-fs.yaml exactly and placed in project root. ↓
fix Rename your config file to lint-fs.yaml or use --config option if supported.
gotcha Regular expressions are applied against full relative paths from project root, not just file/directory names. ↓
fix Adjust regex patterns to match the full path (e.g., ^src/[a-z]+$ for directories under src).
gotcha Node engine requirement is 18.14.2 or higher, npm 9.5.0+. Older Node versions will fail to install or run. ↓
fix Update Node.js to v18.14.2+ and npm to v9.5.0+.
gotcha Package is CLI-only; there is no programmatic API for use within Node.js scripts. ↓
fix Use child_process.exec('npx lint-fs') if integration is needed.
Install
npm install lint-fs yarn add lint-fs pnpm add lint-fs Quickstart
npm install --save-dev lint-fs
# Create lint-fs.yaml in project root:
# rules:
# enforce-dir-case:
# pattern: "^[a-z]+$"
# path: "src/**"
# description: "Directories must be lowercase"
# Run:
npx lint-fs