diff --git a/.eslintrc.js b/.eslintrc.js index 12c7149..e6c8977 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -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'] + } + ] } diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 860ef34..4de5d81 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 \ No newline at end of file diff --git a/package.json b/package.json index f1ab564..1c1f67f 100644 --- a/package.json +++ b/package.json @@ -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" @@ -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", diff --git a/src/plugin.test.ts b/src/plugin.test.ts index 2f20dde..9d8750c 100644 --- a/src/plugin.test.ts +++ b/src/plugin.test.ts @@ -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' diff --git a/src/plugin.ts b/src/plugin.ts index 2258564..aeeb26e 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -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')