# @secretlint/config-loader

> Config loader for secretlint.

Latest version **14.0.1** (published 2026-11-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @secretlint/config-loader
pnpm add @secretlint/config-loader
yarn add @secretlint/config-loader
bun add @secretlint/config-loader
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 14.0.1 |
| Published | 2026-11-16 |
| First published | 2020-02-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1470 |
| Author | azu |
| Maintainers | azu |
| Keywords | secretlint, node, config, loader |

## Links

- npm: https://www.npmjs.com/package/@secretlint/config-loader
- Repository: https://github.com/secretlint/secretlint
- Homepage: https://github.com/secretlint/secretlint/tree/master/packages/@secretlint/config-loader/
- Issues: https://github.com/secretlint/secretlint/issues
- npm.io page: https://npm.io/package/@secretlint/config-loader

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 14.0.1 (latest) — 2026-11-16
- 7.0.0-beta.68 (canary) — 2023-07-02
- 3.3.1-next.19 (next) — 2021-09-15
- 14.0.0 — 2026-11-15
- 13.1.0 — 2026-10-26
- 13.0.7 — 2026-10-03
- 13.0.6 — 2026-09-25
- 13.0.5 — 2026-08-27
- 13.0.4 — 2026-07-22
- 13.0.3 — 2026-07-21
- 13.0.2 — 2026-05-15
- 13.0.1 — 2026-05-15
- 13.0.0 — 2026-05-04
- 12.3.1 — 2026-04-26
- 12.3.0 — 2026-04-26
- … 110 more at https://npm.io/package/@secretlint/config-loader/versions

## README

# @secretlint/config-loader

Config loader for secretlint.

## Install

Install with [npm](https://www.npmjs.com/):

    npm install @secretlint/config-loader

## Usage

### API

`loadConfig(options)` returns a promise for an object containing:

- `ok`: `true` when loading succeeds.
- `configFilePath`: the path of the loaded config file.
- `configDescriptor`: the config file contents before rule modules are loaded.
- `config`: the validated config with loaded rule modules.

`loadConfigDescriptor(options)` returns a promise for `{ ok, configFilePath, configDescriptor }` without loading or validating rule modules.

Both functions accept `cwd` to choose the directory in which to search for a config file, or `configFilePath` to select a config file explicitly. See the exported `SecretLintConfigLoaderOptions`, `SecretLintConfigLoaderResult`, and `SecretLintConfigLoaderRawResult` types for the complete interfaces.

If the config file cannot be found or read, the promise rejects. `loadConfig` also rejects if the config is invalid or a rule module cannot be loaded. Handle these errors with `try`/`catch`.

### Example

Use an ES module (`.mjs`, or `.js` with `"type": "module"` in `package.json`):

```js
import { loadConfig } from "@secretlint/config-loader";

try {
    // Load a config file such as <CurrentDir>/.secretlintrc.json
    const { config, configFilePath } = await loadConfig({ cwd: process.cwd() });
    console.log("load from configFile:" + configFilePath);
    console.log("config", config);
} catch (error) {
    console.error(error);
}
```

## Terminology

- ConfigDescriptor: config file literal that is not loaded yet
- Config: loaded object

## Workflow

- Validate `ConfigDescriptor`
- Load `ConfigDescriptor` and create `Config` object - imports each rule modules
- Validate Loaded `Config` with `ConfigDescriptor`
    - Invalid option, Invalid allowMessageIds, Invalid id specify for a preset 
- If all validation is passed, get a Config.

## Changelog

See [Releases page](https://github.com/secretlint/secretlint/releases).

## Running tests

Install devDependencies and Run `npm test`:

    npm test

## Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, [please create an issue](https://github.com/secretlint/secretlint/issues).

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D

## Author

- [github/azu](https://github.com/azu)
- [twitter/azu_re](https://twitter.com/azu_re)

## License

MIT © azu

---
_Source: https://npm.io/package/@secretlint/config-loader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
