feat: Add ESLint (#176)

This commit is contained in:
Lipis 2021-03-03 10:25:30 +02:00 committed by GitHub
parent cbda52be05
commit c0eeac3feb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 888 additions and 38 deletions

3
.eslintrc.json Normal file
View File

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

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"
} }

View File

@ -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":

875
yarn.lock

File diff suppressed because it is too large Load Diff