mirror of
https://github.com/ivuorinen/base-configs.git
synced 2026-01-26 11:14:00 +00:00
* chore: update postinstall scripts * chore(lint): eslint automated fixes * feat!: drop standard, sonarjs to work with eslint9 - This config allows arrow functions. BREAKING CHANGES: - Switches to eslint-config-eslint from eslint-config-standard. - Also drops eslint-plugins-sonarjs because it doesn't work well with eslint9, and wants eslint8 and related plugins. - Switches from eslint-plugin-prettier to eslint-config-prettier.
36 lines
977 B
JavaScript
36 lines
977 B
JavaScript
const path = require('node:path')
|
|
|
|
/**
|
|
* Returns an array of configuration paths.
|
|
* @param {string} moduleName The name of the module to check for.
|
|
* @returns {string[]} - The paths to the configuration files.
|
|
*/
|
|
const configurationPaths = moduleName => {
|
|
const filesPlain = [
|
|
moduleName,
|
|
`${moduleName}rc`,
|
|
`${moduleName}rc.json`,
|
|
`${moduleName}rc.yaml`,
|
|
`${moduleName}rc.yml`,
|
|
`${moduleName}rc.js`,
|
|
`${moduleName}rc.ts`,
|
|
`${moduleName}rc.mjs`,
|
|
`${moduleName}rc.cjs`,
|
|
`${moduleName}.jsonc`,
|
|
`${moduleName}.yaml`,
|
|
`${moduleName}.json`,
|
|
`${moduleName}.config.js`,
|
|
`${moduleName}.config.ts`,
|
|
`${moduleName}.config.mjs`,
|
|
`${moduleName}.config.cjs`
|
|
]
|
|
|
|
const filesDot = filesPlain.map(file => `.${file}`)
|
|
const bothFiles = filesPlain.concat(filesDot)
|
|
const filesInConfig = bothFiles.map(file => path.join('.config', file))
|
|
|
|
return bothFiles.concat(filesInConfig)
|
|
}
|
|
|
|
module.exports = configurationPaths
|