From 2920e6959385ea788f9c40b9a72cb724bf295ee1 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 2 May 2024 19:27:40 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20(.pre-commit-config.yaml):=20Add?= =?UTF-8?q?=20eslint@9.1.1=20as=20a=20dependency=20and=20enable=20autofix?= =?UTF-8?q?=20for=20pretty-format-json=20hook=20=F0=9F=94=A7=20(.eslintrc.?= =?UTF-8?q?json):=20Update=20eslint=20configuration=20to=20include=20addit?= =?UTF-8?q?ional=20plugins,=20parser,=20parserOptions,=20and=20env=20setti?= =?UTF-8?q?ngs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.json | 90 +++++++++++++++++++++++++++++++++++++++++ .pre-commit-config.yaml | 19 ++++++++- eslint.config.js | 0 3 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 .eslintrc.json create mode 100644 eslint.config.js 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