{"id":26679809,"url":"https://github.com/letstayfoolish/javascript-advanced","last_synced_at":"2025-03-26T06:18:11.723Z","repository":{"id":282288559,"uuid":"939860545","full_name":"letStayFoolish/javascript-advanced","owner":"letStayFoolish","description":"TypeScript, JavaScript, Node","archived":false,"fork":false,"pushed_at":"2025-03-25T20:19:10.000Z","size":9916,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T20:33:33.613Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/letStayFoolish.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-27T08:21:51.000Z","updated_at":"2025-03-25T20:19:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"cb54e2d7-07bb-4c77-9085-eb1c6a7126b0","html_url":"https://github.com/letStayFoolish/javascript-advanced","commit_stats":null,"previous_names":["letstayfoolish/typescript-simple-template","letstayfoolish/javascript-advanced"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/letStayFoolish%2Fjavascript-advanced","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/letStayFoolish%2Fjavascript-advanced/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/letStayFoolish%2Fjavascript-advanced/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/letStayFoolish%2Fjavascript-advanced/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/letStayFoolish","download_url":"https://codeload.github.com/letStayFoolish/javascript-advanced/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245598252,"owners_count":20641884,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-26T06:18:11.221Z","updated_at":"2025-03-26T06:18:11.706Z","avatar_url":"https://github.com/letStayFoolish.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Steps to Migrate from JavaScript to TypeScript\n\n### Install TypeScript**: Run the following command to add TypeScript to your project:\n\n`npm install --save-dev typescript`\n\n### Create a `tsconfig.json` file**: TypeScript requires a configuration file to define how the TypeScript compiler (`tsc`) behaves. You can create one with the following command:\n\n`npx tsc --init`\n\nThis will generate a `tsconfig.json` file in your project. For simplicity, you can modify it as follows:\n\n- Set `src` as the directory for source files.\n- Set the `outDir` to `dist` for compiled JS files.\n\n### Rename `.js` files to `.ts` files**: Rename your JavaScript files to `.ts` and fix any TypeScript errors. TypeScript will guide you through type-related issues, but you can start by adding a file-by-file `ts-ignore` comment where necessary.\n\n### Install Type Definitions**: If you're using third-party libraries (e.g., Lodash or Express), install their type definitions:\n\n`npm install --save-dev @types/library-name`\n\n## Setting Up Essential Tools**\n\n### **1. Prettier**\n\n- Install Prettier:\n\n`npm install --save-dev prettier`\n\n- Create a `.prettierrc` file or `.prettier.config.js` with this configuration:\n\n`     {\n       \"semi\": true,\n       \"singleQuote\": true,\n       \"tabWidth\": 2,\n       \"trailingComma\": \"es5\",\n       \"printWidth\": 80\n     }`\n\n- Add a `.prettierignore` file to exclude files:\n  node_modules/\n  dist/\n\n\n### **2. ESLint**\n\n- Install ESLint:\n\n`npm install --save-dev eslint`\n\n- Initialize ESLint with:\n\n`npx eslint --init`\n\n- To configure ESLint for TypeScript, add additional packages:\n\n`npm install --save-dev @typescript-eslint/parser @typescript-eslint/eslint-plugin`\n\n- Update your `.eslintrc` file:\n\n```json\n     {\n       \"parser\": \"@typescript-eslint/parser\",\n       \"plugins\": [\"@typescript-eslint\"],\n       \"extends\": [\n         \"eslint:recommended\",\n         \"plugin:@typescript-eslint/recommended\",\n         \"prettier\"\n       ],\n       \"rules\": {\n         // Custom rules can be added here\n       }\n     }\n```\n- Add an `.eslintignore` to exclude files:\n\n`     node_modules/\n     dist/`\n\n### **3. Combine Prettier and ESLint**\n\n`   npm install --save-dev eslint-config-prettier`\n\n- Update `package.json`:\n\n```json\n     {\n       \"lint-staged\": {\n         \"*.{ts,js,json,css,md}\": [\n           \"eslint --fix\",\n           \"prettier --write\"\n         ]\n       }\n     }\n```\n\n### **6. Other Useful Packages**\n\n- **nodemon**: Automatically restarts the application on file changes.\n\n`     npm install --save-dev nodemon`\n\n- **dotenv**: Manage environment variables.\n\n`     npm install dotenv`\n\n- Add these scripts to your `package.json`:\n\n```json\n     {\n       \"scripts\": {\n         \"start\": \"node dist/index.js\",\n         \"dev\": \"nodemon src/index.ts\",\n         \"lint\": \"eslint . --ext .ts\",\n         \"build\": \"tsc\"\n       }\n     }\n```\n\n- Create a `.gitignore` file for your project:\n\n`     node_modules/\n     dist/`\n\n- (Optional) Install `npm-check-updates` to manage outdated dependencies:\n\n```shell\n     npm install --global npm-check-updates\n     ncu -u\n     npm install\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fletstayfoolish%2Fjavascript-advanced","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fletstayfoolish%2Fjavascript-advanced","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fletstayfoolish%2Fjavascript-advanced/lists"}