Coder Social home page Coder Social logo

erickwendel / eslint-clone Goto Github PK

View Code? Open in Web Editor NEW
25.0 2.0 0.0 43 KB

A video tutorial about Creating your own ESLint from Scratch

Home Page: https://bit.ly/eslint-clone-ew

JavaScript 100.00%
abstract-syntax-tree acorn eslint espree javascript nodejs tutorial code-analyzer code-generator learning-by-doing

eslint-clone's Introduction

ESLint Reimagined: Creating a Linter from Scratch

Welcome, this repo is part of my youtube video about Creating your own ESLint from scratch (en-us)

First of all, leave your star ๐ŸŒŸ on this repo.

Access our exclusive telegram channel so I'll let you know about all the content I've been producing

Complete source code

  • Access it in app

ESLint Reimagined-thumb

Usage

Go to app and restore dependencies as follows:

nvm use
npm i
npm link
eslint-clone --file filename.js

Example

eslint-clone --file error.js

Outputs

Error: use "const" instead of "var"
error.js:1:1
Error: use single quotes instead of double quotes
error.js:1:12
Error: use single quotes instead of double quotes
error.js:1:23
Error: use "const" instead of "var"
error.js:2:1
Error: use single quotes instead of double quotes
error.js:3:24
Error: use "let" instead of "var"
error.js:5:1
Error: use single quotes instead of double quotes
error.js:6:25
Error: use single quotes instead of double quotes
error.js:9:25
Error: use "const" instead of "let"
error.js:15:1
Error: use single quotes instead of double quotes
error.js:15:25
Error: use single quotes instead of double quotes
error.js:17:9
Linting completed with 11 error(s).

Code fixed and saved at ./error.linted.js successfully!

Cleaning Up

npm unlink eslint-clone

Tasks

  • fix the bug when replacing quotes
    • if a code have single quotes enclosing double quotes such as:

      const name = '"ana"'

      it'd be transformed as below and will cause a syntax error.

      const name = ''ana''
    • How to fix: replace it to a template string instead.

      • Input:
        '"double"'.replaceAll('"', "'");
      • Current Output:
        ''double''.replaceAll(''', ''');
      • Expected Output:
        `"double"`.replaceAll(`"`, `'`);
  • keep line breaks
  • keep comments
  • keep spaces
  • don't put semicolons automatically
  • report missing semicolon ';'

eslint-clone's People

Contributors

erickwendel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.