TodoMVC is a project which offers the same Todo application implemented using MV* concepts in most of the popular JavaScript MV* frameworks of today. For this project, we will be going with the TypeScript & React implementation.
TypeScript is a language for application-scale JavaScript development. TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. Any browser. Any host. Any OS. Open Source.
React is a JavaScript library for creating user interfaces. Its core principles are declarative code, efficiency, and flexibility. Simply specify what your component looks like and React will keep it up-to-date when the underlying data changes.
- Clone project repository using ->
git clone https://github.com/krizten/react-tsc-todomvc.git
- Install project repository using ->
npm install
- To run a local development instance of the project, after installing the dependencies, run the command ->
npm run dev
- To build and serve project for production, run the following commands ->
npm run build npm start
Our frontend stack consists of React with TypeScript and various backends using REST and GraphQL APIs. You might have heard of TodoMVC. It's a neat project which contains a reference implementation of a simple to-do app written in various JavaScript frameworks, libraries and dialects. The quality of the various implementations vary and your goal will be to improve one of the implementations and to add new features.
Fork the project from GitHub. The implementation we are interested in is located in examples/typescript-react.
Start it using:
cd examples/typescript-react && npm install && npm build && npm start
Try to answer the following questions:
- What would you do differently?
- What's good?
- What's bad?
- Are you missing anything in the tooling department?
Optionally, if you think it will help you, apply some of your suggestions to the code.
- Use a bundler like Webpack to set up development and production build.
- Ensure project dependencies are up to date.
- Use a more organized folder structure to separate compiled JS files, TypeScript React components and other utilities methods.
- Add tests and coverage reports
- Set up linting, formatting and style guides (Standard, Airbnb, Google, etc).
- Use of TypeScript for type inference and to easily detect possible errors during compile-time.
- Use of components and classes to separate concerns, improve maintainability and readability.
- Use of custom utility methods instead of importing 3rd party libraries (leading to increased bundle size).
- No development workflow included.
- No component tests, integration (e2e) tests, etc.
- Poor/no comments documenting what certain methods do and how to use them.
- Type definitions installed as dependencies instead of devDependencies.
- User interface not properly optimized for mobile view.
- lack of alias for cleaner import statements.
- Storybook: For component documentation
- ESLint: code style guide
- Prettier: format code
- Husky: ensure code follows style guide/convention before committing
- Jest & React-Testing-Library: unit testing, snapshots
- Cypress: Integration (e2e) testing
- Bundler: Webpack (or CRA for easier setup)
Implementation of setup suggestions
We would like to be able to add labels to each to-do item.
- When entering a new item we want to add one or more labels by adding words like @work or @important to an item.
- These labels should not be part of the item title itself, but instead show up right-aligned as badges.
- When editing the item (double-click) we want to be able to add, edit or remove labels.
- Examples
- "Buy groceries @shopping @household"
- To-do: "Buy groceries"
- Tags: "shopping", "household"
- "Buy groceries @shopping @household"
Implementation of Todo Label Feature
Optional, but bonus points if you write React component tests for your newly added features.
Component tests, Integration (e2e) tests and Storybook Documentation
What is important for us is that you document your work by writing proper Git commits (i.e. a clean history that shows us how you work). We care more about high quality work, than delivering lots of features with bad code. Styling does not have to be pixel-perfect.
Have fun with the challenge,
Team Mercateo