diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 000000000..fc12c18c2 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,90 @@ +{ + "extends": [ + "eslint:recommended", + "plugin:react/recommended", + "plugin:prettier/recommended" + ], + "plugins": [ + "react", + "import-helpers", + "prettier" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "project": [ + "./tsconfig.node.json", + "./tsconfig.json" + ], + "extraFileExtensions:": [ + ".mdx" + ], + "extensions:": [ + ".mdx" + ] + }, + "env": { + "browser": true, + "es2021": true + }, + "settings": { + "react": { + "version": "detect" + } + }, + "rules": { + "no-console": "warn", + "no-self-assign": "warn", + "no-self-compare": "warn", + "complexity": [ + "error", + { + "max": 15 + } + ], + "indent": [ + "error", + 2, + { + "SwitchCase": 1 + } + ], + "no-dupe-keys": "error", + "no-invalid-regexp": "error", + "no-undef": "error", + "no-return-assign": "error", + "no-redeclare": "error", + "no-empty": "error", + "no-await-in-loop": "error", + "react/react-in-jsx-scope": 0, + "node/exports-style": [ + "error", + "module.exports" + ], + "node/file-extension-in-import": [ + "error", + "always" + ], + "node/prefer-global/buffer": [ + "error", + "always" + ], + "node/prefer-global/console": [ + "error", + "always" + ], + "node/prefer-global/process": [ + "error", + "always" + ], + "node/prefer-global/url-search-params": [ + "error", + "always" + ], + "node/prefer-global/url": [ + "error", + "always" + ], + "node/prefer-promises/dns": "error", + "node/prefer-promises/fs": "error" + } +} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5668a32e4..60505515a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,12 +6,29 @@ repos: - id: eslint files: \.[jt]sx?$ # *.js, *.jsx, *.ts and *.tsx types: [file] + args: ["--fix", "--no-warn-ignored"] additional_dependencies: + - eslint@9.1.1 - eslint-plugin-prettier - eslint-config-prettier - prettier - eslint-plugin-react@latest - - typescript-eslint + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.1.0 + hooks: + - id: check-case-conflict + - id: end-of-file-fixer + - id: mixed-line-ending + args: + - --fix=lf + - id: trailing-whitespace + - id: pretty-format-json + exclude: ^tsconfig.*.json + args: + - --autofix + - --indent=4 + - --no-sort-keys + - id: check-merge-conflict - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. rev: v0.4.2 diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 000000000..e69de29bb