Skip to content

Commit

Permalink
fixed eslint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mdaskalov committed Oct 20, 2024
1 parent 7ee2621 commit e137846
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 48 deletions.
34 changes: 0 additions & 34 deletions .eslintrc

This file was deleted.

54 changes: 54 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import tsParser from '@typescript-eslint/parser';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [{
ignores: ['**/dist'],
}, ...compat.extends(
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
), {
languageOptions: {
parser: tsParser,
ecmaVersion: 2018,
sourceType: 'module',
},

rules: {
quotes: ['warn', 'single'],

indent: ['warn', 2, {
SwitchCase: 1,
}],
semi: ['warn', 'always'],
'comma-dangle': ['warn', 'always-multiline'],
'dot-notation': 'off',
eqeqeq: 'warn',
curly: ['warn', 'all'],
'brace-style': ['warn'],
'prefer-arrow-callback': ['warn'],
'max-len': ['warn', 140],
'no-console': ['warn'],
'no-non-null-assertion': ['off'],
'comma-spacing': ['error'],

'no-multi-spaces': ['warn', {
ignoreEOLComments: true,
}],

'lines-between-class-members': ['warn', 'always', {
exceptAfterSingleLine: true,
}],
},
}];
24 changes: 12 additions & 12 deletions src/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ export class Color {
const q = 1 - f * s;
const t = 1 - (1 - f) * s;
switch (i % 6) {
case 0: g = t, b = p; break;
case 1: r = q, b = p; break;
case 2: r = p, b = t; break;
case 3: r = p, g = q; break;
case 4: r = t, g = p; break;
case 5: g = p, b = q; break;
case 0: g = t; b = p; break;
case 1: r = q; b = p; break;
case 2: r = p; b = t; break;
case 3: r = p; g = q; break;
case 4: r = t; g = p; break;
case 5: g = p; b = q; break;
}

// apply gamma correction
Expand Down Expand Up @@ -262,12 +262,12 @@ export class Color {
const q = v * (1 - f * s);
const t = v * (1 - (1 - f) * s);
switch (i % 6) {
case 0: r = v, g = t, b = p; break;
case 1: r = q, g = v, b = p; break;
case 2: r = p, g = v, b = t; break;
case 3: r = p, g = q, b = v; break;
case 4: r = t, g = p, b = v; break;
case 5: r = v, g = p, b = q; break;
case 0: r = v; g = t; b = p; break;
case 1: r = q; g = v; b = p; break;
case 2: r = p; g = v; b = t; break;
case 3: r = p; g = q; b = v; break;
case 4: r = t; g = p; b = v; break;
case 5: r = v; g = p; b = q; break;
}
return {
r,
Expand Down
2 changes: 1 addition & 1 deletion src/tasmotaAccessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class TasmotaAccessory {
try {
obj = JSON.parse(message);
this.updateStatus(obj);
} catch (err) {
} catch {
this.updateStatus({ message });
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/zigbee2TasmotaAccessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export abstract class Zigbee2TasmotaAccessory {
this.statusUpdate(devObj);
}
}
} catch (err) {
} catch {
this.platform.log.error('SENSOR message parse error: %s', message);
}
}
Expand Down

0 comments on commit e137846

Please sign in to comment.