mirror of
https://github.com/ivuorinen/base-configs.git
synced 2026-01-26 03:03:59 +00:00
feat!: upgrade to eslint 9, update configs
BREAKING CHANGE: this changes the configuration format, also adds support for module, and commonjs types
This commit is contained in:
34
packages/eslint-config/scripts/postinstall.cjs
Normal file
34
packages/eslint-config/scripts/postinstall.cjs
Normal file
@@ -0,0 +1,34 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
// noinspection NpmUsedModulesInstalled
|
||||
const process = require('process')
|
||||
const checkConfig = require('@ivuorinen/config-checker')
|
||||
const foundConfig = checkConfig('eslint')
|
||||
|
||||
if (foundConfig.length > 0) {
|
||||
console.log('eslint-config: Found existing eslint config file, skipping creation.')
|
||||
console.log('eslint-config: If you want to create a new config file, please remove the existing one.')
|
||||
console.log(`eslint-config: Found config files at: ${foundConfig.join(', ')}`)
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
const filePath = path.join(process.env.INIT_CWD, 'eslint.config.mjs')
|
||||
const fileConfig = `import ivuorinenConfig from '@ivuorinen/eslint-config';
|
||||
|
||||
export default [
|
||||
...ivuorinenConfig,
|
||||
|
||||
// your modifications
|
||||
{
|
||||
rules: {
|
||||
// "no-unused-vars": "warn"
|
||||
}
|
||||
}
|
||||
];
|
||||
`
|
||||
|
||||
if (!fs.existsSync(filePath)) {
|
||||
fs.writeFileSync(filePath, fileConfig)
|
||||
}
|
||||
Reference in New Issue
Block a user