Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Stricter TS Rules #20

Open
elersong opened this issue Jul 13, 2024 · 0 comments
Open

Enable Stricter TS Rules #20

elersong opened this issue Jul 13, 2024 · 0 comments
Labels
enhancement New feature or request from_willyovale An issue described in original project, but never implemented good first issue Good for newcomers planning Not yet ready for development

Comments

@elersong
Copy link
Owner

Description

To improve code quality and catch potential issues early, Fireorm should enable stricter TypeScript rules. The goal is to gradually migrate the codebase to comply with strict: true settings in tsconfig.json.

Steps to Reproduce

  1. Enable strict TypeScript rules in tsconfig.json.
  2. Attempt to compile the Fireorm codebase.
  3. Identify and fix TypeScript errors that arise from stricter type checking.

Expected Behavior

The Fireorm codebase should compile without errors under strict TypeScript rules, ensuring better type safety and code quality.

Actual Behavior

The current codebase may not compile under strict TypeScript rules due to various type-related issues.

Acceptance Criteria

  • Enable strict TypeScript rules incrementally, addressing errors on a folder-by-folder or file-by-file basis.
  • Ensure the entire codebase eventually complies with strict: true settings.
  • Improve overall type safety and code quality in Fireorm.

Additional Context

  • July 4, 2020: Initial interest in tackling the stricter TypeScript rules.
  • July 5, 2020: Agreement on the need for stricter rules and the scope of the task.
  • July 11, 2020: Suggestion to take an incremental approach to the migration.
  • July 12, 2020: Ongoing work on a PR to address many existing errors.
  • July 18, 2020: PR merged to address a significant number of errors.
  • July 31, 2020: Initial part of strict rules migration merged.
  • August 17, 2020: Plan to address strict rules on a folder-by-folder basis with a detailed list of pending work.

Proposed Plan

  1. Incremental Approach:

    • Migrate to strict TypeScript rules incrementally, focusing on one folder or file at a time.
    • Use an inner tsconfig.json to enable strict rules for specific folders or files and fix the errors.
  2. Folder-by-Folder Migration:

    • Address the following folders and files in sequence:
      • src/Batch/
      • src/Errors/
      • src/Transaction/
      • src/AbstractFirestoreRepository.ts
      • src/BaseFirestoreRepository.ts
      • src/BaseRepository.ts
      • src/helpers.ts
      • src/MetadataStorage.ts
      • src/QueryBuilder.ts
      • src/utils.ts
  3. Final Integration:

    • After migrating all folders and files, remove the inner tsconfig.json.
    • Enable strict: true in the outer tsconfig.json.

Example Implementation

// Update tsconfig.json to enable strict rules
{
  "compilerOptions": {
    // other options...
    "strict": true
  },
  "include": [
    "src/**/*.ts"
  ]
}

// Fix TypeScript errors in migrated files
export class ExampleClass {
  // Ensure all properties are properly typed
  private exampleProperty: string;

  constructor(exampleProperty: string) {
    this.exampleProperty = exampleProperty;
  }
}

Original Issue

@elersong elersong added enhancement New feature or request good first issue Good for newcomers from_willyovale An issue described in original project, but never implemented planning Not yet ready for development labels Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request from_willyovale An issue described in original project, but never implemented good first issue Good for newcomers planning Not yet ready for development
Projects
None yet
Development

No branches or pull requests

1 participant