AddESLint workflow and fix linter errors - #6
Merged
Merged
Conversation
- Install husky and lint-staged as dev dependencies - Configure pre-commit hook to run ESLint on staged files - Add npm scripts for linting (lint, lint:check) - Update README with comprehensive development documentation - Set up automatic code quality enforcement before commits
Introduces TypeScript interfaces for PDB API data structures, including PdbEntryData, PdbPolymerEntityData, RawCitationData, RcsbPrimaryCitation, and RcsbEntryInfo. Updates the PDBClient to use these types for improved type safety and code clarity.
Updated the catch block to handle both Error instances and unknown error types, ensuring that error messages are logged appropriately regardless of the error type.
Replaces manual TSV parsing logic in RheaClient with papaparse for improved reliability and maintainability. Adds papaparse and its type definitions as dependencies in package.json.
Introduces eslint.config.mts with recommended settings for JavaScript and TypeScript, including browser globals and plugin support.
Updated type assertions for array includes checks to use more precise types. Removed unused 'client' parameter from 'upload' methods in UserQuery and SystemQuery. Improved type safety for stream name assignment in PDFUpload.
Deleted an unnecessary test comment at the end of the llm.ts file to clean up the code.
Changed 'responses' from let to const and added explicit typing for pdbResults. Also updated the export to cast the function type for better type safety.
Inserted blank lines before lists in the README to enhance formatting and readability.
The SmallMolecule import in pubchem.integration.test.ts was unused and has been removed to clean up the code.
Updated the UserQuery upload test to call upload() without passing the mockClient argument, reflecting changes in the method signature or usage.
Introduces a lint workflow that runs ESLint on the src directory for every push and pull request. The workflow sets up Node.js, installs dependencies, and checks out the code before running the linter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements focused on code quality, type safety, and maintainability across the codebase. The most significant changes include the addition of ESLint and Husky for automated linting and pre-commit checks, enhanced TypeScript type safety (especially for API responses and function arguments), and the adoption of the
papaparselibrary for more robust TSV parsing. There are also minor bug fixes and improvements to development documentation.Code Quality & Tooling Enhancements:
eslint.config.mts) and integrated Husky and lint-staged for pre-commit linting, with scripts and configuration updates inpackage.jsonand a new.husky/pre-commithook. This ensures code style and error checking on every commit. [1] [2] [3]README.mdwith a new "Development" section detailing code quality tools, scripts, pre-commit hooks, and setup instructions for contributors.Type Safety & API Response Improvements:
src/fetcher/pdb.ts) to define explicit TypeScript interfaces for API responses and internal data structures, improving maintainability and type safety throughout the data fetching and mapping logic. [1] [2] [3] [4] [5] [6]src/llm.tsto useunknowninstead ofanyfor better type safety, and improved event handler typings. [1] [2] [3] [4] [5] [6] [7] [8]Parsing and Data Handling:
src/fetcher/rhea.ts) with thepapaparselibrary for more robust and maintainable parsing, including improved error handling for malformed data. [1] [2]src/input-types.tsby using more precise TypeScript types for file extension checks. [1] [2]Minor Bug Fixes and Cleanups:
uploadmethods inUserQueryandSystemQueryto remove unused parameters and improved typings for file stream handling inPDFUpload. [1] [2] [3] [4]fetchPubChemto properly log unknown errors.These changes collectively improve the reliability, maintainability, and developer experience of the project.