We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
There's an issue with oxc-parser, where it incorrectly generates start/end column values:
oxc-parser
import Parser from 'oxc-parser' const code = ` const a = 'œœ' callOnce(a) ` const ast = Parser.parseSync(code, { sourceType: 'module', sourceFilename: 'test/nuxt/composables.test.ts' }) const secondStatement = ast.program.body[1] if (secondStatement && secondStatement.type === 'ExpressionStatement') { console.log(secondStatement.expression) console.log(code.slice(secondStatement.expression.start, secondStatement.expression.end)) // llOnce(a) }
maybe related: #7484
The text was updated successfully, but these errors were encountered:
The root cause is because Rust strings are utf8.
It seems like the usage of these spans are magic string manipulations. Let me investigate whether we can do this directly on the Rust side.
Sorry, something went wrong.
We also need a getter for accessing the source text by these spans on the Rust exposed to node.js.
I got that problem when trying to implement eslint/id-length rule (currently in development).
eslint/id-length
@Boshen maybe my experience helps here: when characters is unicode graphemes, they can be properly counted by unicode segmentation lib: https://docs.rs/unicode-segmentation/latest/unicode_segmentation/struct.Graphemes.html
I create specific function for that case:
fn count_graphemes(str: &str) -> usize { // if ascii count as usual if str.is_ascii() { return str.len(); } return str.graphemes(true).collect::<FxHashSet<_>>().len(); }
that helps properly count characters which is unicode graphemes and help you set proper span
Boshen
No branches or pull requests
There's an issue with
oxc-parser
, where it incorrectly generates start/end column values:maybe related: #7484
The text was updated successfully, but these errors were encountered: