feat!: module & commonjs in stylelint

BREAKING CHANGE: support module, and commonjs types
This commit is contained in:
Ismo Vuorinen
2024-08-21 17:35:13 +03:00
parent ce9de621f6
commit e4aed31ef9
7 changed files with 28 additions and 9 deletions

View File

@@ -0,0 +1,24 @@
'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('stylelint')
if (foundConfig.length > 0) {
console.log('stylelint-config: Found existing stylelint config file, skipping creation.')
console.log('stylelint-config: If you want to create a new config file, please remove the existing one.')
console.log(`stylelint-config: Found config files at: ${foundConfig.join(', ')}`)
process.exit(0)
}
const filePath = path.join(process.env.INIT_CWD, '.stylelintrc.json')
const fileConfigObject = {
extends: ['@ivuorinen/stylelint-config/css']
}
if (!fs.existsSync(filePath)) {
fs.writeFileSync(filePath, JSON.stringify(fileConfigObject, undefined, 2))
}