This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
According to ES6 specs, there are rules for "Automatic Semicolon Insertion" and the parser should use them to avoid signaling errors and warnings. The reference is http://www.ecma-international.org/ecma-262/6.0/#sec-automatic-semicolon-insertion As an example, if a source has these two lines, NB marks the second as error since the first one is not semicolon terminated: import {LooseParser} from "./state" import {isDummy} from "./parseutil"
Those warnings should be hints. You can enable/disable them. In your ES6 sample, the semicolons has to be there as (whenever there is import/export) it is module and module is always in strict mode.
*** Bug 262415 has been marked as a duplicate of this bug. ***
It's not a module definition but a simple usage on a node application: the code showed is taken from some random library in npm (it's not my own), and works fine on node. ES6 has no strict mode and semicolon are optional, that's why there is a specification to know how and when automatically apply it when not present. Pietr Pisl is working on updating the parser to better implement the specification so I think this bug should be left open until the new parser is complete.
I'm not working on new parser. I want to try changed the source code before parsing to pass it according ECMA6 spec. So we can replace the new line with semicolon before the parsing in these cases. I also agree with Petr Hejl that the code doesn't pass the ECMA6 spec, because module is in strict mode. Unfortunately the node js parser doesn't follow fully the spec .
(In reply to dusty from comment #3) > It's not a module definition but a simple usage on a node application: the > code showed is taken from some random library in npm (it's not my own), and > works fine on node. > > ES6 has no strict mode and semicolon are optional, that's why there is a > specification to know how and when automatically apply it when not present. http://www.ecma-international.org/ecma-262/6.0/#sec-strict-mode-code "Module code is always strict mode code." And note that import and export keyword may be only present in module. http://www.ecma-international.org/ecma-262/6.0/#sec-modules > > Pietr Pisl is working on updating the parser to better implement the > specification so I think this bug should be left open until the new parser > is complete. It won't be actually implemeting the spec; technically it would be violating it - it's nice that npm is handling such code and we'll try to do it during code sanitization but it's not ES6 source :(
Where may I see that ES6 strict mode requires semicolon?
In particular I can't find any rules about mandatory semicolons in the section: http://www.ecma-international.org/ecma-262/6.0/#sec-strict-mode-of-ecmascript Also, in the Lexical Grammar: http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-lexical-grammar I read: > The source text of an ECMAScript Script or Module is first converted into a sequence of input elements, and subsequently: > The use of multiple lexical goals ensures that there are no lexical ambiguities that would affect automatic semicolon insertion. So, according to specs, it is my understanding that semicolons are not mandatory in ES6 strict mode while, in fact, automatic semicolon insertion must be implemented. Please correct me if I misread the official documentation, thanks!
(In reply to dusty from comment #7) > In particular I can't find any rules about mandatory semicolons in the > section: > http://www.ecma-international.org/ecma-262/6.0/#sec-strict-mode-of-ecmascript > > Also, in the Lexical Grammar: > http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language- > lexical-grammar > > I read: > > The source text of an ECMAScript Script or Module is first converted into a sequence of input elements, > > and subsequently: > > The use of multiple lexical goals ensures that there are no lexical ambiguities that would affect automatic semicolon insertion. > > So, according to specs, it is my understanding that semicolons are not > mandatory in ES6 strict mode while, in fact, automatic semicolon insertion > must be implemented. > > Please correct me if I misread the official documentation, thanks! I'll look into that. I guess I overestimated ES6 strictness ;) That would possibly mean bug in parser we are using.
If it's a bug in the parser, we can possible fix it and provide the patch back to the parser project.
Fixed in web-main f9c9ce85e20c.
I'm using netbeans-trunk-nightly-201608150002 but the warning is still present. I need to manually disable warnings in the editor preferences to avoid it, but that should be automatic if ECMA6 or ECMA7 features are enabled.
(In reply to dusty from comment #11) > I'm using netbeans-trunk-nightly-201608150002 but the warning is still > present. > > I need to manually disable warnings in the editor preferences to avoid it, > but that should be automatic if ECMA6 or ECMA7 features are enabled. I'm not seeing hints for your original report. You should report the particular case for which you do see these. Thanks.