Skip to content

Commit e2cca23

Browse files
Grand reformat (#7)
Enabling prettier for the repository
1 parent f6d2980 commit e2cca23

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+3114
-2261
lines changed

.eslintrc.yml

+21-44
Original file line numberDiff line numberDiff line change
@@ -7,89 +7,67 @@ extends:
77
ignorePatterns:
88
- scratch
99
- "*.js"
10-
parser: '@typescript-eslint/parser'
10+
parser: "@typescript-eslint/parser"
1111
parserOptions:
1212
ecmaVersion: latest
1313
sourceType: module
1414
project: ./tsconfig.json
1515
plugins:
16-
- '@typescript-eslint'
16+
- "@typescript-eslint"
17+
- prettier
1718
rules:
1819
indent:
1920
- error
2021
- 4
2122
- FunctionDeclaration:
22-
parameters:
23-
first
23+
parameters: first
2424
CallExpression:
25-
arguments:
26-
first
27-
MemberExpression:
28-
1
29-
SwitchCase:
30-
1
31-
ImportDeclaration:
32-
first
25+
arguments: first
26+
MemberExpression: 1
27+
SwitchCase: 1
28+
ImportDeclaration: first
3329
max-len:
3430
- error
3531
- 120
3632
semi:
3733
- error
3834
- always
39-
quotes:
40-
- error
41-
- double
4235
no-unused-vars:
4336
- off
4437
no-constant-condition:
4538
- off
4639
semi-spacing:
4740
- error
48-
- before:
49-
false
50-
after:
51-
true
41+
- before: false
42+
after: true
5243
no-empty:
5344
- error
54-
- allowEmptyCatch:
55-
true
45+
- allowEmptyCatch: true
5646
object-curly-spacing:
5747
- error
5848
- always
59-
array-bracket-spacing:
60-
- error
61-
- always
62-
- singleValue:
63-
false
64-
objectsInArrays:
65-
false
66-
arraysInArrays:
67-
false
68-
space-in-parens:
69-
- error
70-
- never
7149
comma-spacing:
7250
- error
7351
computed-property-spacing:
7452
- error
7553
brace-style:
7654
- error
7755
- 1tbs
78-
- allowSingleLine:
79-
true
56+
- allowSingleLine: true
8057
eol-last:
8158
- error
8259
semi-style:
8360
- error
8461
- last
62+
prefer-const:
63+
- error
64+
- destructuring: all
65+
"prettier/prettier": "error"
8566
"@typescript-eslint/no-unused-vars":
8667
- warn
87-
- destructuredArrayIgnorePattern:
88-
^_
89-
argsIgnorePattern:
90-
^_
91-
varsIgnorePattern:
92-
^assert$|^M$
68+
- destructuredArrayIgnorePattern: ^_
69+
argsIgnorePattern: ^_
70+
varsIgnorePattern: ^assert$|^M$
9371
"@typescript-eslint/no-non-null-assertion":
9472
- off
9573
"@typescript-eslint/no-explicit-any":
@@ -98,12 +76,11 @@ rules:
9876
- error
9977
"@typescript-eslint/no-unnecessary-condition":
10078
- error
101-
- allowConstantLoopConditions:
102-
true
79+
- allowConstantLoopConditions: true
10380
"@typescript-eslint/no-this-alias":
10481
- error
10582
- allowedNames:
106-
- self
83+
- self
10784
"@typescript-eslint/no-floating-promises":
10885
- "error"
10986
"@typescript-eslint/no-misused-promises":

.github/workflows/build.yml

+16-16
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ jobs:
88
build:
99
runs-on: ubuntu-20.04
1010
steps:
11-
- name: checkout
12-
uses: actions/checkout@v3
13-
- name: dependencies
14-
run: |
15-
npm install -g typescript
16-
npm i
17-
- name: build bot
18-
run: tsc
19-
- name: build cppref scraper
20-
run: |
21-
cd indexes/cppref
22-
tsc
23-
- name: build man7 scraper
24-
run: |
25-
cd indexes/man7
26-
tsc
11+
- name: checkout
12+
uses: actions/checkout@v3
13+
- name: dependencies
14+
run: |
15+
npm install -g typescript
16+
npm i
17+
- name: build bot
18+
run: tsc
19+
- name: build cppref scraper
20+
run: |
21+
cd indexes/cppref
22+
tsc
23+
- name: build man7 scraper
24+
run: |
25+
cd indexes/man7
26+
tsc

.github/workflows/eslint.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ jobs:
88
run-eslint:
99
runs-on: ubuntu-20.04
1010
steps:
11-
- name: checkout
12-
uses: actions/checkout@v3
13-
- name: dependencies
14-
run: npm i --dev
15-
- name: lint
16-
run: npm run lint
11+
- name: checkout
12+
uses: actions/checkout@v3
13+
- name: dependencies
14+
run: npm i --dev
15+
- name: lint
16+
run: npm run lint

.github/workflows/test.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ jobs:
88
run-tests:
99
runs-on: ubuntu-20.04
1010
steps:
11-
- name: checkout
12-
uses: actions/checkout@v3
13-
- name: dependencies
14-
run: npm i --dev
15-
- name: run test
16-
run: npm test
11+
- name: checkout
12+
uses: actions/checkout@v3
13+
- name: dependencies
14+
run: npm i --dev
15+
- name: run test
16+
run: npm test

.husky/pre-commit

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
. "$(dirname -- "$0")/_/husky.sh"
33

44
#tsc --noEmit
5-
npx lint-staged
5+
npx lint-staged --verbose
66
#npm test

.prettierignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
indexes
2+
build
3+
.vscode
4+
.idea
5+
node_modules
6+
wiki_articles

.prettierrc.cjs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
trailingComma: "all",
3+
printWidth: 120,
4+
singleQuote: false,
5+
arrowParens: "avoid",
6+
tabWidth: 4,
7+
proseWrap: "always",
8+
overrides: [
9+
{
10+
files: "*.{yml,md}",
11+
options: {
12+
tabWidth: 2,
13+
},
14+
},
15+
],
16+
};

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ Secrets and other bot info must be configured in the bot.json file. An example l
2525

2626
```json
2727
{
28-
"id": "<bot id>",
29-
"guild": "<guild id>",
30-
"token": "<discord api token>",
31-
"mongouser": "wheatley",
32-
"mongopassword": "<mongo password>"
28+
"id": "<bot id>",
29+
"guild": "<guild id>",
30+
"token": "<discord api token>",
31+
"mongouser": "wheatley",
32+
"mongopassword": "<mongo password>"
3333
}
3434
```
3535

@@ -38,8 +38,8 @@ can be specified to turn on only components which don't rely on channels etc. sp
3838

3939
## Database
4040

41-
The bot uses MongoDB. It previously used a giant json file (the migration script is located in the scripts folder).
42-
For local development you likely won't need to setup a mongo database, depending on the components you're working on.
41+
The bot uses MongoDB. It previously used a giant json file (the migration script is located in the scripts folder). For
42+
local development you likely won't need to setup a mongo database, depending on the components you're working on.
4343
However, if you are contributing to components that do need the database here are the installation steps for ubuntu:
4444

4545
https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/

lint-staged.config.mjs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export default {
2+
"*.ts": [() => "npm run ts-check", "npm run format-files --", "npm run lint-files --"],
3+
"*.js": ["npm run format-files --", "npm run lint-files --"],
4+
"*.{html,md}": ["npm run format-files --"],
5+
};

0 commit comments

Comments
 (0)