Range information is inconsistent for Program nodes with leading whitespace
See original GitHub issue// espree 3.4.3
require('espree').parse('/* foo */ bar /* baz */', { range: true })
Output
{
"type": "Program",
"start": 0,
"end": 23,
"range": [
10,
13
],
"body": [
{
"type": "ExpressionStatement",
"start": 10,
"end": 13,
"range": [
10,
13
],
"expression": {
"type": "Identifier",
"start": 10,
"end": 13,
"range": [
10,
13
],
"name": "bar"
}
}
],
"sourceType": "script"
}
The Program
node has start: 0
and end: 23
, but its range
is [10, 13]
.
This happens because espree transforms the range
property to match Esprima’s behavior. The transformation is correct, but we should also update the start
and end
properties, since they’re equivalent in all other cases.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Docstring has inconsistent leading whitespace - Stack Overflow
1 Answer 1 · right. the error is due to the fact that the \n is interpreted as part of the string thereby...
Read more >TSC meeting 03-December-2020 · Issue #222 · eslint/tsc-meetings ...
Range information is inconsistent for Program nodes with leading whitespace espree#349 - not originally marked as breaking, but maybe should be? Breaking: acorn ......
Read more >XSL Transformations (XSLT) Version 3.0 - W3C
Abstract. This specification defines the syntax and semantics of XSLT 3.0, a language designed primarily for transforming XML documents into ...
Read more >5673 – header-rule whitespace munging semantics should be ...
this is a major bug Since the get("ALL") already clobbers whitespace on FWS, turning ranges of TABs, spaces and form-feeds(!?) into a single...
Read more >IO tools (text, CSV, HDF5, …) — pandas 1.5.2 documentation
Specifies whether or not whitespace (e.g. ' ' or '\t' ) will be used as ... This ensures that the columns are taken...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am working on this. This should probably be a breaking change.
This is already marked as accepted, so any volunteers? 😄