Coder Social home page Coder Social logo

typescript-eslint-hello's Introduction

DevCrev Base Project: TypeScript, VS Code, ESLint

How this project was made:

I am using VS Code with the ESLint (by Dirk Baeumer) extension installed.

I already have Node.js/NPM installed on my Linux machine.

I do not have TypeScript installed globally but I will install it locally to the project.

I do not have ESLint installed globally but I will install it locally to the project.

Let's get started.

Start from a directory where you want create the project folder.

Make a project directory.

$ mkdir typescript-eslint-hello

Change into that directory.

$ cd typescript-eslint-hello/

Initialize the project.

$ npm init -y

Install TypeScript.

$ npm install --save-dev typescript

Install ESLint.

$ npm install --save-dev eslint

Configure ESLint.

$ ./node_modules/.bin/eslint --init

  • Questions and answers while configuring ESLint:
    • How would you like to use ESLint?
      • To check syntax and find problems
    • What type of modules does your project use?
      • CommonJS
    • Which framework does your project use?
      • None of these
    • Does your project use TypeScript?
      • Yes
    • Where does your code run?
      • Browser
    • What format do you want your config file to be in?
      • JSON
    • Would you like to install them now with npm?
      • Yes

Launch VS Code.

$ code .

Edit package.json and replace the scripts section with what is committed in this repository.

Add app.ts and populate it with what is in the repository.

Edit .eslintrc.json

  • Change the env > "es2021" key to "es2020". The value remains true.
  • Change the parserOptions > "ecmaVersion" value from 12 to 11.
  • I suspect the above two changes will not be needed after a future update of the VS Code ESlint extension.
  • Replace the empty rules section with what is committed in this repository.

Save all files.

For app.ts (opened in editor) you should see red error indicators for missing semicolons and a yellow warning indicator for the use of the console method.

ShowErrors

For the npm scripts:

  • $ npm run lint
    • Will lint all .ts files
  • $ npm run build
    • Will build app.js from app.ts

typescript-eslint-hello's People

Contributors

devcrev avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.