Open bhabanissahoo1 opened 2 years ago
Hi @bhabanissahoo1 ,
Thanks for reporting! I transferred the issue to this repository since this will contain all the sarif-js-sdk related, this also includes the formatted.
@yongyan-gh , can you review this, pls?
I will take a look at this one, thanks.
Hi @bhabanissahoo1,
I tried I don't see the same error, quick question, should there be a \
between node_modules and @microsoft:
node node_modules\eslint\bin\eslint.js -f node_modules\@microsoft\eslint-formatter-sarif -o output.0.json -c config.0.json
this is what I tried, without it it does not match what I have in the disk. Let me know if adding it works for you?
output.0.json: { "version": "2.1.0", "$schema": "http://json.schemastore.org/sarif-2.1.0-rtm.4", "runs": [ { "tool": { "driver": { "name": "ESLint", "informationUri": "https://eslint.org", "rules": [ ], "version": "7.26.0" } }, "results": [ ] } ] }
This is a long standing issue with v8, not a problem with the formatter itself. JSON.stringify
ing large objects can result in out of memory errors.
Have you attempted to run with node's --max_old_space_size
set to a larger size?
This is a long standing issue with v8, not a problem with the formatter itself.
JSON.stringify
ing large objects can result in out of memory errors.Have you attempted to run with node's
--max_old_space_size
set to a larger size?
I have tried using this option and increased this to 8192 , But it didn't help.
please Make sure you have following libraries installed on the machine by using the following command :
npm list
+-- @microsoft/eslint-formatter-sarif@2.1.7 +-- @typescript-eslint/eslint-plugin@5.18.0 +-- babel-eslint@10.1.0 +-- eslint-plugin-vue@8.5.0 `-- eslint@7.26.0
Have you ensured following test and installed the node js in that folder ? please Make sure you have following libraries installed on the machine by using the following command :
npm list
+-- @microsoft/eslint-formatter-sarif@2.1.7 +-- @typescript-eslint/eslint-plugin@5.18.0 +-- babel-eslint@10.1.0 +-- eslint-plugin-vue@8.5.0 `-- eslint@7.26.0
Closed it by mistake
@bhabanissahoo1 below is running on my machine
We are facing issue while trying to use eslint parser to parse the js files and trying raise the issuesfrom JSON object to string using sarif formatter. Please go through following steps to reproduce:
Note : Some pre-requisites please install nodejs if your system doesn't have it please Make sure node version by following command: node -v v16.14.2
Steps to reproduce :
Please download and extract this nms-ui.zip file.
please go to nms-ui working directory. please open command prompt recommended to open in Administrator mode. please run following command to verify the version:
npm -v 8.5.0
npx eslint -v v7.26.0
please Make sure you have following libraries installed on the machine by using the following command :
npm list
+-- @microsoft/eslint-formatter-sarif@2.1.7 +-- @typescript-eslint/eslint-plugin@5.18.0 +-- babel-eslint@10.1.0 +-- eslint-plugin-vue@8.5.0 `-- eslint@7.26.0
finally run the following command :
node node_modules\eslint\bin\eslint.js -f node_modules\@microsoft\eslint-formatter-sarif -o output.0.json -c config.0.json .
The output will be having following Error :
Oops! Something went wrong! :(
ESLint: 7.26.0
RangeError: Invalid string length at JSON.stringify ()
at module.exports (C:\KW_Workspace\nms-ui\node_modules\@microsoft\eslint-formatter-sarif\sarif.js:282:17)
at Object.format (C:\KW_Workspace\nms-ui\node_modules\eslint\lib\eslint\eslint.js:612:24)
at printResults (C:\KW_Workspace\nms-ui\node_modules\eslint\lib\cli.js:179:30)
at async Object.execute (C:\KW_Workspace\nms-ui\node_modules\eslint\lib\cli.js:314:13)
at async main (C:\KW_Workspace\nms-ui\node_modules\eslint\bin\eslint.js:142:24)
The reason is the string object it is trying to stringify is having an array of million data. eslint is using microsoft sarif formatter to format the JSON object.
The reason behind this is the following code snippet available in the following path node_modules\@microsoft\eslint-formatter-sarif\sarif.js
return JSON.stringify(sarifLog, null, // replacer function 2 // # of spaces for indents ); nms-ui.zip