{"id":25171,"library":"directory-lint","title":"directory-lint","description":"A TypeScript-first library for validating and generating directory structures based on schema definitions. Current stable version is 2.0.3, with a regular release cadence. Key differentiators include zero dependencies, full TypeScript support, pattern matching with wildcards and regex, and a pluggable backend system. It supports two schema types: ValidateSchema for checking existing structures and GenerateSchema for creating them. Unlike similar tools, it focuses on schema-driven, programmatic validation rather than config-file-based linting, making it suitable for integration into build pipelines or scaffolding tools.","status":"active","version":"2.0.3","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","linter","validation","filesystem","directory-structure","architecture","lint","typescript"],"install":[{"cmd":"npm install directory-lint","lang":"bash","label":"npm"},{"cmd":"yarn add directory-lint","lang":"bash","label":"yarn"},{"cmd":"pnpm add directory-lint","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only; CommonJS require will fail. Use TypeScript or ES modules.","wrong":"const DirectoryLint = require('directory-lint')","symbol":"DirectoryLint","correct":"import { DirectoryLint } from 'directory-lint'"},{"note":"ValidateSchema is a type, not a runtime value. Use 'import type' for TypeScript.","wrong":"import { ValidateSchema } from 'directory-lint'","symbol":"ValidateSchema","correct":"import type { ValidateSchema } from 'directory-lint'"},{"note":"GenerateSchema is a type, not a runtime value. Use 'import type' for TypeScript.","wrong":"import { GenerateSchema } from 'directory-lint'","symbol":"GenerateSchema","correct":"import type { GenerateSchema } from 'directory-lint'"}],"quickstart":{"code":"import { DirectoryLint } from 'directory-lint';\nimport type { ValidateSchema } from 'directory-lint';\n\nconst schema: ValidateSchema = {\n  'src': {\n    type: 'directory',\n    required: true,\n    children: {\n      'index.ts': { type: 'file', required: true },\n      'components': { type: 'directory', required: false }\n    }\n  },\n  'package.json': { type: 'file', required: true }\n};\n\nconst linter = new DirectoryLint();\nconst result = await linter.validate('./my-project', schema, { ignore: ['node_modules', '.git'] });\nconsole.log('Valid:', result.valid, 'Errors:', result.errors);","lang":"typescript","description":"Shows how to validate a directory structure against a schema using DirectoryLint.validate() with ignore patterns."},"warnings":[{"fix":"Remove any previously passed options; use validate/generate options instead.","message":"Constructor now requires no arguments; instantiate with 'new DirectoryLint()'","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Switch to ES modules or use dynamic import() if you must use CommonJS.","message":"Dropped CommonJS support — package is ESM-only","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Replace all calls to .lint() with .validate().","message":"Renamed 'lint' method to 'validate'; 'generate' method added","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Remove custom backend option; the library now includes a built-in filesystem backend.","message":"Backend option 'fs' is no longer needed; use default file system backend","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Ensure case matches filesystem. For case-insensitive matching, use regex patterns.","message":"Schema keys are case-sensitive; file names must match exactly unless using patterns","severity":"gotcha","affected_versions":"*"},{"fix":"Provide correct base path; the library does not resolve relative to cwd automatically.","message":"The 'validate' function expects an absolute or relative path with proper basePath","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"search_vec":"'2.0.3':23 'architectur':99 'backend':46 'base':15,79 'build':87 'cadenc':28 'check':55 'config':77 'config-file-bas':76 'creat':61 'current':19 'definit':18 'depend':33 'differenti':30 'directori':2,13,97 'directory-lint':1 'directory-structur':96 'driven':71 'exist':56 'file':78 'filesystem':95 'first':7 'focus':67 'full':34 'generat':12 'generateschema':59 'includ':31 'integr':85 'javascript':92 'key':29 'librari':8 'lint':3,80,100 'linter':93 'make':81 'match':38 'pattern':37 'pipelin':88 'pluggabl':45 'programmat':72 'rather':74 'regex':42 'regular':26 'releas':27 'scaffold':90 'schema':17,51,70 'schema-driven':69 'similar':64 'stabl':20 'structur':14,57,98 'suitabl':83 'support':36,49 'system':47 'tool':65,91 'two':50 'type':52 'typescript':6,35,101 'typescript-first':5 'unlik':63 'valid':10,73,94 'validateschema':53 'version':21 'wildcard':40 'zero':32","created_at":"2026-05-01T13:43:23.079613+00:00","updated_at":"2026-05-01T13:43:23.079613+00:00","problems":[{"fix":"Use import statement or dynamic import('directory-lint') instead of require().","cause":"Package is ESM-only; using require() in CommonJS context.","error":"ERR_REQUIRE_ESM: require() of ES Module not supported"},{"fix":"Use 'import { DirectoryLint } from \"directory-lint\"' instead of default import.","cause":"Default export incorrectly imported; must import named export.","error":"TypeError: (0 , directory_lint.DirectoryLint) is not a constructor"},{"fix":"Use 'import type { ValidateSchema } from \"directory-lint\"'.","cause":"Using import instead of import type for a type-only export.","error":"TS2305: Module '\"directory-lint\"' has no exported member 'ValidateSchema'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/directory-lint","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-05-01","next_check":"2026-07-30","install_tag":null}}