Wrong source and sourceIndex for Sass interpolated selectors
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, sass
- Domain
- tooling
Research direction
Start with the inline Sass selector reproduction and the parser code that assigns source positions and sourceIndex to interpolated class nodes. Update the behavior so the interpolated selector reports the expected columns and index, then verify both the Sass and normal selector examples pass.
Written by the indexing model from the issue text.
Description
Repro:
test('Sass selector', '.#{$classname}', (t, tree) => {
const node = tree.nodes[0].nodes[0];
t.deepEqual(node.type, "class"); // Ok
t.deepEqual(node.value, "#{$classname}"); // Ok
t.deepEqual(node.source.start.column, 1); // Fail. Received: 5
t.deepEqual(node.source.end.column, 14); // Fail. Received: 18
t.deepEqual(node.sourceIndex, 0); // Fail. Received: 4
});
Compare with this selector that has the same length:
test('Normal selector', '.XXXclassnameX', (t, tree) => {
const node = tree.nodes[0].nodes[0];
t.deepEqual(node.type, "class"); // Ok
t.deepEqual(node.value, "XXXclassnameX"); // Ok
t.deepEqual(node.source.start.column, 1); // Ok
t.deepEqual(node.source.end.column, 14); // Ok
t.deepEqual(node.sourceIndex, 0); // Ok
});
I tried to look at the parser code to figure out what's wrong but I didn't manage to figure this one out.
- Dominant language
- JavaScript
- Stars
- 214
- Forks
- 63
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from postcss/postcss-selector-parser
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 3/5 1-2 days Newbie friendliness 74/100
-
postcss/postcss-selector-parser#332 · 1 reaction · 2 assignees ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
postcss/postcss-selector-parser#309 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
postcss/postcss-selector-parser#306 · 2 comments ·
All issues in postcss/postcss-selector-parser
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
docToolchain/docToolchain#1705 ·
-
Timezone select lists one option per character; duplicate "Failed" reason; shared tracker popover id Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
nightscout/nocturne#1414 ·
-
bug v2
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
modelcontextprotocol/inspector#2458 · 1 comment ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
carbon-design-system/ibm-products#9907 ·