Blade lint?

Do roots have a lint for blade template engine or other suggestion vendor that compatible with acorn?

1 Like

There’s GitHub - shufo/prettier-plugin-blade: Format your blade template using Prettier but it’s been known that parsing and linting Blade can get a little unreliable/complicated/opinionated.

1 Like

I’ll take a look at that. Thank you :slight_smile:

If we add phpstan we can lint blade properly :heart:

so far i like what it does. sure if you misspell and have lint on save it can cause error. but i havent found a better linter for blade. :rocket:
id also want to add that there is a tailwind class sort plugin you can add while at it.

.prettierrc.json

{
  "plugins": [
    "prettier-plugin-tailwindcss",
    "@shufo/prettier-plugin-blade"
  ],
  "overrides": [
    {
      "files": [
        "*.blade.php"
      ],
      "options": {
        "parser": "blade",
        "wrapAttributes": "force-expand-multiline",
        "sortTailwindcssClasses": true,
        "tailwindcssConfigPath": "tailwind.config.cjs",
        "sortHtmlAttributes": "code-guide"
      }
    }
  ]
}

prettier:check

 ./node_modules/.bin/prettier --check "resources/views/**/*.blade.php"

prettier:format

 ./node_modules/.bin/prettier --write "resources/views/**/*.blade.php"