Skip to content

Commit

Permalink
chore: update @nodesecure/eslint-config (#378)
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreDemailly authored Jul 8, 2024
1 parent 2d18f17 commit b0afc0e
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 24 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

7 changes: 0 additions & 7 deletions .eslintrc

This file was deleted.

25 changes: 25 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -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
}
}
}];
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 4 additions & 6 deletions src/analysis/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
4 changes: 2 additions & 2 deletions src/reporting/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
{
Expand Down Expand Up @@ -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);
Expand Down
11 changes: 5 additions & 6 deletions src/utils/formatNpmPackages.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
);
}
2 changes: 1 addition & 1 deletion test/utils/cloneGITRepository.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down

0 comments on commit b0afc0e

Please sign in to comment.