add linter 💚

This commit is contained in:
Jannis R 2022-04-03 14:15:36 +02:00
parent 666c84b5f7
commit ae846d198d
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
4 changed files with 22 additions and 2 deletions

17
.eslintrc.json Normal file
View file

@ -0,0 +1,17 @@
{
"extends": "eslint:recommended",
"env": {
"commonjs": true,
"es6": true,
"node": true
},
"parserOptions": {
"ecmaVersion": 2018
},
"ignorePatterns": [
"node_modules"
],
"rules": {
"no-unused-vars": "off"
}
}

View file

@ -15,6 +15,7 @@ jobs:
with: with:
node-version: 16.x node-version: 16.x
- run: npm install - run: npm install
- run: npm run lint
- run: npm test - run: npm test
build-and-publish: build-and-publish:
name: build & publish Docker image name: build & publish Docker image

4
api.js
View file

@ -64,8 +64,8 @@ const modifyRoutes = (routes, hafas, config) => {
} }
const config = { const config = {
hostname: process.env.HOSTNAME || 'localhost', hostname: process.env.HOSTNAME || 'localhost',
port: process.env.PORT ? parseInt(process.env.PORT) : 3000, port: process.env.PORT ? parseInt(process.env.PORT) : 3000,
name: pkg.name, name: pkg.name,
description: pkg.description, description: pkg.description,
homepage: pkg.homepage, homepage: pkg.homepage,

View file

@ -37,6 +37,7 @@
"devDependencies": { "devDependencies": {
"@derhuerst/technical-docs-cli": "^1.1.0", "@derhuerst/technical-docs-cli": "^1.1.0",
"axios": "^0.26.1", "axios": "^0.26.1",
"eslint": "^8.12.0",
"get-port": "^5.1.1", "get-port": "^5.1.1",
"pino-pretty": "^4.0.0", "pino-pretty": "^4.0.0",
"tap-min": "^2.0.0", "tap-min": "^2.0.0",
@ -46,6 +47,7 @@
"docs": "node api-docs.js >docs/api.md && build-technical-doc --syntax-stylesheet-url /syntax.css <docs/readme.md >docs/index.html && build-technical-doc --syntax-stylesheet-url /syntax.css <docs/getting-started.md >docs/getting-started.html && build-technical-doc --syntax-stylesheet-url /syntax.css <docs/api.md >docs/api.html && build-technical-doc --syntax-stylesheet github >docs/syntax.css", "docs": "node api-docs.js >docs/api.md && build-technical-doc --syntax-stylesheet-url /syntax.css <docs/readme.md >docs/index.html && build-technical-doc --syntax-stylesheet-url /syntax.css <docs/getting-started.md >docs/getting-started.html && build-technical-doc --syntax-stylesheet-url /syntax.css <docs/api.md >docs/api.html && build-technical-doc --syntax-stylesheet github >docs/syntax.css",
"build": "npm run docs", "build": "npm run docs",
"start": "node index.js", "start": "node index.js",
"lint": "eslint .",
"test": "node test.js | tap-min" "test": "node test.js | tap-min"
} }
} }