feat: Add ESLint (#176)
This commit is contained in:
parent
cbda52be05
commit
c0eeac3feb
3
.eslintrc.json
Normal file
3
.eslintrc.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"extends": "@excalidraw/eslint-config"
|
||||||
|
}
|
8
.github/dependabot.yml
vendored
8
.github/dependabot.yml
vendored
@ -1,6 +1,8 @@
|
|||||||
version: 2
|
version: 2
|
||||||
updates:
|
updates:
|
||||||
- package-ecosystem: "npm"
|
- package-ecosystem: npm
|
||||||
directory: "/"
|
directory: /
|
||||||
schedule:
|
schedule:
|
||||||
interval: "weekly"
|
interval: weekly
|
||||||
|
day: sunday
|
||||||
|
time: "01:00"
|
||||||
|
8
.github/workflows/lint.yml
vendored
8
.github/workflows/lint.yml
vendored
@ -6,17 +6,13 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
|
|
||||||
- name: Setup Node.js 14.x
|
- name: Setup Node.js 14.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: 14.x
|
node-version: 14.x
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn
|
run: yarn --frozen-lockfile
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: yarn lint
|
run: yarn test:other
|
||||||
|
1
.github/workflows/publish-docker.yml
vendored
1
.github/workflows/publish-docker.yml
vendored
@ -8,7 +8,6 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
publish-docker:
|
publish-docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: docker/build-push-action@v1
|
- uses: docker/build-push-action@v1
|
||||||
|
8
.github/workflows/test.yml
vendored
8
.github/workflows/test.yml
vendored
@ -6,19 +6,15 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
|
|
||||||
- name: Setup Node.js 14.x
|
- name: Setup Node.js 14.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: 14.x
|
node-version: 14.x
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn
|
run: yarn --frozen-lockfile
|
||||||
|
|
||||||
- name: Test and Build
|
- name: Test and Build
|
||||||
run: |
|
run: |
|
||||||
yarn test
|
yarn test:code
|
||||||
yarn build
|
yarn build
|
||||||
|
21
package.json
21
package.json
@ -1,16 +1,22 @@
|
|||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@excalidraw/eslint-config": "1.0.0",
|
||||||
"@excalidraw/prettier-config": "1.0.2",
|
"@excalidraw/prettier-config": "1.0.2",
|
||||||
"@types/debug": "4.1.5",
|
"@types/debug": "4.1.5",
|
||||||
"@types/express": "4.17.11",
|
"@types/express": "4.17.11",
|
||||||
"@types/node": "14.14.31",
|
"@types/node": "14.14.31",
|
||||||
"@types/socket.io": "2.1.4",
|
"@types/socket.io": "2.1.4",
|
||||||
|
"@typescript-eslint/eslint-plugin": "4.16.1",
|
||||||
|
"@typescript-eslint/parser": "4.16.1",
|
||||||
"debug": "4.3.1",
|
"debug": "4.3.1",
|
||||||
|
"eslint": "7.21.0",
|
||||||
|
"eslint-config-prettier": "8.1.0",
|
||||||
|
"eslint-plugin-prettier": "3.3.1",
|
||||||
"express": "4.17.1",
|
"express": "4.17.1",
|
||||||
"prettier": "2.2.1",
|
"prettier": "2.2.1",
|
||||||
"socket.io": "2.3.0",
|
"socket.io": "2.3.0",
|
||||||
"ts-node-dev": "1.1.1",
|
"ts-node-dev": "1.1.6",
|
||||||
"typescript": "4.1.5"
|
"typescript": "4.2.2"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
@ -18,12 +24,15 @@
|
|||||||
"prettier": "@excalidraw/prettier-config",
|
"prettier": "@excalidraw/prettier-config",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"format": "yarn prettier --write",
|
"fix:code": "yarn test:code --fix",
|
||||||
"lint": "yarn prettier --list-different",
|
"fix:other": "yarn prettier --write",
|
||||||
"prettier": "prettier \"**/*.{ts,md,json,yaml,yml}\"",
|
"fix": "yarn fix:other && yarn fix:code",
|
||||||
|
"prettier": "prettier . --ignore-path=.gitignore",
|
||||||
"start": "node dist/index.js",
|
"start": "node dist/index.js",
|
||||||
"start:dev": "ts-node-dev --respawn --transpile-only src/index.ts",
|
"start:dev": "ts-node-dev --respawn --transpile-only src/index.ts",
|
||||||
"test": "yarn lint"
|
"test:code": "eslint --ext .ts .",
|
||||||
|
"test:other": "yarn prettier --list-different",
|
||||||
|
"test": "yarn test:other && yarn test:code"
|
||||||
},
|
},
|
||||||
"version": "1.0.0"
|
"version": "1.0.0"
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ server.listen(port, () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const io = socketIO(server, {
|
const io = socketIO(server, {
|
||||||
handlePreflightRequest: function (req, res) {
|
handlePreflightRequest: (req, res) => {
|
||||||
const headers = {
|
const headers = {
|
||||||
"Access-Control-Allow-Headers": "Content-Type, Authorization",
|
"Access-Control-Allow-Headers": "Content-Type, Authorization",
|
||||||
"Access-Control-Allow-Origin":
|
"Access-Control-Allow-Origin":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user