OSD600 Lab 7

 For this week's lab in my Open Source Development class, we looked at static Analysis tooling. The tools we needed to add to our link checkers were a source code formatter and linter. I decided to use Prettier for my source code formatter and ESLint for my linter. Prettier is a formatter that helps make code more readable. One really useful feature it has is it allows you to "customize" how you want it to format your code by making a .prettier.rc file. For example in mine, I make sure every line ends with a semicolon, the padding width is 70 and I allow trailing commas.

Prettier logo
ESLint is is another static Analysis code tool for catching "silly" mistakes in JavaScript. It will raise an error and let you immediately if you did something wrong. This can also be helpful to enforce coding styles. Similar to Prettier it allows you to "customize" how you want it to check your code by making a .eslintrc.json file. For my code, I made sure every line ends with a semicolon and to only use double-quotes.

ESLint logo

The reason I chose these tools is that I am aware they are used in Telescope and thought it would be a good idea to learn how to use them in case I need to do something with them while working on telescope.

When setting up prettier and ESLint I first installed the node modules (npm install --save-dev --save-exact, and npm install eslint). After that I made a .vscode folder with 2 files: extenssions.json and settings.json. extenssions.json will let people know what extensions they need to install in VS code the first time they open the project and ask if they wish to install the recommended extensions. settings.json allows the static Analysis tools to run automatically every time you save a file. ESLint found some imports I was not using, and prettier helped format the code nicer. Running the tools from the command line was pretty straightforward since I read the docs (ESLint and Prettier). Integrating from the IDE was a bit tough but I looked at the code in Telescope to get an idea. I did run into some issues because at first, I installed these tools in the wrong directory, then my folder structure got messed up. But after I took a step back and fixed everything it worked fine! Besides learning how to use and configure Prettier and ESLint I learned to be more careful and pay attention to where in the folder you are running commands. To be honest I still have no idea how my folder structure got messed up but I'm happy I was able to fix it! 😀 












Comments

Popular posts from this blog

OSD600 Release 0.4 Part 3

OSD600 Lab 5

Release 0.3 PR2