Procházet zdrojové kódy

feat: Add ESLint (#176)

master
Lipis před 3 roky
rodič
revize
c0eeac3feb
Žádný účet není propojen s e-mailovou adresou tvůrce revize

+ 3
- 0
.eslintrc.json Zobrazit soubor

@@ -0,0 +1,3 @@
1
+{
2
+  "extends": "@excalidraw/eslint-config"
3
+}

+ 5
- 3
.github/dependabot.yml Zobrazit soubor

@@ -1,6 +1,8 @@
1 1
 version: 2
2 2
 updates:
3
-  - package-ecosystem: "npm"
4
-    directory: "/"
3
+  - package-ecosystem: npm
4
+    directory: /
5 5
     schedule:
6
-      interval: "weekly"
6
+      interval: weekly
7
+      day: sunday
8
+      time: "01:00"

+ 2
- 6
.github/workflows/lint.yml Zobrazit soubor

@@ -6,17 +6,13 @@ on:
6 6
 jobs:
7 7
   lint:
8 8
     runs-on: ubuntu-latest
9
-
10 9
     steps:
11 10
       - uses: actions/checkout@v1
12
-
13 11
       - name: Setup Node.js 14.x
14 12
         uses: actions/setup-node@v1
15 13
         with:
16 14
           node-version: 14.x
17
-
18 15
       - name: Install dependencies
19
-        run: yarn
20
-
16
+        run: yarn --frozen-lockfile
21 17
       - name: Lint
22
-        run: yarn lint
18
+        run: yarn test:other

+ 0
- 1
.github/workflows/publish-docker.yml Zobrazit soubor

@@ -8,7 +8,6 @@ on:
8 8
 jobs:
9 9
   publish-docker:
10 10
     runs-on: ubuntu-latest
11
-
12 11
     steps:
13 12
       - uses: actions/checkout@v2
14 13
       - uses: docker/build-push-action@v1

+ 2
- 6
.github/workflows/test.yml Zobrazit soubor

@@ -6,19 +6,15 @@ on:
6 6
 jobs:
7 7
   test:
8 8
     runs-on: ubuntu-latest
9
-
10 9
     steps:
11 10
       - uses: actions/checkout@v1
12
-
13 11
       - name: Setup Node.js 14.x
14 12
         uses: actions/setup-node@v1
15 13
         with:
16 14
           node-version: 14.x
17
-
18 15
       - name: Install dependencies
19
-        run: yarn
20
-
16
+        run: yarn --frozen-lockfile
21 17
       - name: Test and Build
22 18
         run: |
23
-          yarn test
19
+          yarn test:code
24 20
           yarn build

+ 15
- 6
package.json Zobrazit soubor

@@ -1,16 +1,22 @@
1 1
 {
2 2
   "dependencies": {
3
+    "@excalidraw/eslint-config": "1.0.0",
3 4
     "@excalidraw/prettier-config": "1.0.2",
4 5
     "@types/debug": "4.1.5",
5 6
     "@types/express": "4.17.11",
6 7
     "@types/node": "14.14.31",
7 8
     "@types/socket.io": "2.1.4",
9
+    "@typescript-eslint/eslint-plugin": "4.16.1",
10
+    "@typescript-eslint/parser": "4.16.1",
8 11
     "debug": "4.3.1",
12
+    "eslint": "7.21.0",
13
+    "eslint-config-prettier": "8.1.0",
14
+    "eslint-plugin-prettier": "3.3.1",
9 15
     "express": "4.17.1",
10 16
     "prettier": "2.2.1",
11 17
     "socket.io": "2.3.0",
12
-    "ts-node-dev": "1.1.1",
13
-    "typescript": "4.1.5"
18
+    "ts-node-dev": "1.1.6",
19
+    "typescript": "4.2.2"
14 20
   },
15 21
   "license": "MIT",
16 22
   "main": "dist/index.js",
@@ -18,12 +24,15 @@
18 24
   "prettier": "@excalidraw/prettier-config",
19 25
   "scripts": {
20 26
     "build": "tsc",
21
-    "format": "yarn prettier --write",
22
-    "lint": "yarn prettier --list-different",
23
-    "prettier": "prettier \"**/*.{ts,md,json,yaml,yml}\"",
27
+    "fix:code": "yarn test:code --fix",
28
+    "fix:other": "yarn prettier --write",
29
+    "fix": "yarn fix:other && yarn fix:code",
30
+    "prettier": "prettier . --ignore-path=.gitignore",
24 31
     "start": "node dist/index.js",
25 32
     "start:dev": "ts-node-dev --respawn --transpile-only src/index.ts",
26
-    "test": "yarn lint"
33
+    "test:code": "eslint --ext .ts .",
34
+    "test:other": "yarn prettier --list-different",
35
+    "test": "yarn test:other && yarn test:code"
27 36
   },
28 37
   "version": "1.0.0"
29 38
 }

+ 1
- 1
src/index.ts Zobrazit soubor

@@ -23,7 +23,7 @@ server.listen(port, () => {
23 23
 });
24 24
 
25 25
 const io = socketIO(server, {
26
-  handlePreflightRequest: function (req, res) {
26
+  handlePreflightRequest: (req, res) => {
27 27
     const headers = {
28 28
       "Access-Control-Allow-Headers": "Content-Type, Authorization",
29 29
       "Access-Control-Allow-Origin":

+ 860
- 15
yarn.lock
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


Načítá se…
Zrušit
Uložit