-
-
Notifications
You must be signed in to change notification settings - Fork 14
fix: resolve "Invalid column number (column -1 requested)" error #401
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
fix: resolve "Invalid column number (column -1 requested)" error #401
Conversation
When processing eslint-disable-line or eslint-disable-next-line comment directives within CSS, the code was setting column value to -1. This caused an error when ESLint's getIndexFromLoc method was called with this invalid column number. Changed column value from -1 to 0 to indicate the start of the line, which is a valid column position. Fixes parsing errors that occur at <style scoped> tags in Vue SFC files.
Add test cases to ensure eslint-disable-line and eslint-disable-next-line comments in CSS don't cause 'Invalid column number' parsing errors.
⚠️ No Changeset found
Latest commit: c0c1f1c
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
Description
This PR fixes the "Invalid column number (column -1 requested)" error that occurs when using
eslint-disable-line
oreslint-disable-next-line
comments within<style>
blocks in Vue single-file components.Problem
When processing eslint-disable comment directives within CSS, the code was setting the column value to
-1
inlib/styles/context/comment-directive/index.ts
. This caused an error when ESLint'sgetIndexFromLoc
method was called with this invalid column number, as it expects non-negative column values.The error manifests as:
This typically appears at the
<style scoped>
tag line in Vue SFC files.Solution
Changed the column value from
-1
to0
to indicate the start of the line, which is a valid column position. This change maintains the functionality of applying directives to entire lines while providing a valid column number.Changes
lib/styles/context/comment-directive/index.ts
: Changedconst column = -1;
toconst column = 0;
Testing
/* eslint-disable-line */
/* eslint-disable-next-line */
/* eslint-disable-line vue-scoped-css/no-unused-selector */
Related Issues
This fixes the parsing errors that many users experience when using this plugin with Vue 3 projects, particularly visible when the
vue-scoped-css/no-parsing-error
rule is enabled.