Skip to content

feat: Add TypeScript type checking and ESLint linting to /src directory#71

Closed
avinxshKD wants to merge 4 commits intoPalisadoesFoundation:mainfrom
avinxshKD:add-typescript-eslint-linting
Closed

feat: Add TypeScript type checking and ESLint linting to /src directory#71
avinxshKD wants to merge 4 commits intoPalisadoesFoundation:mainfrom
avinxshKD:add-typescript-eslint-linting

Conversation

@avinxshKD
Copy link
Copy Markdown

What kind of change does this PR introduce?

Add TypeScript Type Checking & ESLint Linting to /src directory

What kind of change does this PR introduce?

Enhancement - Adds TypeScript type checking and ESLint linting infrastructure to match talawa-admin code quality standards.

Issue Number:

Fixes #69

Did you add tests for your changes?

Yes - All changes have been validated through:

  • TypeScript type checking (npm run type-check)
  • ESLint linting (npm run lint:check)
  • Prettier formatting checks
  • Docusaurus build verification
  • Pre-commit hooks are configured and tested

Snapshots/Videos:

N/A as this is infrastructure/tooling enhancement without visual changes.

If relevant, did you update the documentation?

Yes - Added IMPLEMENTATION_NOTES.md documenting all changes, configurations, and usage instructions for developers.

Summary

This PR implements comprehensive TypeScript type checking and ESLint linting for the /src directory to ensure code quality consistency with the talawa-admin project.

Changes Made:

  1. Dependencies Installed:

    • ESLint core packages and plugins
    • TypeScript ESLint parser and plugin
    • React, Import, Prettier, and TSDoc linting plugins
    • Husky and lint-staged for git hooks
  2. Configuration Files:

    • Created eslint.config.js with strict linting rules matching talawa-admin
    • Enhanced tsconfig.json with strict type checking options
    • Added type declarations in src/types/ for CSS modules and Docusaurus
  3. Scripts Added to package.json:

    • npm run type-check - TypeScript type checking
    • npm run lint:check - ESLint validation
    • npm run lint:fix - Auto-fix linting errors
  4. Automated Quality Checks:

    • Pre-commit hooks via Husky (type-check, lint, format)
    • GitHub Actions workflow updated with type-check and lint steps
  5. Source Code Improvements:

    • Fixed all TypeScript type errors in /src
    • Applied proper interface naming conventions (Interface prefix)
    • Added explicit return types to all functions
    • Removed unused imports and variables
  6. Files Updated:

    • .github/workflows/pull-request.yml - Added type-check and lint steps
    • .gitignore - Added ESLint cache and TypeScript build artifacts
    • All TypeScript files in /src - Type safety improvements

Verification:

  • npm run type-check - Passes
  • npm run lint:check - Passes
  • npm run format:check - Passes
  • npm run build - Passes
  • Pre-commit hooks - Working

Does this PR introduce a breaking change?

No - This PR only adds tooling and fixes type issues. All existing functionality remains unchanged. The Docusaurus site builds and runs successfully.

Other information

  • The ESLint configuration uses the new flat config format (eslint.config.js)
  • Pre-commit hooks will prevent commits with type errors or linting issues
  • Future contributors will benefit from immediate feedback on code quality issues
  • The strict TypeScript configuration catches potential bugs at compile time

Have you read the contributing guide?

Yes

- Install ESLint and TypeScript linting dependencies
- Create eslint.config.js with comprehensive rules matching talawa-admin
- Update tsconfig.json with strict type checking options
- Add lint:check, lint:fix, and type-check scripts to package.json
- Setup Husky pre-commit hooks for automated checks
- Update GitHub Actions workflow with type checking and linting steps
- Add ESLint cache and TypeScript build files to .gitignore
- Fix all TypeScript type errors and linting issues in /src
- Add type declarations for CSS modules and Docusaurus
- Update all source files with proper interface naming and return types
- Verify Docusaurus build works correctly

Closes PalisadoesFoundation#69
@github-actions
Copy link
Copy Markdown

Our Pull Request Approval Process

Thanks for contributing!

Testing Your Code

Remember, your PRs won't be reviewed until these criteria are met:

  1. We don't merge PRs with poor code quality.
    1. Follow coding best practices such that CodeRabbit.ai approves your PR.
  2. We don't merge PRs with failed tests.
    1. When tests fail, click on the Details link to learn more.
    2. Write sufficient tests for your changes (CodeCov Patch Test). Your testing level must be better than the target threshold of the repository
    3. Tests may fail if you edit sensitive files. Ask to add the ignore-sensitive-files-pr label if the edits are necessary.
  3. We cannot merge PRs with conflicting files. These must be fixed.

Our policies make our code better.

Reviewers

Do not assign reviewers. Our Queue Monitors will review your PR and assign them.
When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

CONTRIBUTING.md

Read our CONTRIBUTING.md file. Most importantly:

  1. PRs with issues not assigned to you will be closed by the reviewer
  2. Fix the first comment in the PR so that each issue listed automatically closes

Other

  1. 🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.
  2. Read the CONTRIBUTING.md file make

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congratulations on making your first PR! 🎊 If you haven't already, check out our Contributing Guidelines and PR Reporting Guidelines to ensure that you are following our guidelines for contributing and creating PR.

@avinxshKD
Copy link
Copy Markdown
Author

@palisadoes could you please add the ignore-sensitive-files-pr label to this PR?

The modified files (.github/workflows/pull-request.yml, .gitignore, package.json,
tsconfig.json) are all required by Issue #69 to implement TypeScript type checking
and ESLint linting for the /src directory

Changes I made:

  • Updated GitHub Actions workflow to include type-check and lint steps
  • Added linting dependencies to package.json
  • Enhanced tsconfig.json with strict type checking
  • Added ESLint cache files to .gitignore

All checks pass except for the sensitive files validation. Thank you

Copy link
Copy Markdown
Contributor

@palisadoes palisadoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have made too many changes that are beyond the scope of the issue.
Please be more careful.

Comment thread src/types/modules.d.ts
}

declare module '*.module.css' {
const content: { [className: string]: string };
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this file added? It's never been generated before with docusaurus.

Comment thread src/types/docusaurus.d.ts
@@ -0,0 +1,4 @@
declare module '@theme/*';
declare module '@docusaurus/*';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this file added? It's never been generated before with docusaurus.

Comment thread IMPLEMENTATION_NOTES.md
npm run lint:check

# Fix linting errors automatically
npm run lint:fix
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this file. It's not necessary

cache: pnpm
cache-dependency-path: |
pnpm-lock.yaml
package.json
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restore this section. It works in other repos as expected.

name: Install pnpm
with:
run_install: false
version: 10.2.1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restore this. It worked before.

import React from 'react';

interface ActionButtonProps {
interface InterfaceActionButtonProps {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this file edited? You have changed the functionality of the home page. That is beyond the scope of the issue. Revert.

interface HomeCallToActionProps {}

const HomeCallToAction: React.FC<HomeCallToActionProps> = () => {
const HomeCallToAction: React.FC = () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this file edited? You have changed the functionality of the home page. That is beyond the scope of the issue. Revert.

Comment thread src/utils/Section.tsx
children,
className,
background = 'light',
}: SectionProps) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this file edited? You have changed the functionality of the home page. That is beyond the scope of the issue. Revert.

Comment thread src/utils/TwoColumns.tsx
const TwoColumns: FC<InterfaceTwoColumnsProps> = ({
columnOne,
columnTwo,
reverse = false,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this file edited? You have changed the functionality of the home page. That is beyond the scope of the issue. Revert.

Comment thread src/pages/index.tsx
@@ -1,9 +1,8 @@
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import React from 'react';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this file edited? You have changed the functionality of the home page. That is beyond the scope of the issue. Revert.

@avinxshKD
Copy link
Copy Markdown
Author

@palisadoes Thank you for the feedback. I’m working on the changes you mentioned and will update the PR soon.

@avinxshKD avinxshKD closed this Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Typescript Type Checking & Eslint linting to the /src directory

2 participants