Files
base-configs/packages/eslint-config/scripts/postinstall.cjs
Ismo Vuorinen 6d6f4582dd feat!: ESLint 9 Fixes (#307)
* 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.
2024-11-25 03:35:13 +02:00

36 lines
989 B
JavaScript

'use strict'
/* eslint no-console: "off", n/no-process-exit: "off" -- CLI app that gives users feedback */
const fs = require('node:fs')
const path = require('node:path')
const process = require('node: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)
}