Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Conversation

Copy link

@matsudayousuke matsudayousuke commented Jul 16, 2025

Description

This PR fixes the "Invalid column number (column -1 requested)" error that occurs when using eslint-disable-line or eslint-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 in lib/styles/context/comment-directive/index.ts. This caused an error when ESLint's getIndexFromLoc method was called with this invalid column number, as it expects non-negative column values.

The error manifests as:

Parsing error: Invalid column number (column -1 requested) vue-scoped-css/no-parsing-error

This typically appears at the <style scoped> tag line in Vue SFC files.

Solution

Changed the column value from -1 to 0 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

  1. Fix in lib/styles/context/comment-directive/index.ts: Changed const column = -1; to const column = 0;
  2. Added test cases: Created comprehensive test cases to ensure eslint-disable comments don't cause parsing errors

Testing

  • All existing tests pass (833 tests)
  • Added new test cases specifically for this fix
  • Tested with various comment directive patterns:
    • /* eslint-disable-line */
    • /* eslint-disable-next-line */
    • Rule-specific directives like /* 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.

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.
Copy link

changeset-bot bot commented Jul 16, 2025

⚠️ 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /