smartcontractkit / full-blockchain-solidity-course-js

Learn Blockchain, Solidity, and Full Stack Web3 Development with Javascript
12.25k stars 2.94k forks source link

locEnd error when running "yarn lint" at the end of the lesson 7 #3190

Closed MelihCK closed 1 year ago

MelihCK commented 1 year ago

Lesson

Lesson 7

Could you please leave a link to the timestamp in the video where this error occurs? (You can right click a video and "copy video URL at current time")

https://youtu.be/gyMwXuJrbJQ?t=44589

Operating System

Windows

Describe the bug

Hello, I get an error when I run "yarn lint" (like 12:23:09 in the video). I searched for a while on the internet and found some comments on this issue but still couldn't solve it.

Error:

TypeError: locEnd is not a function

Some relevant comments I find on the internet:

https://github.com/prettier/plugin-lua/issues/20 https://github.com/jhipster/prettier-java/issues/32 https://github.com/prettier/plugin-php/issues/1352 https://github.com/prettier-solidity/prettier-plugin-solidity/pull/47

My package.json file:

{
  "devDependencies": {
    "@chainlink/contracts": "^0.5.1",
    "@ethersproject/abi": "^5.4.7",
    "@ethersproject/providers": "^5.4.7",
    "@nomicfoundation/hardhat-chai-matchers": "^1.0.0",
    "@nomicfoundation/hardhat-network-helpers": "^1.0.0",
    "@nomicfoundation/hardhat-toolbox": "^2.0.0",
    "@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers",
    "@nomiclabs/hardhat-etherscan": "^3.0.0",
    "@nomiclabs/hardhat-waffle": "^2.0.3",
    "@typechain/ethers-v5": "^10.1.0",
    "@typechain/hardhat": "^6.1.2",
    "chai": "^4.2.0",
    "dotenv": "^16.0.3",
    "ethers": "^5.7.1",
    "hardhat": "^2.11.2",
    "hardhat-deploy": "^0.11.18",
    "hardhat-gas-reporter": "^1.0.8",
    "prettier-plugin-solidity": "^1.0.0-beta.24",
    "solhint": "^3.3.7",
    "solhint-plugin-prettier": "^0.0.5",
    "solidity-coverage": "^0.8.2",
    "typechain": "^8.1.0"
  },
  "scripts": {
    "test": "yarn hardhat test",
    "test:staging": "yarn hardhat test --network goerli",
    "lint": "yarn solhint 'contracts/*.sol'"
  }
}

Ps: Since my hardhat doesn't show options of basic sample project or advanced sample project when I create a project, hardhat didn't automatically install the necessary dependencies. I installed after one by one, and apart from that, I did everything the same as the video.

In case of importance full length of the error is:

TypeError: locEnd is not a function
    at Object.getNextNonSpaceNonCommentCharacterIndex (/home/melih/hh-fcc/hardhat-fund-me-fcc/node_modules/prettier/index.js:10618:70)
    at getNextNonSpaceNonCommentCharacterIndex$1 (/home/melih/hh-fcc/hardhat-fund-me-fcc/node_modules/prettier/index.js:12190:15)
    at handleContractDefinitionComments (/home/melih/hh-fcc/hardhat-fund-me-fcc/node_modules/prettier-plugin-solidity/src/comments/handlers/ContractDefinition.js:28:5)
    at solidityHandleOwnLineComment (/home/melih/hh-fcc/hardhat-fund-me-fcc/node_modules/prettier-plugin-solidity/src/comments/handler.js:28:5)
    at /home/melih/hh-fcc/hardhat-fund-me-fcc/node_modules/prettier/index.js:12409:11
    at Array.forEach (<anonymous>)
    at Object.attach (/home/melih/hh-fcc/hardhat-fund-me-fcc/node_modules/prettier/index.js:12376:12)
    at attachComments (/home/melih/hh-fcc/hardhat-fund-me-fcc/node_modules/prettier/index.js:13235:14)
    at coreFormat (/home/melih/hh-fcc/hardhat-fund-me-fcc/node_modules/prettier/index.js:13264:21)
    at format (/home/melih/hh-fcc/hardhat-fund-me-fcc/node_modules/prettier/index.js:13510:73)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
alymurtazamemon commented 1 year ago

@MelihCK Could you please leave a repo link here?

MelihCK commented 1 year ago

@MelihCK Could you please leave a repo link here?

https://github.com/PatrickAlphaC/hardhat-fund-me-fcc This is the repo for the lesson but I haven't pushed my code yet .

alymurtazamemon commented 1 year ago

@alymurtazamemon send your repo, we have Patrick's repo!

MelihCK commented 1 year ago

Here it is: https://github.com/MelihCK/hardhat-fund-me-fcc.git

alymurtazamemon commented 1 year ago

@MelihCK Dependencies issues, I have fixed that and pushed it to your repo.

alymurtazamemon commented 1 year ago

@MelihCK I am closing it, feel free to open it again if you still face issues or you can come to the discussions tab because these are more personal project-related issues and not overall issues.

closing #3190