Skip to content

Instantly share code, notes, and snippets.

Working from home

geekrajat rajatk16

Working from home
View GitHub Profile
rajatk16 /
Created Jun 23, 2020
Setup a TypeScript project with ESLint and Prettier

Project Setup

Setup ESLint to work with TypeScript

  1. Install the Dev Dependencies
yarn add eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin -D
View ._Setup Javascript Project with ES6 + Babel 7 + ESLint + Airbnb + Prettier
# Project Setup
Create a directory and run the following command.
npm init
For this tutorial, I will be adding an index.js file to the `src` folder, and this will be our entry point.
Our file directory should look like this.
View sortingForHottie.js
const data = {
View App.js
import React, {Component} from 'react';
import * as ml5 from 'ml5';
export default class App extends Component {
buttonText: 'Click',
imageUrl: '',
ready: false,
predictionLabel: '',
predictionConfidence: '',
View movieItem.js
const template = document.createElement('template');
template.innerHTML = `
:host {
display: block;
button {
border: 1px solid black;
cursor: pointer;
View movielist.js
const template = document.createElement('template');
template.innerHTML = `
:host {
display: block;
text-align: center;
button {
border: 2px solid blue;
cursor: pointer;
View hero-form.component.ts
import {Component, OnInit, Input, Output, EventEmitter} from '@angular/core';
import { FormGroup, FormControl } from '@angular/forms';
selector: 'hero-form',
templateUrl: './hero-form.component.html',
styleUrls: ['./hero-form.component.css']
export class HeroFormComponent implements OnInit {
View app.js
const fs = require('fs');
const requestHandler = (req, res) => {
const url = req.url;
const method = req.method;
if (url === '/') {
res.write('<head><title>Enter Message</title></head>');
'<body><form action="/message" method="POST"><input type="text" name="message"><button type="submit">Send</button></form></body>'
View index.css
:root {
--timeout: 500ms;
--list-item-max-height: 30px;
ul {
margin: 0;
padding: 0 10px;
View index.js
import React, {Component} from 'react';
import ReactDOM from 'react-dom';
import uuid from 'uuid';
import './index.css';
class App extends Component {
heroes = [
name: "Batman",
id: uuid(),