| Folder Name | Branch | Score | Coefficient |
|---|---|---|---|
| /ts-custom-lodash | ts-custom-lodash | 300 | 0.7 |
Your task is to implement ‘custom’ version of lodash library following next requirements:
Array.prototype.* or Object.prototype.* is strictly forbidden.ts-custom-lodash.tsconfig.json):
{
"compilerOptions": {
"rootDir": "./lib",
"outDir": "./dist",
"module": "system",
"target": "es2015",
"sourceMap": true,
"declaration": true,
"declarationMap": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"strict": true,
"noImplicitAny": true,
"removeComments": true,
"skipLibCheck": true
}
}
no-explicit-any rule enabled (eslint.config.mjs). There must be no ESLint errors.
```ts
import tseslint from “@typescript-eslint/eslint-plugin”;
import tsparser from “@typescript-eslint/parser”;
import prettierPlugin from “eslint-plugin-prettier”;
import prettierConfig from “eslint-config-prettier”;export default [ { files: [“*/.ts”],
languageOptions: {
parser: tsparser,
sourceType: "module",
},
plugins: {
"@typescript-eslint": tseslint,
prettier: prettierPlugin,
},
rules: {
...tseslint.configs.recommended.rules,
...prettierConfig.rules,
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/no-explicit-any": "error",
"no-console": "warn",
semi: ["error", "always"],
"no-warning-comments": [
"warn",
{ terms: ["todo", "fixme", "xxx"], location: "anywhere" },
],
"no-inline-comments": "warn",
quotes: ["error", "double"],
"prettier/prettier": "error",
},
}, ]; ``` - Add a Prettier configuration file (`.prettierrc.json`). ```json { "semi": true, "singleQuote": false, "tabWidth": 2, "trailingComma": "all", "printWidth": 100, "arrowParens": "always" } ``` - Add scripts to `package.json`: ```json { "name": "ts-custom-lodash", "version": "1.0.0", "main": "index.js", "scripts": {
"lint": "npx eslint .",
"lint-fix": "npx eslint . --fix",
"prettier": "npx prettier --write ." }, "keywords": [], "author": "", "license": "ISC", "description": "", "devDependencies": {
"@typescript-eslint/eslint-plugin": "^8.49.0",
"@typescript-eslint/parser": "^8.49.0",
"eslint": "^9.39.1",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-prettier": "^5.5.4",
"prettier": "^3.7.4",
"ts-node": "^10.9.2",
"typescript": "^5.9.3",
"typescript-eslint": "^8.49.0" } } ``` ### Implementation Details
ts-custom-lodash/lib folder in a separate .ts file named after the function (e.g., chunk.ts, compact.ts, etc.).utils folder for reusable helper functions.types.ts or interfaces.ts file for shared types.index.ts file in the ts-custom-lodash/lib folder must export all functions as follows:
export { chunk } from './chunk';
export { compact } from './compact';
// ...etc for all functions
any type anywhere.Array.prototype.* or Object.prototype.*.Your Pull Request must include:
While working on this task, keep a developer’s diary. Write down the decisions you made, the approaches you considered, where you got stuck, and how you worked through it.
The diary is not graded. Its purpose is to help you understand your own work more deeply and to give your mentor a basis for a real conversation about the task.
The “Diary” folder can be placed in the root of the project.
Maximum Score: 300 points
| Criteria | Points |
|---|---|
The branch is named ts-custom-lodash |
2 |
| Commit messages follow RS School Git Convention | 2 |
The ts-custom-lodash folder exists |
2 |
The ts-custom-lodash/lib folder exists |
2 |
Each function is in its own .ts files |
2 |
The ts-custom-lodash/lib/utils folder with reusable helper functions implemented |
2 |
Add a ts-custom-lodash/lib/types.ts or ts-custom-lodash/lib/interfaces.ts file for shared types |
2 |
The ts-custom-lodash/lib/index.ts file import and export all functions |
2 |
| The code uses Types or Interfaces | 2 |
| The code uses Everyday Types | 2 |
| The code uses Generics | 2 |
| The code uses Union Types | 2 |
| The code uses Object Types | 2 |
| The code uses Function Types | 2 |
| The code follows clean code principles and maximizes code reuse | 4 |
ESLint is configured for TypeScript, no-explicit-any is enabled, and there are no errors |
2 |
The TypeScript config includes "noImplicitAny": true and "strict": true |
2 |
The .prettierrc.json file added |
2 |
The package.json file includes scripts: “lint”, “lint-fix”, “prettier” |
2 |
| All dependencies added as dev dependencies | 2 |
| Implemented for use cases where the argument is an array.: | |
| chunk | 3 |
| compact | 3 |
| drop | 3 |
| dropWhile | 3 |
| take | 3 |
| filter | 3 |
| find | 3 |
| includes | 3 |
| map | 3 |
| zip | 3 |
| Implemented for use cases where the arguments are Objects | |
| merge | 3 |
| omit | 3 |
| omitBy | 3 |
| pick | 3 |
| pickBy | 3 |
| toPairs | 3 |
| Implement for all use cases from the docs | |
| filter | 7 |
| Pull Request description includes all required elements: | |
| Task URL is included in the PR | 1 |
| Submission and Deadline Dates are included in the PR | 1 |
| Your self-check of the task’s completion using checkboxes is included in the PR | 1 |
| Penalty: | |
| Less than 3 commits in the PR | -7 |
| Commit after the deadline and before mentor review | -7 |
| The solution includes any comments | -17 |
| The solution includes console.log | -3 |
| Code is not fully covered with types | -17 |
| ESLint errors | -3 |
Use of the any type |
-100 |
Do not use any methods from Array.prototype.* or Object.prototype.* |
-100 |
After submitting the task, your mentor will ask 4–5 questions from the areas below. Answers account for ~200 points of the total score, so make sure you can explain the concepts in your own words — not just recite a definition.
type and interface in TypeScript? When would you prefer one over the other?noImplicitAny: true enforce, and why is it important for code safety?noUncheckedIndexedAccess and what problem does it prevent?map and filter in terms of input/output shape?find return when no element matches, and how did you type that return value?dropWhile differ from drop? What predicate logic does it rely on?Array.prototypeArray.prototype methods forbidden in this task? What do you use instead?.forEach, .map, or .reduce?chunk? What edge cases did you handle (e.g. size larger than array, empty array)?zip work when the input arrays have different lengths?Object.prototype methods?pick and omit? How did you implement each?pickBy and omitBy use predicates? How did you type the predicate argument?utils folder, and why?types.ts / interfaces.ts? Give an example of a type used by multiple functions.tsconfig.json "module": "system" mean, and how does it affect your output?no-explicit-any ESLint rule enforce, and how is it different from the TypeScript noImplicitAny compiler option?declaration: true and declarationMap: true in tsconfig.json?any type anywhere.Array.prototype.* or Object.prototype.*.