Describe the bug
Code gets re-formatted (incorrectly) when running lint-staged. Specifically, code that was broken onto multiple lines gets reformatted onto one line, causing style/max-statements-per-line errors.
For example:
watch(isHydrated, () => {
nextTick(() => {
scrollY.value = window.scrollY
})
})
When running eslint --fix in lint-staged, the above becomes a single line. This does not happen when running lint in the terminal, nor does it happen on save so I suspect it's an issue that's tied to lint-staged, however lint-staged should be reading the same eslint config as VSCode.
The lint-staged command just runs eslint and stylelint (which shouldn't be linting <script></script>)
"lint-staged": {
"*.{js,ts,vue,scss,css}": [
"eslint --fix",
"stylelint \"**/*.{vue,css,scss}\" --fix"
]
}
Reproduction
https://stackblitz.com/edit/github-yosb9t?file=app.vue,package.json,.husky%2Fpre-commit,.husky%2F_%2F.gitignore,.husky%2F_%2Fhusky.sh,eslint.config.js
System Info
System:
OS: macOS 14.4.1
CPU: (10) arm64 Apple M1 Pro
Memory: 104.28 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.12.0 - ~/.nvm/versions/node/v18.12.0/bin/node
npm: 9.8.1 - ~/.nvm/versions/node/v18.12.0/bin/npm
Browsers:
Chrome: 124.0.6367.62
Safari: 17.4.1
Used Package Manager
npm
Validations
Describe the bug
Code gets re-formatted (incorrectly) when running lint-staged. Specifically, code that was broken onto multiple lines gets reformatted onto one line, causing
style/max-statements-per-lineerrors.For example:
When running eslint --fix in lint-staged, the above becomes a single line. This does not happen when running lint in the terminal, nor does it happen on save so I suspect it's an issue that's tied to lint-staged, however lint-staged should be reading the same eslint config as VSCode.
The lint-staged command just runs eslint and stylelint (which shouldn't be linting <script></script>)
Reproduction
https://stackblitz.com/edit/github-yosb9t?file=app.vue,package.json,.husky%2Fpre-commit,.husky%2F_%2F.gitignore,.husky%2F_%2Fhusky.sh,eslint.config.js
System Info
System: OS: macOS 14.4.1 CPU: (10) arm64 Apple M1 Pro Memory: 104.28 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 18.12.0 - ~/.nvm/versions/node/v18.12.0/bin/node npm: 9.8.1 - ~/.nvm/versions/node/v18.12.0/bin/npm Browsers: Chrome: 124.0.6367.62 Safari: 17.4.1Used Package Manager
npm
Validations