Skip to content

Add support to .cjs (common) and .mjs (module) config file #2742

Closed
@gustavonobreza

Description

@gustavonobreza

Expected Behavior

If config file is commitlint.config.mjs or commitlint.config.cjs is expected that works

Current Behavior

Is ignored

Affected packages

  • load

Possible Solution

in commitlint/@commitlint/load/src/utils/load-config.ts at loadConfig:

// ...
	const moduleName = 'commitlint';
	const explorer = cosmiconfig(moduleName, {
		searchPlaces: [
			'package.json',
			`.${moduleName}rc`,
			`.${moduleName}rc.json`,
			`.${moduleName}rc.yaml`,
			`.${moduleName}rc.yml`,
			`.${moduleName}rc.ts`,
			`.${moduleName}rc.js`,
			`${moduleName}.config.ts`,
			`${moduleName}.config.js`,
                       // add it here
                       	`${moduleName}.config.cjs`,
			`${moduleName}.config.mjs`,
		],
		loaders: {
			'.ts': TypeScriptLoader,
		},
	};
// ...
```

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions