mirror of
https://github.com/ivuorinen/base-configs.git
synced 2026-01-26 03:03:59 +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.
25 lines
942 B
JavaScript
25 lines
942 B
JavaScript
'use strict'
|
|
|
|
/* eslint no-console: "off", n/no-process-exit: "off", no-undefined: "off" -- CLI app that gives users feedback */
|
|
|
|
const fs = require('node:fs')
|
|
const path = require('node:path')
|
|
// noinspection NpmUsedModulesInstalled
|
|
const process = require('node:process')
|
|
const checkConfig = require('@ivuorinen/config-checker')
|
|
const foundConfig = checkConfig('prettier')
|
|
|
|
if (foundConfig.length > 0) {
|
|
console.log('prettier-config: Found existing prettier config file, skipping creation.')
|
|
console.log('prettier-config: If you want to create a new config file, please remove the existing one.')
|
|
console.log(`prettier-config: Found config files at: ${foundConfig.join(', ')}`)
|
|
process.exit(0)
|
|
}
|
|
|
|
const filePath = path.join(process.env.INIT_CWD, '.prettierrc.json')
|
|
const fileConfigObject = '@ivuorinen/prettier-config'
|
|
|
|
if (!fs.existsSync(filePath)) {
|
|
fs.writeFileSync(filePath, JSON.stringify(fileConfigObject, undefined, 2))
|
|
}
|