eslint-config
eslint-config copied to clipboard
Support for laravel blade files
Describe the bug
We tried configuring for .blade.php
files but the auto-formatting did not work. Is support for blade files not there yet or did we misconfigure our configs?
Reproduction
https://github.com/ci-on/eslint-example/blob/main/eslint.config.js#L18C3-L29C5
System Info
System:
OS: macOS 14.0
CPU: (10) arm64 Apple M2 Pro
Memory: 60.13 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v14.21.1/bin/yarn
npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
pnpm: 8.10.4 - ~/.nvm/versions/node/v14.21.1/bin/pnpm
bun: 1.0.17 - /opt/homebrew/bin/bun
Browsers:
Chrome: 119.0.6045.105
Safari: 17.0
Used Package Manager
npm
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guide.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
- [X] The provided reproduction is a minimal reproducible of the bug.
@glennmichael123 you gonna need prettier-plugin-blade installed
@Dimava this package right here?
https://github.com/shufo/prettier-plugin-blade
@glennmichael123 yep, prettier itself also uses plugins for languages that are not built-in (html/js/css/gql/md/yaml)
@Dimava thank you for your response and apologies for the late reply, I tried installing that - I wasn't able to make it work, without somehow having to press cmd + shift + I
, the desired output is just to make it behave the same way as JS/Vue files, which is to auto-format on save. I got nothing.
@glennmichael123 please update your example repo and link a couple of .blade files so I could try it
@Dimava updated it, i hope i knew what i was doing there 😅
https://github.com/ci-on/eslint-example
@Dimava
Hi, sorry for bothering you, were you able to take a look at the minimal reproduction and figure out something? Or do you need more info?
@glennmichael123
-
eslint-plugin-format
won't pick your.prettierrc
-
eslint-plugin-format
won't pick youroverrides
export default [{
files: ['**/*.blade.php'],
plugins: { format },
languageOptions: { parser: format.parserPlain },
rules: {
'format/prettier': ['error', {
// "plugins": ["@shufo/prettier-plugin-blade"], "trailingCommaPHP": true,, etc
...JSON.parse(readFileSync('./.prettierrc', 'utf8')),
// "parser": "blade", "tabWidth": 4
...JSON.parse(readFileSync('./.prettierrc', 'utf8')).overrides[0].options,
}],
},
}]