This repository was archived by the owner on Jan 19, 2019. It is now read-only.
This repository was archived by the owner on Jan 19, 2019. It is now read-only.
"use strict"/etc directives should be labeled as such #267
Closed
Description
What version of TypeScript are you using?
2.3.2
What version of typescript-eslint-parser
are you using?
What code were you trying to parse?
"use strict";
"other directive";
What did you expect to happen?
I expected an AST indicating that these literals are part of a Directive Prologue.
What happened?
The AST doesn't differentiate between directive literals and non-directive literals. For example:
typescript-eslint-parser/tests/fixtures/ast/Tolerant-parse.json
Lines 4104 to 4167 in f5fcc87
For comparison, here are some other ASTs for "octal directive"
, both of which indicate that the literal is a directive:
- Babylon: http://astexplorer.net/#/gist/29393e8fc8313aa11944f9146ceca787/0c135e856c8212bfe68702ae122261ecd4d08330
- Flow: http://astexplorer.net/#/gist/29393e8fc8313aa11944f9146ceca787/a59985860d2ee2faef66046f1d22180364a2e53b
Discovered in prettier/prettier#1560 (comment)