Skip to content

Commit bb27846

Browse files
authored
Merge pull request #1 from hckrnews/feature/first-draft
Add files
2 parents 46ea685 + a63e3e1 commit bb27846

21 files changed

+4749
-31
lines changed

.editorconfig

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.yml]
15+
indent_size = 2

.eslintrc

+268
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,268 @@
1+
{
2+
"settings": {
3+
"jsdoc": {
4+
"mode": "typescript"
5+
}
6+
},
7+
"root": true,
8+
"extends": [
9+
"standard",
10+
"plugin:import/recommended",
11+
"plugin:n/recommended",
12+
"plugin:jsdoc/recommended",
13+
"plugin:sonarjs/recommended"
14+
],
15+
"parserOptions": {
16+
"sourceType": "module",
17+
"ecmaVersion": "latest"
18+
},
19+
"globals": {
20+
"fetch": false,
21+
"FormData": false,
22+
"Headers": false,
23+
"Request": false,
24+
"Response": false
25+
},
26+
"env": {
27+
"es2022": true,
28+
"node": true,
29+
"browser": true,
30+
"worker": true,
31+
"mongo": true,
32+
"serviceworker": true,
33+
"webextensions": true
34+
},
35+
"rules": {
36+
"block-scoped-var": "error",
37+
"complexity": [
38+
"error",
39+
{
40+
"max": 20
41+
}
42+
],
43+
"consistent-return": "error",
44+
"max-classes-per-file": [
45+
"error",
46+
1
47+
],
48+
"max-params": [
49+
"warn",
50+
5
51+
],
52+
"max-depth": [
53+
"warn",
54+
4
55+
],
56+
"max-statements": [
57+
"warn",
58+
20
59+
],
60+
"linebreak-style": [
61+
"warn",
62+
"unix"
63+
],
64+
"class-methods-use-this": "off",
65+
"no-alert": "error",
66+
"no-caller": "error",
67+
"no-extra-label": "error",
68+
"no-labels": [
69+
"error",
70+
{
71+
"allowLoop": false,
72+
"allowSwitch": false
73+
}
74+
],
75+
"no-loop-func": "error",
76+
"no-prototype-builtins": "off",
77+
"no-restricted-syntax": [
78+
"error",
79+
"ForInStatement",
80+
"LabeledStatement",
81+
"WithStatement"
82+
],
83+
"no-return-await": "error",
84+
"no-else-return": [
85+
"error",
86+
{
87+
"allowElseIf": false
88+
}
89+
],
90+
"no-multi-assign": [
91+
"error"
92+
],
93+
"arrow-body-style": [
94+
"error",
95+
"as-needed"
96+
],
97+
"no-console": "warn",
98+
"no-param-reassign": [
99+
"error",
100+
{
101+
"props": true,
102+
"ignorePropertyModificationsFor": [
103+
"acc",
104+
"accumulator",
105+
"e",
106+
"req",
107+
"request",
108+
"res",
109+
"response"
110+
]
111+
}
112+
],
113+
"no-useless-concat": "error",
114+
"no-nested-ternary": "error",
115+
"no-shadow": [
116+
"error",
117+
{
118+
"hoist": "all",
119+
"allow": [
120+
"resolve",
121+
"reject",
122+
"done",
123+
"next",
124+
"err",
125+
"error"
126+
]
127+
}
128+
],
129+
"radix": "error",
130+
"import/prefer-default-export": "off",
131+
"import/no-unresolved": [
132+
"error",
133+
{
134+
"caseSensitive": true
135+
}
136+
],
137+
"import/named": "error",
138+
"import/no-named-as-default": "error",
139+
"import/no-named-as-default-member": "error",
140+
"import/no-mutable-exports": "error",
141+
"import/order": [
142+
"error",
143+
{
144+
"groups": [
145+
[
146+
"builtin",
147+
"external",
148+
"internal"
149+
]
150+
]
151+
}
152+
],
153+
"import/no-self-import": "error",
154+
"import/no-cycle": [
155+
"error",
156+
{
157+
"maxDepth": "∞"
158+
}
159+
],
160+
"import/no-useless-path-segments": [
161+
"error",
162+
{
163+
"commonjs": true
164+
}
165+
],
166+
"n/no-unpublished-import": "off",
167+
"n/no-unsupported-features/es-syntax": [
168+
"off",
169+
{}
170+
],
171+
"vars-on-top": "error",
172+
"for-direction": "error",
173+
"getter-return": [
174+
"error",
175+
{
176+
"allowImplicit": true
177+
}
178+
],
179+
"no-await-in-loop": "error",
180+
"no-inner-declarations": "error",
181+
"no-var": "error",
182+
"no-lonely-if": "error",
183+
"prefer-arrow-callback": [
184+
"error",
185+
{
186+
"allowNamedFunctions": false,
187+
"allowUnboundThis": true
188+
}
189+
],
190+
"prefer-destructuring": [
191+
"error",
192+
{
193+
"VariableDeclarator": {
194+
"array": false,
195+
"object": true
196+
},
197+
"AssignmentExpression": {
198+
"array": true,
199+
"object": false
200+
}
201+
},
202+
{
203+
"enforceForRenamedProperties": false
204+
}
205+
],
206+
"prefer-rest-params": "error",
207+
"prefer-spread": "error",
208+
"prefer-template": "error",
209+
"require-yield": "error",
210+
"operator-assignment": [
211+
"error",
212+
"always"
213+
],
214+
"prefer-object-spread": "error",
215+
"no-delete-var": "error",
216+
"jsdoc/check-access": "off",
217+
"jsdoc/check-alignment": "error",
218+
"jsdoc/check-examples": "off",
219+
"jsdoc/check-indentation": "error",
220+
"jsdoc/check-line-alignment": "off",
221+
"jsdoc/check-param-names": "error",
222+
"jsdoc/check-property-names": "error",
223+
"jsdoc/check-syntax": "off",
224+
"jsdoc/check-tag-names": "error",
225+
"jsdoc/check-types": [
226+
"error",
227+
{
228+
"unifyParentAndChildTypeChecks": true
229+
}
230+
],
231+
"jsdoc/check-values": "error",
232+
"jsdoc/empty-tags": "error",
233+
"jsdoc/implements-on-classes": "error",
234+
"jsdoc/match-description": "off",
235+
"jsdoc/multiline-blocks": "error",
236+
"jsdoc/no-bad-blocks": "off",
237+
"jsdoc/no-defaults": "off",
238+
"jsdoc/no-missing-syntax": "off",
239+
"jsdoc/no-multi-asterisks": "error",
240+
"jsdoc/no-restricted-syntax": "off",
241+
"jsdoc/no-types": "off",
242+
"jsdoc/no-undefined-types": "error",
243+
"jsdoc/require-asterisk-prefix": "off",
244+
"jsdoc/require-description": "off",
245+
"jsdoc/require-description-complete-sentence": "off",
246+
"jsdoc/require-example": "off",
247+
"jsdoc/require-file-overview": "off",
248+
"jsdoc/require-hyphen-before-param-description": "off",
249+
"jsdoc/require-jsdoc": "off",
250+
"jsdoc/require-param": "error",
251+
"jsdoc/require-param-description": "off",
252+
"jsdoc/require-param-name": "error",
253+
"jsdoc/require-param-type": "error",
254+
"jsdoc/require-property": "error",
255+
"jsdoc/require-property-description": "off",
256+
"jsdoc/require-property-name": "error",
257+
"jsdoc/require-property-type": "error",
258+
"jsdoc/require-returns": "error",
259+
"jsdoc/require-returns-check": "error",
260+
"jsdoc/require-returns-description": "off",
261+
"jsdoc/require-returns-type": "error",
262+
"jsdoc/require-throws": "off",
263+
"jsdoc/require-yields": "error",
264+
"jsdoc/require-yields-check": "error",
265+
"jsdoc/tag-lines": "error",
266+
"jsdoc/valid-types": "warn"
267+
}
268+
}

.github/workflows/cpd.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Node Copy Paste Detector
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v3
11+
- name: Use Node.js 20
12+
uses: actions/setup-node@v3
13+
with:
14+
node-version: 20
15+
cache: "npm"
16+
- name: npm cpd
17+
run: |
18+
npm ci
19+
npm run cpd
20+
env:
21+
CI: true

.github/workflows/lint.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Node Lint
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v3
11+
- name: Use Node.js 20
12+
uses: actions/setup-node@v3
13+
with:
14+
node-version: 20
15+
cache: "npm"
16+
- name: npm lint
17+
run: |
18+
npm ci
19+
npm run lint
20+
env:
21+
CI: true

.github/workflows/npm-publish.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3+
4+
name: Node.js Package
5+
6+
on:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-node@v3
16+
with:
17+
node-version: 20
18+
- run: npm ci
19+
- run: npm test
20+
21+
publish-npm:
22+
needs: build
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v3
26+
- uses: actions/setup-node@v3
27+
with:
28+
node-version: 20
29+
registry-url: https://registry.npmjs.org/
30+
- run: npm ci
31+
- run: npm run build --if-present
32+
- run: npm publish --access public
33+
env:
34+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

.github/workflows/sonarcloud.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: SonarCloud
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v3
11+
- name: Use Node.js 20
12+
uses: actions/setup-node@v3
13+
with:
14+
node-version: 20
15+
cache: "npm"
16+
- name: npm install, lint, and test
17+
run: |
18+
npm ci
19+
npm run lint:report
20+
npm test
21+
env:
22+
CI: true
23+
- name: SonarCloud Scan
24+
uses: sonarsource/sonarcloud-github-action@master
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 commit comments

Comments
 (0)