Skip to content

Commit

Permalink
(simatec) Code Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
simatec committed Dec 3, 2024
1 parent f8a7815 commit bcd1357
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 57 deletions.
1 change: 0 additions & 1 deletion docs/oAuthService.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const CLIENT_SECRET = process.env.CLIENT_SECRET; // Google oAuth2 APP client sec
const REDIRECT_URL = ['urn:ietf:wg:oauth:2.0:oob'];
const SCOPES = ['https://www.googleapis.com/auth/drive.file'];

// @ts-ignore
const oAuth2Client = new OAuth2Client(CLIENT_ID, CLIENT_SECRET, REDIRECT_URL);

exports.handler = async (event) => {
Expand Down
10 changes: 5 additions & 5 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@ export default [
// as this improves maintainability. jsdoc warnings will not block buiuld process.
rules: {
'jsdoc/require-jsdoc': 'off',
'jsdoc/require-param': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-require-imports': 'off',
'no-async-promise-executor': 'off',
'prettier/prettier': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'no-prototype-builtins': 'off',
'curly': 'off',
'jsdoc/require-returns-description': 'off',
'no-else-return': 'off',
'jsdoc/no-types': 'off',
'no-case-declarations': 'off',
'jsdoc/tag-lines': 'off',
'no-useless-escape': 'off',
//'jsdoc/require-param': 'off',
//'@typescript-eslint/ban-ts-comment': 'off',
//'@typescript-eslint/no-require-imports': 'off',
//'jsdoc/no-types': 'off',
//'jsdoc/tag-lines': 'off',
},
},
];
2 changes: 0 additions & 2 deletions lib/dropboxLib.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ class dropbox {
log.error(); (`sessionAppend error: ${JSON.stringify(err)}`);
reject(err);
}
// @ts-ignore
resolve();
});
});
Expand Down Expand Up @@ -249,7 +248,6 @@ class dropbox {
reject(err);
}
});
// @ts-ignore
resolve();
});
}
Expand Down
1 change: 0 additions & 1 deletion lib/execute.js
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,6 @@ function executeScripts(adapter, config, callback, scripts, code) {
callback && callback();
}

// @ts-ignore
if (typeof module !== 'undefined' && module.parent) {
module.exports = executeScripts;
}
5 changes: 0 additions & 5 deletions lib/googleDriveLib.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class GoogleDrive {
}

_authorize() {
// @ts-ignore
if (this.oAuth2Client.credentials.access_token && Date.now() > this.oAuth2Client.credentials.expiry_date) {
let url = OAUTH_URL;
if (!this.newToken) {
Expand Down Expand Up @@ -57,7 +56,6 @@ class GoogleDrive {

_getDrive() {
this.drive = this.drive || new google.drive_v3.Drive({
// @ts-ignore
version: 'v3',
auth: this.oAuth2Client,
});
Expand Down Expand Up @@ -303,7 +301,6 @@ class GoogleDrive {
return reject(err);
}
res.data
// @ts-ignore
.on('end', () => resolve())
.on('error', err => reject(err))
.pipe(dest);
Expand All @@ -315,11 +312,9 @@ class GoogleDrive {
}
}

// @ts-ignore
if (module.parent) {
module.exports = GoogleDrive;
} else {
// @ts-ignore
const token = require('./test');
const gDrive = new GoogleDrive(token);

Expand Down
5 changes: 0 additions & 5 deletions lib/list/onedrive.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,13 @@ async function list(restoreSource, options, types, log, callback) {
dir = dir.substring(1);
}

// @ts-ignore
oneDriveAPI.items
.getMetadata({
accessToken: od_accessToken,
itemId: `${dir !== 'root' ? `root:/${dir}` : dir}`,
})
.then((res) => {
if (res && res.id) {
// @ts-ignore
oneDriveAPI.items
.listChildren({
accessToken: od_accessToken,
Expand Down Expand Up @@ -120,15 +118,13 @@ async function getFile(options, fileName, toStoreName, log, callback) {
dir = dir.substring(1);
}

// @ts-ignore
oneDriveAPI.items
.getMetadata({
accessToken: od_accessToken,
itemId: `${dir !== 'root' ? `root:/${dir}` : dir}`,
})
.then((res) => {
if (res && res.id) {
// @ts-ignore
oneDriveAPI.items
.listChildren({
accessToken: od_accessToken,
Expand All @@ -152,7 +148,6 @@ async function getFile(options, fileName, toStoreName, log, callback) {
callback && callback(result);
});

// @ts-ignore
const promise = oneDriveAPI.items.download({
accessToken: od_accessToken,
itemId: result[0].id,
Expand Down
4 changes: 0 additions & 4 deletions lib/list/webdav.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,15 @@ async function list(restoreSource, options, types, log, callback) {
}

try {
// @ts-ignore
client
.getDirectoryContents(dir)
.then(contents => {
if (contents) {
// @ts-ignore
contents = contents.map(file => {
return { path: file.filename, name: file.filename.replace(/\\/g, '/').split('/').pop(), size: file.size }
}).filter(file => (types.indexOf(file.name.split('_')[0]) !== -1 || types.indexOf(file.name.split('.')[0]) !== -1) && file.name.split('.').pop() == 'gz');

const files = {};
// @ts-ignore
contents.forEach(file => {
const type = file.name.split('_')[0];
files[type] = files[type] || [];
Expand Down Expand Up @@ -138,7 +135,6 @@ async function getFile(options, fileName, toStoreName, log, callback) {
log.debug(`WebDAV: Download of "${fileName}" finish`);
callback && callback();
});
// @ts-ignore
client
.createReadStream(fileName)
.pipe(writeStream);
Expand Down
1 change: 0 additions & 1 deletion lib/scripts/42-javascripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ let timerLog;

async function sleep(ms) {
return new Promise(async (resolve) => {
// @ts-ignore
timerLog = setTimeout(async () => resolve(), ms);
});
}
Expand Down
4 changes: 0 additions & 4 deletions lib/scripts/55-onedrive.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ function copyFiles(od_accessToken, dir, fileNames, log, errors, callback) {
err && log.error(`readStream Onedrive: ${err}`);
});

// @ts-ignore
oneDriveAPI.items
.uploadSession({
accessToken: od_accessToken,
Expand Down Expand Up @@ -64,7 +63,6 @@ function deleteFiles(od_accessToken, fileIds, fileNames, log, errors, callback)

log.debug(`Onedrive: delete ${fileName} with Id: ${fileId}`);

// @ts-ignore
oneDriveAPI.items
.delete({
accessToken: od_accessToken,
Expand All @@ -85,15 +83,13 @@ function cleanFiles(od_accessToken, options, dir, names, num, log, errors, callb
return callback && callback();
}

// @ts-ignore
oneDriveAPI.items
.getMetadata({
accessToken: od_accessToken,
itemId: `${dir !== 'root' ? `root:/${dir}` : dir}`,
})
.then((res) => {
if (res && res.id) {
// @ts-ignore
oneDriveAPI.items
.listChildren({
accessToken: od_accessToken,
Expand Down
4 changes: 0 additions & 4 deletions lib/scripts/65-webdav.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ async function copyFiles(client, dir, fileNames, log, errors, callback) {
contentLength: fileContent.length,
})
.then(() => {
// @ts-ignore
fileContent = null;
setImmediate(copyFiles, client, dir, fileNames, log, errors, callback);
});
Expand Down Expand Up @@ -137,9 +136,7 @@ async function command(options, log, callback) {
callback && callback();
}
try {
// @ts-ignore
if (await client.exists(dir) === false) {
// @ts-ignore
await client.createDirectory(dir);
}
} catch (e) {
Expand All @@ -149,7 +146,6 @@ async function command(options, log, callback) {
}

try {
// @ts-ignore
client
.getDirectoryContents(dir)
.then(contents => {
Expand Down
1 change: 0 additions & 1 deletion lib/scripts/78-clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ function command(options, log, callback) {
log.warn('No older backup files are deleted, because this backup was started manually');
}

// @ts-ignore
cleanFiles(dir, options, options.context.types, options.deleteBackupAfter, log, options.context.errors, err => {
if (err) {
log.error(err);
Expand Down
2 changes: 1 addition & 1 deletion lib/tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function copyFile(source, target, cb) {
/**
* looks for iobroker home folder
*
* @returns {string}
* @returns
*/
function getIobDir() {
const utils = require('@iobroker/adapter-core');
Expand Down
Loading

0 comments on commit bcd1357

Please sign in to comment.