Catch Drupal routing.yml and services.yml errors before drush cr does
timaub's YAML Lint for Drupal is a VS Code extension that checks your Drupal YAML files point to code that exists: controller classes, @services, route names, permissions, libraries and CSS/JS files. Checked while you type, offline, with no PHP and no Drupal install.
Free: classes, methods, services and routes. Pro: permissions, libraries, asset files, module dependencies, menu parents and CSV export.
@service, underlined in the YAML and listed in the Problems panel.White screen after drush cr? It is usually one typo in a YAML file
"You have requested a non-existent service"
A service argument says @entity_type.manger, or a hook class name has one letter too many in my_module.services.yml. The container fails to build and the whole site goes down, sometimes only in production.
Drupal routing.yml error
_controller: '\Drupal\my_module\Controller\ReportControler::build'. Nothing complains until someone opens the page and gets a 500.
Route not found, library not found
A menu link points to my_module.setings, a library depends on core/drupal.dialogg, a JS file was renamed. The YAML is valid; its targets are not.
A JSON schema validates the shape of a YAML file. It cannot know whether the class, the service or the route it names exists. That is the gap this extension fills.
What it checks: Drupal services.yml validation and more
| Reference | Where | Edition |
|---|---|---|
| PHP class exists (PSR-4) | _controller, _form, _title_callback, _custom_access, service class, factory, menu link class, deriver | Free |
| Method exists | ::method of the same references (classes without parent or trait) | Free |
| Service is declared | @id in arguments, calls, factory, properties, configurator; parent, decorates, alias | Free |
| Route exists | links route_name, base_route, appears_on, info.yml configure | Free |
| YAML parses | every Drupal YAML file | Free |
| Permission is declared | routing _permission | Pro |
| Library exists | library dependencies, theme libraries, libraries-override, libraries-extend | Pro |
| CSS/JS file exists | *.libraries.yml css and js paths | Pro |
| Module dependency present | info.yml dependencies, base theme | Pro |
| Menu or tab parent exists | links.menu parent, links.task parent_id | Pro |
No noise when it cannot know. Open a single custom module and you get no warning about @entity_type.manager or system.admin: a check stays silent when the module or core it targets is not in the workspace, and when routes, services or permissions are built dynamically. No Twig and no PHP inheritance resolution in this version.
Free vs Pro
| Feature | Free | Pro |
|---|---|---|
| Classes, methods, services, routes, parse errors | Yes | Yes |
| Report view, workspace scan, multi-root | Yes | Yes |
| Permissions | No | Yes |
| Libraries and CSS/JS files | No | Yes |
| Module dependencies and base theme | No | Yes |
| Menu link and local task parents | No | Yes |
| CSV export of the report | No | Yes |
Privacy
timaub's YAML Lint for Drupal collects no data, never writes to your files and never runs PHP or Drush. Its only network request is the Pro license check with Polar; without a key there is none. Read the privacy policy.
FAQ
Do I need PHP, Drush or a running Drupal site?
No. The extension reads your YAML and PHP files as text and resolves classes by PSR-4 path. It works on a laptop with only VS Code.
Does it work offline?
Yes. Analysis is local. A Pro key is checked online when you enter it, then keeps working offline for 14 days after the last successful check.
It flags a service or route that my module builds in PHP.
Add the exact name to drupalYamlLint.knownServices or knownRoutes, or turn the rule off. Modules with route_callbacks, a route subscriber or a ServiceProvider are detected and left alone.
Does it replace the Drupal YAML schemas?
No, it complements them. Schemas check that keys and types are valid; this extension checks that the targets exist. Use both.
Is it an official Drupal project?
No. It is an independent tool, not affiliated with or endorsed by the Drupal Association. Drupal is a registered trademark of Dries Buytaert.
Try it on your next module
Install the free edition, open your module and look at the Problems panel.