secretlint / secretlint

Pluggable linting tool to prevent committing credential.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JS Config File

SStranks opened this issue · comments

The documentation says that the .secretlintrc can be of type {json,yml,js}, but I'm having trouble implementing a configuration of type .js in my project. I can't see or find any examples where a .js configuration has actually been implemented anywhere.

Package manager: PNPM v8
Node: v20
Type: "module".

In the documentation it states that secretlint is ESM, but if I create a .secretlintrc.js file I get warnings about 'export' being an unexpected token when trying to execute the file.

image

It works using the old 'module.exports' syntax, but not the ESM syntax. Could you please provide a working template example or highlight where I might be going wrong? Thanks.

Looking at 'rc-config-loader' I found this post on their repo:
rc-config-loader Issue: Support ESM

"rc-config-loader treat JS as CommonJS." - azu

commented

Currently, ESM is not available in the settings file.

Basically, I recommend using JSON format.