updates eslint to v8, adds some more linting rules

This commit is contained in:
Lars Berning 2022-01-29 14:15:33 +01:00
parent 2997da6ec4
commit 8d634b0a65
No known key found for this signature in database
GPG Key ID: 028E73C9E1D8A0B3
12 changed files with 477 additions and 895 deletions

View File

@ -5,13 +5,16 @@
"es2021": true
},
"extends": [
"standard"
"standard",
"plugin:import/recommended",
"plugin:node/recommended",
"plugin:promise/recommended"
],
"parserOptions": {
"ecmaVersion": 12,
"ecmaVersion": 13,
"sourceType": "module"
},
"ignorePatterns": ["**/*.min.js", "**/tools/ConfigManager.js"],
"ignorePatterns": ["**/*.min.js"],
"rules": {
"camelcase": 0
}

View File

@ -11,7 +11,7 @@ import log from 'loglevel'
export default class ValueReadCharacteristic extends bleno.Characteristic {
constructor (uuid, value, description) {
super({
uuid: uuid,
uuid,
properties: ['read', 'notify'],
value: null
})

View File

@ -6,12 +6,13 @@
},
"extends": [
"standard",
"plugin:import/recommended",
"plugin:wc/recommended",
"plugin:lit/recommended"
],
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaVersion": 12,
"ecmaVersion": 13,
"sourceType": "module"
},
"ignorePatterns": ["**/*.min.js"],

View File

@ -14,7 +14,7 @@ export class AppElement extends LitElement {
// this is how we implement a global state: a global state object is passed via properties
// to child components
@property({ type: Object })
appState = APP_STATE
appState = APP_STATE
// ..and state changes are send back to the root component of the app by dispatching
// a CustomEvent

View File

@ -21,7 +21,7 @@ export class DashboardMetric extends AppElement {
`
@property({ type: String })
batteryLevel = ''
batteryLevel = ''
render () {
// 416 is the max width value of the battery bar in the SVG graphic

View File

@ -35,13 +35,13 @@ export class DashboardMetric extends AppElement {
`
@property({ type: Object })
icon
icon
@property({ type: String })
unit = ''
unit = ''
@property({ type: String })
value = ''
value = ''
render () {
return html`

View File

@ -45,10 +45,10 @@ export class PerformanceDashboard extends AppElement {
`
@property({ type: Object })
metrics
metrics
@property({ type: Object })
appState = APP_STATE
appState = APP_STATE
render () {
const metrics = this.calculateFormattedMetrics(this.appState.metrics)

View File

@ -14,10 +14,10 @@ import './components/PerformanceDashboard.js'
@customElement('web-app')
export class App extends LitElement {
@state()
appState = APP_STATE
appState = APP_STATE
@state()
metrics
metrics
constructor () {
super()

View File

@ -144,7 +144,7 @@ function createRowingStatistics (config) {
durationTotalFormatted: secondsToTimeString(durationTotal),
strokesTotal,
distanceTotal: distanceTotal > 0 ? distanceTotal : 0, // meters
caloriesTotal: caloriesTotal, // kcal
caloriesTotal, // kcal
caloriesPerMinute: caloriesAveragerMinute.getAverage() > 0 ? caloriesAveragerMinute.getAverage() : 0,
caloriesPerHour: caloriesAveragerHour.getAverage() > 0 ? caloriesAveragerHour.getAverage() : 0,
strokeTime: lastStrokeDuration, // seconds
@ -153,7 +153,7 @@ function createRowingStatistics (config) {
split: splitTime, // seconds/500m
splitFormatted: secondsToTimeString(splitTime),
powerRatio: powerRatioAverager.getAverage() > 0 && lastStrokeSpeed > 0 && sessionState === 'rowing' ? powerRatioAverager.getAverage() : 0,
instantaneousTorque: instantaneousTorque,
instantaneousTorque,
strokesPerMinute: averagedStrokeTime !== 0 && sessionState === 'rowing' ? (60.0 / averagedStrokeTime) : 0,
speed: speedAverager.getAverage() > 0 && lastStrokeSpeed > 0 && sessionState === 'rowing' ? (speedAverager.getAverage() * 3.6) : 0, // km/h
strokeState: lastStrokeState,

View File

@ -10,6 +10,7 @@ import { deepMerge } from './Helper.js'
async function getConfig () {
let customConfig
try {
// eslint-disable-next-line node/no-unsupported-features/es-syntax
customConfig = await import('../../config/config.js')
} catch (exception) {}

1328
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,7 @@
"engines": {
"node": ">=14"
},
"files": ["*", "!/**/*.test.js"],
"scripts": {
"lint": "eslint ./app ./config && markdownlint '**/*.md' --ignore node_modules",
"start": "node app/server.js",
@ -58,12 +59,12 @@
"@rollup/plugin-node-resolve": "13.1.3",
"@snowpack/plugin-babel": "2.1.7",
"@web/rollup-plugin-html": "1.10.1",
"eslint": "7.32.0",
"eslint-config-standard": "16.0.3",
"eslint": "8.8.0",
"eslint-config-standard": "17.0.0-0",
"eslint-plugin-import": "2.25.4",
"eslint-plugin-lit": "1.6.1",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "5.2.0",
"eslint-plugin-promise": "6.0.0",
"eslint-plugin-wc": "1.3.2",
"http2-proxy": "5.0.53",
"markdownlint-cli": "0.30.0",