diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 6b5123e..0000000 --- a/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -/public/lib \ No newline at end of file diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index cc12cba..0000000 --- a/.eslintrc +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "@nodesecure/eslint-config", - "parserOptions": { - "sourceType": "module", - "requireConfigFile": false - } -} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..be7128f --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,25 @@ +// Import Node.js Dependencies +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +// Import Third-party Dependencies +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +const compat = new FlatCompat({ + baseDirectory: __dirname +}); + +export default [{ + ignores: ["**/node_modules/", "**/tmp/", "**/dist/", "**/coverage/", "**/fixtures/", "**/public/lib"] +}, ...compat.extends("@nodesecure/eslint-config"), { + languageOptions: { + sourceType: "module", + + parserOptions: { + requireConfigFile: false + } + } +}]; diff --git a/package.json b/package.json index a450620..336627a 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "zup": "0.0.2" }, "devDependencies": { - "@nodesecure/eslint-config": "^1.9.0", + "@nodesecure/eslint-config": "2.0.0-beta.0", "@types/node": "^20.14.10", "c8": "^10.1.2", "eslint": "^9.6.0", diff --git a/src/analysis/fetch.js b/src/analysis/fetch.js index f062f27..2f0b5ec 100644 --- a/src/analysis/fetch.js +++ b/src/analysis/fetch.js @@ -64,12 +64,10 @@ async function fetchRepositoriesStats(repositories, organizationUrl) { }, async(spinner) => { const repos = await Promise.all( - repositories.map((repositoryName) => { - return utils.cloneGITRepository( - path.join(CONSTANTS.DIRS.CLONES, repositoryName), - `${organizationUrl}/${repositoryName}.git` - ); - }) + repositories.map((repositoryName) => utils.cloneGITRepository( + path.join(CONSTANTS.DIRS.CLONES, repositoryName), + `${organizationUrl}/${repositoryName}.git` + )) ); spinner.text = "Fetching repositories metadata on the NPM Registry"; diff --git a/src/reporting/html.js b/src/reporting/html.js index b0531ea..5460af2 100644 --- a/src/reporting/html.js +++ b/src/reporting/html.js @@ -64,7 +64,7 @@ export async function HTML( spinner.text = "Building view with zup"; const charts = config.charts - .flatMap(({ display, name, help = null }) => display ? [{ name, help }] : []); + .flatMap(({ display, name, help = null }) => (display ? [{ name, help }] : [])); const HTMLReport = new HTMLTemplateGenerator( { @@ -105,7 +105,7 @@ export async function buildFrontAssets( path.join(CONSTANTS.DIRS.PUBLIC, "css", "style.css"), path.join(CONSTANTS.DIRS.PUBLIC, "css", "themes", `${theme}.css`) ], - outdir, + outdir }); const imagesFiles = await fs.readdir(kImagesDir); diff --git a/src/utils/formatNpmPackages.js b/src/utils/formatNpmPackages.js index 1385b76..4814f28 100644 --- a/src/utils/formatNpmPackages.js +++ b/src/utils/formatNpmPackages.js @@ -12,10 +12,9 @@ export function formatNpmPackages( return packages; } - return packages.map((pkg) => { - // in case the user has already added the organization prefix - return pkg.startsWith(organizationPrefix) ? - pkg : - `${organizationPrefix}/${pkg}`; - }); + // in case the user has already added the organization prefix + return packages.map((pkg) => (pkg.startsWith(organizationPrefix) ? + pkg : + `${organizationPrefix}/${pkg}`) + ); } diff --git a/test/utils/cloneGITRepository.spec.js b/test/utils/cloneGITRepository.spec.js index 543851e..7935c1e 100644 --- a/test/utils/cloneGITRepository.spec.js +++ b/test/utils/cloneGITRepository.spec.js @@ -22,7 +22,7 @@ describe("cloneGITRepository", () => { assert.strictEqual(dir, dest); const files = (await fs.readdir(dest, { withFileTypes: true })) - .flatMap((dirent) => dirent.isFile() ? [dirent.name] : []); + .flatMap((dirent) => (dirent.isFile() ? [dirent.name] : [])); assert.ok(files.includes("CODE_OF_CONDUCT.md")); assert.ok(files.includes("README.md"));