Skip to content

Commit

Permalink
chore: add eslint & prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
tkurki committed Feb 19, 2023
1 parent 6cd2d34 commit 128be9a
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 19 deletions.
29 changes: 18 additions & 11 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
// eslint-disable-next-line no-undef
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'prettier'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
],
rules: {
'no-console': 1, // Means warning
'prettier/prettier': 2, // Means error
extends: ['eslint:recommended', 'prettier'],
parserOptions: {
ecmaVersion: 2019,
sourceType: 'module'
},
env: {
node: true,
es2019: true
},
overrides: [
{
files: ['**/*.ts'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'prettier'
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint']
}
]
}
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install & lint
run: npm install && npm run ci-lint
- name: Run tests against InfluxDb2
run: docker-compose run plugintest
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
"scripts": {
"test": "docker-compose run plugintest",
"mocha": "mocha --require ts-node/register --extensions ts src/*.test.ts --timeout 5000",
"lint": "eslint src --ext .ts --fix",
"lint:only": "eslint src --ext .ts",
"prettier": "prettier -w src/",
"lint": "eslint -c .eslintrc.js --ext .ts --ext .js --fix src/",
"format": "npm run prettier && npm run lint",
"ci-lint": "eslint -c .eslintrc.js --ext .ts --ext .js src/ && prettier --check src/",
"generate-schema": "./generate-schema >dist/PluginConfig.json",
"build": "tsc && npm run generate-schema",
"prepublishOnly": "npm install && npm run build"
Expand All @@ -23,16 +26,16 @@
"@types/mocha": "^9.1.1",
"@types/node": "^18.7.6",
"@types/wait-on": "^5.3.1",
"@typescript-eslint/eslint-plugin": "^5.33.1",
"@typescript-eslint/parser": "^5.33.1",
"@typescript-eslint/eslint-plugin": "^5.52.0",
"@typescript-eslint/parser": "^5.52.0",
"async-await-retry": "^2.0.0",
"chai": "^4.3.6",
"eslint": "^8.22.0",
"eslint-config-prettier": "^8.5.0",
"eslint": "^8.34.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-prettier": "^4.2.1",
"json-schema-ref-parser": "^9.0.9",
"mocha": "^10.0.0",
"prettier": "^2.7.1",
"prettier": "^2.8.4",
"ts-node": "^10.9.1",
"typescript": "^4.7.4",
"typescript-json-schema": "^0.54.0",
Expand Down
1 change: 0 additions & 1 deletion src/plugin.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { expect } from 'chai'
import { ZonedDateTime } from '@js-joda/core'
import { EventEmitter } from 'stream'
import InfluxPluginFactory, { App, InfluxPlugin, Plugin } from './plugin'
import waitOn from 'wait-on'
Expand Down
1 change: 0 additions & 1 deletion src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import { SKInflux, SKInfluxConfig } from './influx'
import { SKDelta } from '@chacal/signalk-ts'
import { EventEmitter } from 'stream'
import { ZonedDateTime } from '@js-joda/core'

// eslint-disable-next-line @typescript-eslint/no-var-requires
const packageInfo = require('../package.json')
Expand Down

0 comments on commit 128be9a

Please sign in to comment.