| 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:
Maximum Score: 300 points
| Criteria | Points |
|---|---|
The branch is named ts-custom-lodash |
5 |
| Commit messages follow RS School Git Convention | 5 |
The ts-custom-lodash folder exists |
5 |
The ts-custom-lodash/lib folder exists |
5 |
Each function is in its own .ts files |
5 |
The ts-custom-lodash/lib/utils folder with reusable helper functions implemented |
5 |
Add a ts-custom-lodash/lib/types.ts or ts-custom-lodash/lib/interfaces.ts file for shared types |
5 |
The ts-custom-lodash/lib/index.ts file import and export all functions |
5 |
| The code uses Types or Interfaces | 5 |
| The code uses Everyday Types | 5 |
| The code uses Generics | 5 |
| The code uses Union Types | 5 |
| The code uses Object Types | 5 |
| The code uses Function Types | 5 |
| The code follows clean code principles and maximizes code reuse | 10 |
ESLint is configured for TypeScript, no-explicit-any is enabled, and there are no errors |
5 |
The TypeScript config includes "noImplicitAny": true and "strict": true |
5 |
The .prettierrc.json file added |
5 |
The package.json file includes scripts: “lint”, “lint-fix”, “prettier” |
5 |
| All dependencies added as dev dependencies | 5 |
| Implemented for use cases where the argument is an array.: | |
| chunk | 10 |
| compact | 10 |
| drop | 10 |
| dropWhile | 10 |
| take | 10 |
| filter | 10 |
| find | 10 |
| includes | 10 |
| map | 10 |
| zip | 10 |
| Implemented for use cases where the arguments are Objects | |
| merge | 10 |
| omit | 10 |
| omitBy | 10 |
| pick | 10 |
| pickBy | 10 |
| toPairs | 10 |
| Implement for all use cases from the docs | |
| filter | 20 |
| Pull Request description includes all required elements: | |
| Task URL is included in the PR | 5 |
| Submission and Deadline Dates are included in the PR | 5 |
| Your self-check of the task’s completion using checkboxes is included in the PR | 5 |
| Penalty: | |
| Less than 3 commits in the PR | -20 |
| Commit after the deadline and before mentor review | -20 |
| The solution includes any comments | -50 |
| The solution includes console.log | -10 |
| Code is not fully covered with types | -50 |
| ESLint errors | -10 |
Use of the any type |
-300 |
Do not use any methods from Array.prototype.* or Object.prototype.* |
-300 |
any type anywhere.Array.prototype.* or Object.prototype.*.