This is a ruby linter project that helps you check for JavaScript linting errors and enforce good styling guide conventions in your code. Built with Ruby.
About | Built with | Installing | Testing | Style Guide | Author
This is a ruby linter that helps you check for JavaScript linting errors and enforce good styling guide conventions in your code.
Rubocop Linter installed on Machine
Install Using this command:
gem install rubocop
Rspec for testing installed on Machine
Install Using this command:
gem install rspec
Colorize Gem installed on Machine
Install Using this command:
gem install colorize
Clone this repository
git clone https://github.com/uimarshall/ruby-capstone-linters.git
cd ruby-capstone-linters
Type in the following command to run the linter on a JavaScript file in the folder
ruby bin/main.rb
cd ruby-capstone-linters
bundle install
to install the dependencies specified in the Gemfilerspec
to testThis Linter Enforces rules for the following
Checks for triple equality
```
# Bad Code
let fst = "first"
let scd = "first"
fst == scd
# Good Code
let fst = "first";
let scd = "first";
fst === scd;
```
Check for case sensitivity in naming variables.
```
# Bad Code
let FavColor = "green";
let Hobby = "football";
# Good Code
let favColor = "green";
let hobby = "football";
```
Checks for unexpected double line
```
# Bad Code
interest = FavColor + Hobby+ best_music;
function detectoffencies() {
let arr = [7, 9, 5, 4, +8];
var res = showError(arr);
}
# Good Code
interest = FavColor + Hobby+ best_music;
function detectoffencies() {
let arr = [7, 9, 5, 4, +8];
var res = showError(arr);
}
```
Checks that there is no underscore in naming
```
# Bad Code
food_things = "rice";
# Good Code
foodThings = "rice";
```
Checks that there are no spaces at end of line
```
# Bad Code
if (condition) {
"go"
# Good Code
if (condition) {
return "go"
}
```
Checks for missing closing braces
```
# Bad Code
if (condition) {
"go"
# Good Code
if (condition) {
return "go"
}
```
š¤ Marshall Akpan
Give a āļø if you like this project!