prettier-solidity / prettier-plugin-solidity

A Prettier plugin for automatically formatting your Solidity code.
https://t.me/+kgTgkFgIwJkwMjcx
MIT License
729 stars 73 forks source link

Node v14 Warning: Accessing non-existent property 'VERSION' #463

Closed PaulRBerg closed 3 years ago

PaulRBerg commented 3 years ago

I am shipping prettier-plugin-solidity with my solidity-template. When using the template with node v14 and above, I am getting these warnings:

(node:14555) Warning: Accessing non-existent property 'VERSION' of module exports inside circular dependency
    at emitCircularRequireWarning (node:internal/modules/cjs/loader:698:11)
    at Object.get (node:internal/modules/cjs/loader:712:5)
    at Object.<anonymous> (/Users/paulrberg/workspace/templates/solidity-template/node_modules/sc-istanbul/lib/command/help.js:9:37)
    at Module._compile (node:internal/modules/cjs/loader:1092:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
    at Module.load (node:internal/modules/cjs/loader:972:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:996:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at /Users/paulrberg/workspace/templates/solidity-template/node_modules/sc-istanbul/lib/util/factory.js:56:35
(node:14555) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency
    at emitCircularRequireWarning (node:internal/modules/cjs/loader:698:11)
    at Object.get (node:internal/modules/cjs/loader:712:5)
    at Object.<anonymous> (/Users/paulrberg/workspace/templates/solidity-template/node_modules/@solidity-parser/parser/dist/antlr4/RuleContext.js:32:46)
    at Module._compile (node:internal/modules/cjs/loader:1092:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
    at Module.load (node:internal/modules/cjs/loader:972:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:996:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (/Users/paulrberg/workspace/templates/solidity-template/node_modules/@solidity-parser/parser/dist/antlr4/PredictionContext.js:10:19)
(node:14555) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency
    at emitCircularRequireWarning (node:internal/modules/cjs/loader:698:11)
    at Object.get (node:internal/modules/cjs/loader:712:5)
    at Object.<anonymous> (/Users/paulrberg/workspace/templates/solidity-template/node_modules/@solidity-parser/parser/dist/antlr4/tree/Trees.js:15:49)
    at Module._compile (node:internal/modules/cjs/loader:1092:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
    at Module.load (node:internal/modules/cjs/loader:972:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:996:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (/Users/paulrberg/workspace/templates/solidity-template/node_modules/@solidity-parser/parser/dist/antlr4/RuleContext.js:126:13)
Creating Typechain artifacts in directory typechain for target ethers-v5
Successfully generated Typechain artifacts!
(node:14555) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency
    at emitCircularRequireWarning (node:internal/modules/cjs/loader:698:11)
    at Object.get (node:internal/modules/cjs/loader:712:5)
    at Object.<anonymous> (/Users/paulrberg/workspace/templates/solidity-template/node_modules/prettier-plugin-solidity/node_modules/antlr4/RuleContext.js:30:46)
    at Module._compile (node:internal/modules/cjs/loader:1092:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
    at Module.load (node:internal/modules/cjs/loader:972:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:996:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (/Users/paulrberg/workspace/templates/solidity-template/node_modules/prettier-plugin-solidity/node_modules/antlr4/PredictionContext.js:8:19)
(node:14555) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency
    at emitCircularRequireWarning (node:internal/modules/cjs/loader:698:11)
    at Object.get (node:internal/modules/cjs/loader:712:5)
    at Object.<anonymous> (/Users/paulrberg/workspace/templates/solidity-template/node_modules/prettier-plugin-solidity/node_modules/antlr4/tree/Trees.js:13:49)
    at Module._compile (node:internal/modules/cjs/loader:1092:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
    at Module.load (node:internal/modules/cjs/loader:972:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:996:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (/Users/paulrberg/workspace/templates/solidity-template/node_modules/prettier-plugin-solidity/node_modules/antlr4/RuleContext.js:122:13)

You can reproduce this by cloning my template, switching to commit b70050d and running NODE_OPTIONS="--trace-warnings" yarn run test.

I am not sure what is the solution for this. Related:

mattiaerre commented 3 years ago

oh, interesting. thanks for reporting this issue @paulrberg. We'll take a look

mattiaerre commented 3 years ago

it may be something related to istanbul? https://github.com/gotwarlost/istanbul/pull/940 // cc @fvictorio @Janther @paulrberg

fvictorio commented 3 years ago

This was fixed in the parser a while ago, it shouldn't keep happening :/ @paulrberg can you trade upgrading the dependency and check again?

PaulRBerg commented 3 years ago

I upgraded, but the warning didn't go away. Looks like solidity-coverage has the same problem.

(node:97946) Warning: Accessing non-existent property 'VERSION' of module exports inside circular dependency
    at emitCircularRequireWarning (node:internal/modules/cjs/loader:698:11)
    at Object.get (node:internal/modules/cjs/loader:712:5)
    at Object.<anonymous> (/Users/paulrberg/workspace/templates/solidity-template/node_modules/sc-istanbul/lib/command/help.js:9:37)
    at Module._compile (node:internal/modules/cjs/loader:1092:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
    at Module.load (node:internal/modules/cjs/loader:972:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:996:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at /Users/paulrberg/workspace/templates/solidity-template/node_modules/sc-istanbul/lib/util/factory.js:56:35
(node:97946) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency
    at emitCircularRequireWarning (node:internal/modules/cjs/loader:698:11)
    at Object.get (node:internal/modules/cjs/loader:712:5)
    at Object.<anonymous> (/Users/paulrberg/workspace/templates/solidity-template/node_modules/solidity-coverage/node_modules/@solidity-parser/parser/dist/antlr4/RuleContext.js:32:46)
    at Module._compile (node:internal/modules/cjs/loader:1092:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
    at Module.load (node:internal/modules/cjs/loader:972:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:996:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (/Users/paulrberg/workspace/templates/solidity-template/node_modules/solidity-coverage/node_modules/@solidity-parser/parser/dist/antlr4/PredictionContext.js:10:19)
(node:97946) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency
    at emitCircularRequireWarning (node:internal/modules/cjs/loader:698:11)
    at Object.get (node:internal/modules/cjs/loader:712:5)
    at Object.<anonymous> (/Users/paulrberg/workspace/templates/solidity-template/node_modules/solidity-coverage/node_modules/@solidity-parser/parser/dist/antlr4/tree/Trees.js:15:49)
    at Module._compile (node:internal/modules/cjs/loader:1092:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
    at Module.load (node:internal/modules/cjs/loader:972:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:996:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Object.<anonymous> (/Users/paulrberg/workspace/templates/solidity-template/node_modules/solidity-coverage/node_modules/@solidity-parser/parser/dist/antlr4/RuleContext.js:126:13)

Anyways, I'm closing this issue.