{
    "$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
    "root": true,
    "files": {
        "includes": [
            "**",
            // git
            "!.git/**/*",
            // mac
            "!**/__MACOSX/**/*",
            "!**/.DS_Store",
            // module
            "!**/node_modules/**/*",
            // build
            "!**/.panda/**/*",
            "!**/.next/**/*",
            "!**/.expo/**/*",
            "!**/.vercel/**/*",
            "!**/dist/**/*",
            "!build/**/*",
            "!app/build/**/*",
            "!web/build/**/*",
            "!out/**/*",
            "!app/out/**/*",
            "!web/out/**/*",
            // lock
            "!package-lock.json",
            "!yarn.lock",
            "!pnpm-lock.yaml",
            "!bun.lock"
        ],
        "ignoreUnknown": true,
        "maxSize": 1048576 // 1MiB
    },
    "vcs": {
        "enabled": true,
        "clientKind": "git",
        "useIgnoreFile": true,
        "root": ".",
        "defaultBranch": "main"
    },
    "linter": {
        "enabled": true,
        "includes": [
            "**"
        ],
        "rules": {
            "recommended": true,
            "correctness": {
                // return void 0
                "noVoidTypeReturn": "off"
            },
            "security": {
                // dangerouslySetInnerHTML={{ __html: '' }}
                "noDangerouslySetInnerHtml": "off"
            },
            "style": {
                // let a: number = 0;
                "noInferrableTypes": "off"
            },
            "suspicious": {
                // let a: any;
                "noExplicitAny": "off"
            }
        }
    },
    "formatter": {
        "enabled": true,
        "includes": [
            "**"
        ],
        "formatWithErrors": false,
        "indentStyle": "space",
        "indentWidth": 4,
        "lineEnding": "lf",
        "lineWidth": 80,
        "attributePosition": "multiline",
        "bracketSameLine": false,
        "bracketSpacing": true,
        "expand": "always",
        "useEditorconfig": false
    },
    "assist": {
        "actions": {
            "source": {
                // JS import sort
                "organizeImports": {
                    "level": "on",
                    "options": {
                        "groups": [
                            // stnadard types
                            {
                                "type": true,
                                "source": ":BUN:"
                            },
                            {
                                "type": true,
                                "source": ":NODE:"
                            },
                            ":BLANK_LINE:",
                            // external types
                            {
                                "type": true,
                                "source": ":URL:"
                            },
                            {
                                "type": true,
                                "source": ":PACKAGE_WITH_PROTOCOL:"
                            },
                            {
                                "type": true,
                                "source": ":PACKAGE:"
                            },
                            ":BLANK_LINE:",
                            // local types
                            {
                                "type": true,
                                "source": ":ALIAS:"
                            },
                            {
                                "type": true,
                                "source": ":PATH:"
                            },
                            ":BLANK_LINE:",
                            // standard
                            {
                                "type": false,
                                "source": ":BUN:"
                            },
                            {
                                "type": false,
                                "source": ":NODE:"
                            },
                            ":BLANK_LINE:",
                            // external
                            {
                                "type": false,
                                "source": ":URL:"
                            },
                            {
                                "type": false,
                                "source": ":PACKAGE_WITH_PROTOCOL:"
                            },
                            {
                                "type": false,
                                "source": ":PACKAGE:"
                            },
                            ":BLANK_LINE:",
                            // local
                            {
                                "type": false,
                                "source": ":ALIAS:"
                            },
                            {
                                "type": false,
                                "source": ":PATH:"
                            }
                        ]
                    }
                },
                // JSX sort in natural order
                "useSortedAttributes": "off",
                // JSON sort in natural order
                "useSortedKeys": "off",
                // CSS sort
                "useSortedProperties": "on"
            }
        }
    },
    // JavaScript/TypeScript
    "javascript": {
        "parser": {
            "unsafeParameterDecoratorsEnabled": true,
            "jsxEverywhere": false
        },
        "formatter": {
            "quoteStyle": "double",
            "jsxQuoteStyle": "double",
            "quoteProperties": "asNeeded",
            "trailingCommas": "all",
            "semicolons": "always",
            "arrowParentheses": "always",
            "enabled": true,
            "indentStyle": "space",
            "indentWidth": 4,
            "lineEnding": "lf",
            "lineWidth": 80,
            "attributePosition": "multiline",
            "bracketSameLine": false,
            "bracketSpacing": true,
            "expand": "always"
        },
        "jsxRuntime": "transparent",
        "linter": {
            "enabled": true
        },
        "assist": {
            "enabled": true
        }
    },
    // JSON
    "json": {
        "parser": {
            "allowComments": false,
            "allowTrailingCommas": false
        },
        "formatter": {
            "enabled": true,
            "indentStyle": "space",
            "indentWidth": 4,
            "lineEnding": "lf",
            "lineWidth": 80,
            "trailingCommas": "none",
            "bracketSpacing": true,
            "expand": "always"
        },
        "linter": {
            "enabled": true
        },
        "assist": {
            "enabled": true
        }
    },
    // CSS
    "css": {
        "parser": {
            "cssModules": true
        },
        "formatter": {
            "enabled": true,
            "indentStyle": "space",
            "indentWidth": 4,
            "lineEnding": "lf",
            "lineWidth": 80,
            "quoteStyle": "double"
        },
        "linter": {
            "enabled": true
        },
        "assist": {
            "enabled": true
        }
    },
    // GraphQL
    "graphql": {
        "formatter": {
            "enabled": true,
            "indentStyle": "space",
            "indentWidth": 4,
            "lineEnding": "lf",
            "lineWidth": 80,
            "quoteStyle": "double",
            "bracketSpacing": true
        },
        "linter": {
            "enabled": true
        },
        "assist": {
            "enabled": true
        }
    },
    "overrides": [
        // tsconfig.json
        {
            "includes": [
                "**/tsconfig.*.json",
                "**/tsconfig.json"
            ],
            "json": {
                "parser": {
                    "allowComments": true,
                    "allowTrailingCommas": true
                },
                "formatter": {
                    "enabled": true,
                    "indentStyle": "space",
                    "indentWidth": 4,
                    "lineEnding": "lf",
                    "lineWidth": 80,
                    "trailingCommas": "none",
                    "bracketSpacing": true,
                    "expand": "always"
                },
                "linter": {
                    "enabled": true
                },
                "assist": {
                    "enabled": true
                }
            }
        }
    ]
}
