Skip to content

Commit

Permalink
fix: set eslint-plugin-unicorn ourself when enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
DrJume committed Jun 28, 2024
1 parent e27992d commit 0de6b53
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 34 deletions.
5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
"rimraf": "^5.0.7",
"typescript": "^5.4.5"
},
"pnpm": {
"overrides": {
"eslint-plugin-unicorn": "^54.0.0"
}
},
"changelogithub": {
"extends": "gh:falcondev-it/configs/changelogithub"
}
Expand Down
53 changes: 29 additions & 24 deletions packages/eslint-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,32 +49,37 @@ export function eslintConfig({ nuxt = false, tsconfigPath, unicorn = false, conf
})
.prepend(github)
.append(nuxt ? nuxtRules : [])
.override('antfu/unicorn/rules', (config) => {
if (unicorn) delete config.plugins
return config
})
.insertBefore('antfu/unicorn/rules', unicorn && eslintPluginUnicorn.configs['flat/recommended'])
.append(
(async () => {
if (!unicorn) return

/** @type import('eslint').Linter.FlatConfig */
const unicornConfig = eslintPluginUnicorn.configs['flat/recommended']
delete unicornConfig.plugins

return unicornConfig
})(),
)
.append({
name: 'falcondev/unicorn/rules',
rules: {
'unicorn/filename-case': [
'error',
{
cases: {
kebabCase: true,
pascalCase: true,
},
ignore: [/^README\./],
unicorn && [
{
name: 'falcondev/unicorn/rules',
rules: {
'unicorn/filename-case': [
'error',
{
cases: {
kebabCase: true,
pascalCase: true,
},
ignore: [/^README\./],
},
],
},
],
},
})
},
{
name: 'falcondev/unicorn/ignore',
files: ['.github/**/*'],
rules: {
'unicorn/filename-case': 'off',
},
},
],
)
.append({
name: 'falcondev/rules',
rules: {
Expand Down
35 changes: 30 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0de6b53

Please sign in to comment.