mirror of
https://github.com/ivuorinen/base-configs.git
synced 2026-02-24 00:51:23 +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:
@@ -2,6 +2,7 @@
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
// noinspection NpmUsedModulesInstalled
|
||||
const process = require('process')
|
||||
const checkConfig = require('@ivuorinen/config-checker')
|
||||
const foundConfig = checkConfig('eslint')
|
||||
@@ -13,11 +14,21 @@ if (foundConfig.length > 0) {
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
const filePath = path.join(process.env.INIT_CWD, '.eslintrc.json')
|
||||
const fileConfigObject = {
|
||||
extends: ['@ivuorinen']
|
||||
}
|
||||
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, JSON.stringify(fileConfigObject, undefined, 2))
|
||||
fs.writeFileSync(filePath, fileConfig)
|
||||
}
|
||||
Reference in New Issue
Block a user