From 8a5fcf99cb4c11f695390ea9dae26e2c3470113e Mon Sep 17 00:00:00 2001 From: crossboy Date: Fri, 15 Dec 2023 15:15:39 -0800 Subject: [PATCH] Move Testing.md and create Style.md --- README.md | 3 +- specs/Style.md | 83 +++++++++++++++++++++++++++++++++++++ {admin => specs}/Testing.md | 0 3 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 specs/Style.md rename {admin => specs}/Testing.md (100%) diff --git a/README.md b/README.md index b9a5418..61bc87b 100644 --- a/README.md +++ b/README.md @@ -108,5 +108,6 @@ Pushing to main is blocked unless all of the above steps pass and the code is ap # Additional Documentation -- [Testing](admin/Testing.md) +- [Testing Specification](specs/Testing.md) - [Trending Specification](specs/Trending%20posts%20specification.md) +- [Style Specification](specs/Style.md) diff --git a/specs/Style.md b/specs/Style.md new file mode 100644 index 0000000..576559c --- /dev/null +++ b/specs/Style.md @@ -0,0 +1,83 @@ +# Style Specification + +Our automated linting on the client side utilizes [ESLint](https://eslint.org/) with the [Stylistic](https://eslint.style/) plugin to automate and enforce our style guidelines. + +We utilize the recommended defaults for these two tools to create a wide spread of consistency between our code without needing to customize every single setting. Our approach was to use the defaults, watch for anything unusual, and edit our configuration as necessary. Due to the length of these default lists, we will instead link to the full lists and add any changes or customizations we added below. + +## Default Lists +- [ESLint](https://eslint.org/docs/latest/rules/) (Rules with a ✅ are enabled) +- [Stylistic](https://eslint.style/rules) + +## Customizations + +### @stylistic/indent + +Indentatiosn use four spaces. + +```js +function abc() { + console.log("Hello World!"); +} +``` + +### @stylistic/quotes + +Strings are made with double quotes. + +```js +const txt = "CSE 210 is awesome!"; +``` + +### @stylistic/semi + +Semicolins must be included. + +```js +console.log("#PowellGang"); +``` + +### @stylistic/arrow-spacing + +Arrow functions must have a space before and after the `=>`. + +```js +(a, b) => { + ... +} +``` + +### @stylistic/block-spacing + +Single line blocks must have a space between the curly braces and code. Multiline blocks must have the code start on a new line from the curly brace. + +```js +function foo() { return true; } + +function bar() { + const x = "a"; + return x; +} +``` + +### linebreak-style + +Linebreaks use CRLF. + +### no-var + +Disallows the use of `var`. + +```js +let x = 1; +const y = 2; +``` + +### prefer-const + +Requires const declarations for variables that are never reassigned after being declared. + +```js +const x = 1; +let y = 2; +y = 3; +``` \ No newline at end of file diff --git a/admin/Testing.md b/specs/Testing.md similarity index 100% rename from admin/Testing.md rename to specs/Testing.md