Skip to content

Commit

Permalink
build: pin eslint-plugin-unicorn to new version
Browse files Browse the repository at this point in the history
  • Loading branch information
DrJume committed Jun 28, 2024
1 parent adb1abc commit 1a16d09
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 65 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,15 @@ See [browserslist/browserslist](https://github.com/browserslist/browserslist) fo
**`prettier.config.js`:**

```js
import config from '@louishaftmann/prettier-config'
export default config
export { default } from '@louishaftmann/prettier-config'
```

### commitlint

**`commitlint.config.cjs`:**

<!-- eslint-disable unicorn/prefer-module -->

```js
module.exports = {
extends: ['@louishaftmann/commitlint-config'],
Expand Down
4 changes: 3 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import eslintConfig from '@louishaftmann/eslint-config'

export default eslintConfig()
export default eslintConfig({
unicorn: true,
})
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
"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
24 changes: 16 additions & 8 deletions packages/eslint-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,7 @@ delete eslintConfigPrettier.rules['vue/html-self-closing']
const compat = new FlatCompat()

/** @type {import('./index.d.ts').eslintConfig} */
export function eslintConfig(
{ nuxt, tsconfigPath, unicorn, configs } = {
nuxt: false,
tsconfigPath: undefined,
unicorn: false,
configs: undefined,
},
) {
export function eslintConfig({ nuxt = false, tsconfigPath, unicorn = false, configs }) {
return antfu({
stylistic: false,

Expand Down Expand Up @@ -67,6 +60,21 @@ export function eslintConfig(
return unicornConfig
})(),
)
.append({
name: 'falcondev/unicorn/rules',
rules: {
'unicorn/filename-case': [
'error',
{
cases: {
kebabCase: true,
pascalCase: true,
},
ignore: [/^README\./],
},
],
},
})
.append({
name: 'falcondev/rules',
rules: {
Expand Down
48 changes: 25 additions & 23 deletions packages/eslint-config/type-aware.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,32 @@ import vueESLintParser from 'vue-eslint-parser'
* @param tsconfigPath {string[]}
* @returns {import('eslint').Linter.FlatConfig[]} FlatConfig[]
*/
export default (tsconfigPath) => [
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
/** @type {any} */ parser: tsESLintParserForExtraFiles,
parserOptions: {
project: tsconfigPath,
// extraFileExtensions: ['.vue'],
export default function typeAwareConfig(tsconfigPath) {
return [
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
/** @type {any} */ parser: tsESLintParserForExtraFiles,
parserOptions: {
project: tsconfigPath,
// extraFileExtensions: ['.vue'],
},
},
},
},
{
files: ['**/*.vue'],
languageOptions: {
parser: vueESLintParser,
parserOptions: {
parser: tsESLintParserForExtraFiles,
// extraFileExtensions: ['.vue'],
// Or
// parser: {
// ts: tsESLintParserForExtraFiles
// }
project: tsconfigPath,
{
files: ['**/*.vue'],
languageOptions: {
parser: vueESLintParser,
parserOptions: {
parser: tsESLintParserForExtraFiles,
// extraFileExtensions: ['.vue'],
// Or
// parser: {
// ts: tsESLintParserForExtraFiles
// }
project: tsconfigPath,
},
},
},
},
]
]
}
2 changes: 1 addition & 1 deletion packages/lintstaged-config/index.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @param {string} [runInPackage] */
export default (runInPackage) => {
export default function lintstagedConfig(runInPackage) {
const pnpmExec = runInPackage ? `pnpm --filter ${runInPackage} exec ` : ''

return {
Expand Down
35 changes: 5 additions & 30 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 1a16d09

Please sign in to comment.