Skip to content

Commit c7eac50

Browse files
authored
update to Style and Testing guides (#727)
1 parent bf7c3c7 commit c7eac50

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

STYLE_GUIDE.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ This is a style guide for the Web Extension code. Some of the code may not curre
1616
- Use double `(")` over single `(')` quotes for HTML attributes.
1717
- Use single `(')` over double `(")` quotes for CSS property values.
1818
- Inlined styles in HTML is OK temporarily, but please try to move to the .css file before final submission.
19+
- If you're repeating the same styles on multiple *#ids*, consider placing those styles in a class!
1920

2021
#### Naming ####
2122

2223
- CSS ids and classes should be in `hyphen-style`.
2324
- Try to avoid using CamelCase or underscores.
24-
25+
- Try to limit use of single-word classes and ids. 2-word ids are better. 3-word ids are fine too.
2526

2627
#### Example ####
2728

@@ -51,7 +52,7 @@ This is a style guide for the Web Extension code. Some of the code may not curre
5152
- Function names should be in `lowerCamelCase`.
5253
- Class names in `UpperCamelCase`.
5354
- Variables can be `lowercase`, `lowerCamelCase`, or `under_scored`.
54-
- Global or class-scoped constants in `CONSTANT_CASE`. Locally-scoped may remain lowercased if desired.
55+
- Global or class-scoped constants in `CONSTANT_CASE`. Since `const` in Javascript doesn't really mean constant, but *one-time assignment*, please only convert *true* constants to uppercase (e.g. `const PI = 3.14159`), and leave the rest like variable names.
5556

5657
#### Example ####
5758

TESTING_GUIDE.md

+11-9
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,21 @@ After modifying code, run **eslint** to catch basic formatting and syntax issues
1616

1717
#### To Install ####
1818

19-
```
20-
npm install eslint --save-dev
21-
```
19+
If you haven't already set up your testing environment, run `npm install` to install the required packages including `eslint` which is listed in `package.json`.
2220

2321
#### Running ESLint ####
2422

25-
Run from the root directory where `package.json` is located:
23+
Run from the root directory where `package.json` is located.
2624

27-
```
28-
npx eslint webextension/scripts/example.js
29-
OR
30-
eslint webextension/scripts/example.js
31-
```
25+
##### To see options: #####
26+
27+
`npx eslint`
28+
29+
This runs the version of eslint located at `node_modules/.bin/`. Some people install eslint globally on their system. If that is your case you may leave out the `npx` part if you want.
30+
31+
##### To lint a js file: #####
32+
33+
`npx eslint webextension/scripts/example.js`
3234

3335
- Recommend **not** using the `--fix` option but first try to fix it manually.
3436

0 commit comments

Comments
 (0)