Add linting support
This commit is contained in:
parent
53d1654387
commit
ec1cacd253
6
.babelrc
Normal file
6
.babelrc
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"presets": ["@babel/env"],
|
||||
"plugins": [
|
||||
"@babel/plugin-syntax-class-properties"
|
||||
]
|
||||
}
|
16
.eslintrc.yml
Normal file
16
.eslintrc.yml
Normal file
@ -0,0 +1,16 @@
|
||||
env:
|
||||
node: true
|
||||
browser: false
|
||||
commonjs: true
|
||||
es6: true
|
||||
mocha: true
|
||||
extends:
|
||||
- eslint:recommended
|
||||
parser: "@babel/eslint-parser"
|
||||
parserOptions:
|
||||
babelOptions:
|
||||
configFile: './.babelrc'
|
||||
ecmaVersion: 2018
|
||||
plugins:
|
||||
- "@babel"
|
||||
rules: {}
|
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
@ -39,6 +39,7 @@ jobs:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- run: npm ci
|
||||
- run: npm run build --if-present
|
||||
- run: npm run lint
|
||||
- run: npm test
|
||||
|
||||
- name: Set up QEMU
|
||||
|
6529
package-lock.json
generated
6529
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -5,6 +5,7 @@
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
"coverage": "nyc npm test",
|
||||
"lint": "npx eslint src test",
|
||||
"start": "node src/index.js",
|
||||
"test": "mocha"
|
||||
},
|
||||
@ -36,6 +37,14 @@
|
||||
"winston": "^3.3.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/eslint-parser": "^7.14.5",
|
||||
"@babel/eslint-plugin": "^7.14.5",
|
||||
"@babel/plugin-syntax-class-properties": "^7.12.13",
|
||||
"@babel/preset-env": "^7.14.5",
|
||||
"eslint": "^7.28.0",
|
||||
"eslint-plugin-import": "^2.23.4",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^5.1.0",
|
||||
"mocha": "^9.0.0",
|
||||
"nyc": "^15.1.0"
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ const _ = require('lodash');
|
||||
const Vehicle = require('./vehicle');
|
||||
const {Diagnostic} = require('./diagnostic');
|
||||
const MQTT = require('./mqtt');
|
||||
const Commands = require('./commands');
|
||||
const {Commands} = require('./commands');
|
||||
const logger = require('./logger');
|
||||
|
||||
|
||||
|
@ -129,6 +129,7 @@ class MQTT {
|
||||
break;
|
||||
default:
|
||||
// coerce to number if possible, API uses strings :eyeroll:
|
||||
// eslint-disable-next-line no-case-declarations
|
||||
const num = _.toNumber(e.value);
|
||||
value = _.isNaN(num) ? e.value : num;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user