Skip to content

Commit

Permalink
updated linter
Browse files Browse the repository at this point in the history
  • Loading branch information
dangowans committed Oct 25, 2024
1 parent 383de12 commit 1242903
Show file tree
Hide file tree
Showing 14 changed files with 6,969 additions and 1,278 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

10 changes: 0 additions & 10 deletions .eslintrc.json

This file was deleted.

7 changes: 0 additions & 7 deletions .prettierrc.json

This file was deleted.

2 changes: 2 additions & 0 deletions eslint.config.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export declare const config: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
export default config;
15 changes: 15 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import cityssmConfig, { cspellWords } from 'eslint-config-cityssm';
import tseslint from 'typescript-eslint';
export const config = tseslint.config(...cityssmConfig, {
rules: {
'@cspell/spellchecker': [
'warn',
{
cspell: {
words: [...cspellWords, 'oids', 'snmp']
}
}
]
}
});
export default config;
17 changes: 17 additions & 0 deletions eslint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import cityssmConfig, { cspellWords } from 'eslint-config-cityssm'
import tseslint from 'typescript-eslint'

export const config = tseslint.config(...cityssmConfig, {
rules: {
'@cspell/spellchecker': [
'warn',
{
cspell: {
words: [...cspellWords, 'oids', 'snmp']
}
}
]
}
})

export default config
6 changes: 2 additions & 4 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// eslint-disable-next-line eslint-comments/disable-enable-pair
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable security/detect-object-injection */

import snmp from 'net-snmp'

// eslint-disable-next-line n/no-unpublished-import
import config from './config.js'
import { getOidName } from './oidNames.js'
import { outputToCSV, outputToConsole } from './output.js'
Expand Down Expand Up @@ -42,7 +41,6 @@ for (const ip of config.ips) {
console.error(snmp.varbindError(varbind))
} else {
const value = varbind.value
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
results[ip][getOidName(varbind.oid)] =
typeof value === 'number' ? value : value.toString()
}
Expand All @@ -53,7 +51,7 @@ for (const ip of config.ips) {
})
}

// eslint-disable-next-line no-unmodified-loop-condition
// eslint-disable-next-line sonarjs/no-infinite-loop, no-unmodified-loop-condition
while (outstandingCount > 0) {
console.log(`Waiting for ${outstandingCount} servers to respond...`)
await new Promise((resolve) => setTimeout(resolve, 2000))
Expand Down
4 changes: 2 additions & 2 deletions output.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'node:fs';
import papaparse from 'papaparse';
const resultsToArray = (results) => {
function resultsToArray(results) {
const array = [];
for (const [ip, oids] of Object.entries(results)) {
const ipResults = {
Expand All @@ -12,7 +12,7 @@ const resultsToArray = (results) => {
array.push(ipResults);
}
return array;
};
}
export function outputToConsole(results) {
console.log(`Data collected: ${new Date().toLocaleString()}`);
console.table(results);
Expand Down
2 changes: 1 addition & 1 deletion output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import papaparse from 'papaparse'

import type { Results } from './types.js'

const resultsToArray = (results: Results): Array<Record<string, string>> => {
function resultsToArray(results: Results): Array<Record<string, string>> {
const array: Array<Record<string, string>> = []

for (const [ip, oids] of Object.entries(results)) {
Expand Down
Loading

0 comments on commit 1242903

Please sign in to comment.