Skip to content

JavaScript Linter(Simple Eslint Rip-off) written in ruby that flags basic errors to improve code readability.

Notifications You must be signed in to change notification settings

Ceejayski/Javascript-linter-in-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Javascript-linter-in-ruby

This project is a Javascript linter that flags basic errors to improve readablity.

Listed below are the methods built in this project:

  • file_empty?
  • semicolon_check
  • trailing_space
  • parenthesis_check
  • check_classname
  • last_line_space_check
  • error_sort

Good code

class CarService{
    constructor(name,country){
        this.name = name;
        this.country = country;
    this.carsToRepairs = new Array();
    }
    addcar(car){
        this.carsToRepairs.push(car);
    }
}
#one line space

Bad code

class 2CarService{ #Invalid Classname 
    constructor(name,country){
        this.name = name # mising semi_colon
        this.country = country;    #trailing space found
    this.carsToRepairs = new Array();
    }
    addcar(car){
        this.carsToRepairs.push(car);
    }
}
} #Unexpected parenthesis

# multiple blank last line
# multiple blank last line
# multiple blank last line

Project Structure

├── README.md
├── bin
│   └── main.rb
└── lib
     └── linter_cops.rb

Prerequisites

  • Text editor
  • Github profile
  • Git and Ruby.
  • Rubocop

Installations

  • Firstly, in order to run this on your local machine, you are going to need ruby already setup on your machine, so click this link if you don't have ruby already installed and download for your specific machine.

Test

1. Open a terminal
2. Run 'gem install rspec'
3. Run rspec --init
3. Run rspec in the terminal

Video Presentation

  • View the video presentation here

How to Run the Program

$ git clone https://github.com/Ceejayski/Javascript-linter-in-ruby

This linter checks all Javascript file(.js) within the folder, follow the steps below to get setup

  • Open your git bash and clone the repo.

  • go to the folder and copy out the bin and lib folder into your project directory

  • run ./bin/main <file-path> to check a particular file eg. ./bin/main test/test.js OR run ./bin/main -all to check all js files in the directory

  • Good job you are now setup and ready to Check all your javascript file in project directory for linter error 👌🙌

Authors:

👤 Ceejayski

Show your support

Give a ⭐️ if you like this project!

Acknowledgments

  • Microverse
  • GitHub
  • Theodinproject.com

About

JavaScript Linter(Simple Eslint Rip-off) written in ruby that flags basic errors to improve code readability.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published