Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflicts with lint-staged and stylelint #459

Closed
5 tasks done
m-shum opened this issue Apr 23, 2024 · 1 comment
Closed
5 tasks done

Conflicts with lint-staged and stylelint #459

m-shum opened this issue Apr 23, 2024 · 1 comment

Comments

@m-shum
Copy link

m-shum commented Apr 23, 2024

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

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
@antfu
Copy link
Owner

antfu commented May 2, 2024

Thank you for submitting the issue!

However, please also note that this is only a shared config where we can only make sure the default and recommended configs are working fine. We don't have the bandwidth to deal with custom configuration or rules conflicts. If you believe it's a bug in the rules, please create an issue to upstream plugins instead.

Thus, I am converting this to a discussion for now.

@antfu antfu changed the title Conflicts with lint-staged Conflicts with lint-staged and stylelint May 2, 2024
Repository owner locked and limited conversation to collaborators May 2, 2024
@antfu antfu converted this issue into discussion #470 May 2, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants