Jens Geyer created THRIFT-6321:
----------------------------------

             Summary: lib/ts and lib/js lint their tests and generated node 
code at the wrong language level
                 Key: THRIFT-6321
                 URL: https://issues.apache.org/jira/browse/THRIFT-6321
             Project: Thrift
          Issue Type: Bug
          Components: JavaScript - Library, TypeScript - Library
            Reporter: Jens Geyer


Two jshint targets in {{lib/ts/Gruntfile.js}} are configured below the language 
level of the code
they lint, so {{make -C lib/ts check}} fails on them once it gets that far
({{THRIFT-6317}} and {{THRIFT-6318}} are the two blockers in front of it):

h2. jshint:test -- ES6 against ES8 source

{code}
   Gruntfile.js
    160 |    },
              ^ 'Trailing comma in arguments lists' is only available in ES8 
(use 'esversion: 8').
   test/server_http.js
     56 | ...
   test/test_handler.js
    201 | ...
>> 3 errors in 3 files
{code}

The trailing commas come from prettier, which the repository runs over these 
files. The lint
level has to follow.

h2. jshint:gen_node_code -- no esversion at all

The target sets only {{node: true}}, so jshint assumes ES5 while the generated 
node code uses
ES6 globals:

{code}
>> 423 errors in 3 files
    366x 'Symbol' is not defined.
     45x 'Promise' is not defined.
     12x 'Set' is not defined.
{code}

h2. Same gap in lib/js

{{lib/js/Gruntfile.js}} declares {{gen_node_code}} the same way -- {{node: 
true}} and no
{{esversion}} -- so it carries the same defect. Its sibling target 
{{gen_node_es6_code}} does set
{{esversion: 6}}, which shows the intent.

h2. Verified

With {{esversion: 8}} on {{jshint:test}} and {{esversion: 6}} on 
{{jshint:gen_node_code}}, all
four jshint targets in lib/ts report "lint free" and the grunt run proceeds to 
the QUnit step.

Drafted with AI assistance (Claude Opus 5).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to