sivicstudio / starkludo

Ludo game on Starknet
https://testnet.starkludo.com
MIT License
8 stars 27 forks source link

Fix problem with building client #26

Closed princeibs closed 1 week ago

princeibs commented 2 weeks ago

When "strict" is set to true in tsconfig.json file, running the build command (pnpm build) fails. Failure reason is mostly due to having any in some variable types. Replace the use of any with the actual data type and fix other issues to ensure the build command runs successfully.

image

If you have any more questions or need more clarity on this issue, endeavour to join the StarkLudo contributors channel (https://t.me/+hnjQooODZOA2M2Rk) on Telegram and the project leads will be there to help.

PabloVillaplana commented 2 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a Full Stack developer with 6 years of experience in the industry, specializing in building robust and scalable web applications. My journey has equipped me with a deep understanding of both front-end and back-end technologies, enabling me to deliver comprehensive solutions. I am incredibly passionate about emerging technologies, and I’m particularly excited to contribute to Web 3 projects. This opportunity allows me to further my growth as an Open Source Contributor, helping to shape the future of decentralized web applications. I am eager to leverage my skills and experience to make meaningful contributions to the community while continuing to learn and evolve in this dynamic field.

How I plan on tackling this issue

This won't take long to resolve, the longest time it would take would be to set up the project and get it working properly locally.

Identify Problematic Areas:

Start by running the build command (pnpm build) to identify the files and lines where TypeScript is throwing errors due to the use of any or other issues. Replace any with Specific Types:

Go through each file flagged by the build process. For each instance of any, replace it with the actual type. If the type is unknown but you want to maintain some flexibility, consider using unknown or Record<string, unknown> for objects, or creating custom types/interfaces that better represent the data.

Dprof-in-tech commented 2 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

As an experienced Full Stack Developer, I'm excited to contribute my expertise to Edition 7 of the OnlyDust hackathons. With a strong background in Next.js, TypeScript, JavaScript, React, Node.js, Solidity, and Cairo, I've honed my technical skills across the blockchain development landscape. My journey with OnlyDust began at Edition 2, and I've since made 28 contributions across 11 projects. This extensive experience on the platform has allowed me to develop a keen understanding of delivering high-quality solutions under tight deadlines. My track record includes being a major contributor to building out the Pistols Web game by Underware and demonstrates my ability to adapt quickly and contribute effectively to diverse challenges. I'm confident in my capacity to tackle new problems and drive innovation in the blockchain space. As we embark on Edition 7, I'm eager to leverage my hackathon experience and technical skills to push the boundaries of what's possible in blockchain development. With a passion for creating cutting-edge solutions, I'm excited to collaborate with the OnlyDust community and contribute to the advancement of the blockchain ecosystem.

My experience can be seen at https://app.onlydust.com/u/dprof-in-tech

How I plan on tackling this issue

to solve this issue, i will do the following

Analyze the Error Messages:

Run the build command (pnpm build) and carefully examine all error messages. Take note of each file and line number where any types are causing issues. Look for other type-related errors that may appear due to strict mode.

Prioritize and Categorize Issues:

Group similar errors together (e.g., all any type issues, null checks, etc.). Prioritize based on severity and frequency of occurrence.

Replace any Types:

For each instance of any, determine the actual data type that should be used. Common replacements might include:

string for text data number for numeric values boolean for true/false flags Custom interfaces or types for complex objects Union types (e.g., string | number) for variables that can have multiple types

my expected delivery time would be two working days.

khayss commented 2 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I'm a fullstack web developer. I'm detail oriented and highly appreciate strongly typed languages.

How I plan on tackling this issue

I will study each of components using any type to get the correct typing. I'll create the correct type and replace any type with the correct type. I'll fix other bugs and ensure the project compiles.

Solomonsolomonsolomon commented 2 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Fullstack developer

How I plan on tackling this issue

Scan files and locate any types,replace any with appropriate types, scan for any other potential errors preventing successful build

ScottyDavies commented 2 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I'm a blockchain developer with years of experience, I'm excited to contribute to the StarkLudo project and help address the build failure issue caused by the "strict" mode in the tsconfig.json file.

How I plan on tackling this issue

I would approach this issue with following steps The key information provided is that the build command (pnpm build) fails when the "strict" flag is set to true, and the failure is mostly due to the use of the "any" type in some variable types. I Understand the Context: Having worked extensively with TypeScript-based blockchain frameworks and libraries, I'm familiar with the importance of type safety and strict type checking in the context of blockchain development. The StarkLudo project is likely using a TypeScript-based tool like Hardhat, Truffle, or Ethers.js to build its smart contracts and other blockchain-related components. Analyze the Codebase: As an experienced blockchain developer, I would carefully review the codebase, focusing on the areas where the "any" type is being used. This would involve searching for occurrences of the "any" type, examining the variable declarations and function parameters, and determining the specific contexts and data flows where the "any" type is causing issues. Replace "any" with Appropriate Types: Drawing on my deep understanding of TypeScript and blockchain domain modeling, I would identify the appropriate data types to replace the "any" types. This could involve inspecting the variable usage and surrounding code, referencing the project's domain models or type definitions, and adding type annotations or leveraging TypeScript's type inference to ensure the types are correctly specified. Address Other Strict Mode Issues: In addition to replacing the "any" types, I would use my expertise in TypeScript and blockchain development to look for any other issues that may be surfacing due to the "strict" mode, such as unhandled null or undefined values, incorrect type assertions or type guards, and missing return types or type annotations. Implement Unit Tests: Recognizing the critical importance of robust testing in blockchain development, I would leverage my experience in writing comprehensive unit tests to cover the affected areas of the codebase. This will help catch any regressions or unexpected behaviors introduced by the type changes, ensuring the integrity of the blockchain-related components. Collaborate with the Community: As suggested in the Telegram group description, I would actively engage with the StarkLudo contributors channel on Telegram, sharing my findings and collaborating with the project leads and other contributors. Drawing on my strong communication and mentoring skills, I would provide guidance, seek clarification, and incorporate feedback from the team. Verify the Build: After making the necessary changes and implementing the unit tests, I would run the build command (pnpm build) again to ensure the issue has been resolved and the build is successful, meeting the strict type checking requirements.

JoelVR17 commented 2 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I'm a Full Stack Web Developer with a solid background in front-end and back-end development. So it will be a pleasure to contribute for the first time to this great project. I'm member of Dojo Coding

How I plan on tackling this issue

  1. Analyze the tsconfig.json Settings:

    • First, I would review the tsconfig.json file to understand the current TypeScript configuration and confirm that "strict": true is indeed causing the issue. This setting enables all strict type-checking options, such as strictNullChecks, noImplicitAny, and others.
  2. Run the Build Command and Identify Issues:

    • I would run pnpm build to identify all the errors that are being triggered due to the strict settings. This would involve looking at the specific errors related to the use of any and any other type-checking issues.
    • Example of running the command:
      pnpm build
  3. Replace any with Specific Types:

    • I would systematically go through the errors, replacing the any type with the correct and more specific data types. This involves understanding the context in which any is used and determining the appropriate type—whether it's a primitive type (e.g., string, number), a complex object type, or a union type.
    • Example of replacing any:

      // Before
      let data: any;
      
      // After
      let data: string | null; // Assuming data can only be a string or null
  4. Fix Other Type-Related Issues:

    • In addition to replacing any, I would also address any other type-related issues flagged by the strict settings. This might include:
      • Adding type annotations to variables, function parameters, and return types.
      • Handling undefined and null values explicitly where necessary.
      • Refactoring code to ensure compliance with strict type checks.
  5. Test the Code Changes:

    • After making the necessary changes, I would rerun pnpm build to ensure that the build process completes successfully without errors. This step is crucial to verify that all issues have been resolved and the project can be built under the strict type-checking rules.
    • Additionally, I would run any existing tests to confirm that the changes did not introduce any new bugs or issues.
  6. Refactor and Optimize:

    • If during the process I encounter any code that can be improved or refactored for better clarity and maintainability, I would make those improvements. This might include simplifying complex types or breaking down large functions into smaller, more manageable pieces.
  7. Documentation and Commit:

    • I would document the changes made, explaining why certain types were chosen and how the issues were resolved. This documentation would be included in the pull request to help reviewers understand the changes.
    • Finally, I would commit the changes to a new branch and push them to the repository. I would then create a pull request with a detailed description of the changes and how they resolve the issue.
  8. Communication:

    • If I encounter any unclear or ambiguous type definitions, I would communicate with the project leads or other contributors via the StarkLudo contributors channel on Telegram to get clarity and ensure that my changes align with the project's requirements.
NueloSE commented 2 weeks ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a frontend develop with some years of experience with frontend technology using js, typescript and some frontend frame works.

With the above technologies i believe i would be able to contribute to the following project

How I plan on tackling this issue

This is a simple issue and i can handle and deliver it within 24hours.

steps to tackle task:

  1. install the requirement for starting up the ludo game
  2. change the value of tsconfig.json to strict, for strict datatype checking.
  3. then run pnpm build and identify the necessary files needed to be change for the error log.
  4. replace all occurence of any type to a more specific type. eg: string, number, boolean, arrays, objects etc ex useCallback function parameter before:
    const App = () => {
    const [gameState, setGameState] = useState({});
    const setGameData = useCallback((game: any) => {
    setGameState(game);
    }, []);

after:

const App = () => {
  const [gameState, setGameState] = useState({});
  const setGameData = useCallback((game: GameState) => {
    setGameState(game);
  }, []);
  1. run the pnpm build and ensure the error logs have been fixed.

kindly assign me as i would like to contribute to this amazing project.

onlydustapp[bot] commented 2 weeks ago

The maintainer princeibs has assigned PabloVillaplana to this issue via OnlyDust Platform. Good luck!

moteeullahazmi commented 2 weeks ago

can i try this

PabloVillaplana commented 2 weeks ago

Thank you @princeibs for the issue 🚀

PabloVillaplana commented 2 weeks ago

Hey @princeibs could you help me to check this PR? https://github.com/sivicstudio/starkludo/pull/35/files