Description
Initial checklist
- I read the support docs
- I read the contributing guide
- I agree to follow the code of conduct
- I searched issues and discussions and couldn’t find anything (or linked relevant results below)
Affected package
Steps to reproduce
Okay, this is very weird, when I try to repro, it works totally fine as you can see here:
https://stackblitz.com/edit/node-zqgpemoq?file=index.js
But I'm using the plugin in this repo and as you can see here the tests are failing, because the plugin throws the error TypeError: Cannot read properties of undefined (reading 'length')
.
You can also try by cloning the repo, checking out into tests
branch, cd .\packages\starlight-spell-checker\tests\fixtures\quotes-throw-error-invalid-content\
, pnpm i
and running pnpm astro build
. (I know this is a VERY BAD example for a repro, but I have no clue why it's just happening in this specific case...
Actual behavior
Plugin fails when smart has only 2 entries with TypeError: Cannot read properties of undefined (reading 'length')
Expected behavior
Plugin should return vfile correctly.
The issue gets fixed, when I add a safety mechanism:
- expected = markers[(stack.length - 1) % markers.length]
+ expected = markers[(stack.length - 1 + markers.length) % markers.length]
Runtime
Package manager
Operating system
Windows 11
Build and bundle tools
Astro
Activity