https://github.com/ctf0/vscode-blade-linter
for personal use
https://github.com/ctf0/vscode-blade-linter
Last synced: over 1 year ago
JSON representation
for personal use
- Host: GitHub
- URL: https://github.com/ctf0/vscode-blade-linter
- Owner: ctf0
- License: mit
- Created: 2020-11-27T17:46:30.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-01-03T22:57:09.000Z (over 3 years ago)
- Last Synced: 2024-10-11T12:18:59.533Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Blade Linter
simple linters rules for blade via regex.
## Usage
- open `blade` file and run `Blade Linter: Lint`
## Rules
- remove trailing `,` in array
> `['one','two',]`
- add space before directive round brace `@..(`
> `@if (), @push (), ...`
- add new line after directive end
> `@endphp, @endif, ...`
- add one space to each side of curly braces
> `{!! $one !!}, {{ $one }}, {{-- $one --}}`
- add space after `,`
> `, ['one', $two]`
- surround `||` / `&&` / `??` / `=>` / `?:` with one space
> `$one || $two, $one && $two, $one ?? $two, ['k' => 'v'], $one ?: $two`
- surround `..?..:..` with one space
> `isset($one) ? 'yes' : 'no'`
- surround `--.--.--` with one space
> `$one . '|' . $two`
## Notes
- rules works as expected for my own needs, if u had any issues plz open a ticket.
- this is more of a search and replace, not a global formatter.
- u can test with [the demo file](demo/index.blade.php)
## Issues
- inline styles/javascript or font declaration might break, so watch out.