All rules

Sheath rule

blade-view-reference-exists

Literal view names in Blade view directives must resolve through Laravel's configured view finder.
Package
Core
Category
Blade
Default severity
error by default
Auto-fix
Manual fix

#Why

A misspelled literal view name is deterministic. Laravel's view factory will throw when that render path is reached. Checking it while linting gives the author the failure at the quoted view name, before a request, queue worker, or mail render happens. Normal view paths, registered extensions, and namespaced hint paths use the same lookup rules as the application.

#Examples

#Reported

@include('partials.nva')
@includeWhen($signedIn, 'account.missing-banner')
@extends('layouts.ap')
@includeFirst(['themes.missing', 'themes.also-missing'])

The diagnostic covers only the quoted literal token, not the whole directive.

#Accepted or deliberately unresolved

@include('partials.nav')
{{-- Absence is the purpose of includeIf. --}}
@includeIf('optional.promotion')
{{-- Runtime-computed targets cannot be proven missing. --}}
@include($viewName)
@include('themes.'.config('app.theme'))
{{-- One existing fallback makes the group valid. --}}
@includeFirst(['tenant.header', 'defaults.header'])

#What Is Checked

The rule checks a literal target in these directive positions:

  • the first argument of @include, @includeIsolated, @extends, and @component;
  • the second argument of @includeWhen and @includeUnless;
  • the first argument of @each, plus its optional fourth empty-view argument unless that value begins with Laravel's raw| prefix;
  • every literal candidate in @includeFirst and @extendsFirst, reporting only when every candidate is missing.

@includeIf is never reported because a missing target is its documented optional case. Computed targets are skipped. For @includeFirst and @extendsFirst, any dynamic candidate makes the whole fallback set unknown, so the rule skips it.

For @includeWhen and @includeUnless, simple literal conditions are also used to prove an include unreachable. For example, @includeWhen(false, ...) and @includeUnless(true, ...) do not consult the finder at runtime and are not reported. Variables, constants, function calls, operators, and other computed conditions remain unknown; their missing view is reported because that render path can still be reached.

Only the legacy @component('view.name') directive is checked. Blade <x-...> component tags use separate alias, class, namespace, and anonymous component resolution and are not checked here.

#Laravel Availability

View-reference checks require a booted Laravel application using the standard FileViewFinder. No finding is reported when the application is unavailable or replaces the finder with a custom finder. Namespaced views use the active namespace hint paths.

Creating, removing, or renaming a candidate view updates subsequent results. Changes to view paths, namespace hints, and registered extensions also update which names resolve. Editing the contents of an existing view does not change its existence result.

#Related Rules