Skip to content

Commit

Permalink
push eslint to 9
Browse files Browse the repository at this point in the history
  • Loading branch information
PLCHome committed Aug 16, 2024
1 parent 9bf4963 commit 5fbd1f9
Show file tree
Hide file tree
Showing 6 changed files with 477 additions and 1,440 deletions.
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

21 changes: 0 additions & 21 deletions .eslintrc.js

This file was deleted.

46 changes: 46 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import globals from "globals";
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: ["**/admin", "**/test", "lib/env/tools.js", "**/gulpfile.js", "eslint.config.mjs"],
}, ...compat.extends("eslint:recommended", "plugin:prettier/recommended"), {
languageOptions: {
globals: {
...globals.browser,
...globals.node,
...globals.mocha,
},

ecmaVersion: 2018,
sourceType: "module",

parserOptions: {
ecmaFeatures: {
impliedStrict: true,
},
},
},

rules: {
"no-use-before-define": ["error", {
functions: false,
}],

"no-continue": "off",

"no-param-reassign": ["error", {
props: false,
}],
},
}];
12 changes: 6 additions & 6 deletions growattMain.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ const getJSONCircularReplacer = () => {
function decrypt(key, value) {
let result = '';
for (let i = 0; i < value.length; i += 1) {
/* eslint-disable-next-line no-bitwise */
result += String.fromCharCode(key[i % key.length].charCodeAt(0) ^ value.charCodeAt(i));
}
return result;
Expand Down Expand Up @@ -168,6 +167,7 @@ class Growatt extends utils.Adapter {
this.setStateAsync('info.connection', { val: false, ack: true });

callback();
// eslint-disable-next-line no-unused-vars
} catch (e) {
callback();
}
Expand Down Expand Up @@ -257,7 +257,7 @@ class Growatt extends utils.Adapter {
}

/**
*
*
loads the settings of the inverter and pastes the settings.
* @param {string} path to id
* @param {string} growattType
Expand Down Expand Up @@ -287,7 +287,7 @@ class Growatt extends utils.Adapter {
}

/**
*
*
writes the settings to the inverter.
* @param {string} path to id
* @param {string} growattType
Expand Down Expand Up @@ -353,7 +353,7 @@ class Growatt extends utils.Adapter {
}

/**
*
*
loads the settings of the inverter and pastes the settings.
* @param {object} plantData
*/
Expand Down Expand Up @@ -558,7 +558,7 @@ class Growatt extends utils.Adapter {
try {
if (typeof this.growatt === 'undefined') {
this.log.debug('Growatt new API');
/* eslint-disable-next-line no-new */

this.growatt = new API({
timeout: this.config.webTimeout * 1000,
lifeSignCallback: this.lifeSignCallback.bind(this),
Expand Down Expand Up @@ -907,6 +907,6 @@ if (module.parent) {
module.exports = options => new Growatt(options);
} else {
// otherwise start the instance directly
/* eslint-disable-next-line no-new */

new Growatt();
}
Loading

0 comments on commit 5fbd1f9

Please sign in to comment.