Add prettier and husky to insure format before commit (#1)

This commit is contained in:
Yukko
2025-06-03 22:27:49 +08:00
committed by GitHub
parent 4130090fd7
commit 7994ecc100
7 changed files with 265 additions and 26 deletions

View File

@@ -1,45 +1,51 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import js from "@eslint/js";
import globals from "globals";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import tseslint from "typescript-eslint";
import eslintConfigPrettier from "eslint-config-prettier";
import eslintPluginPrettier from "eslint-plugin-prettier";
export default tseslint.config(
{ ignores: ['dist'] },
{ ignores: ["dist"] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
...tseslint.configs.recommended,
eslintConfigPrettier,
],
files: ["**/*.{ts,tsx}"],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
prettier: eslintPluginPrettier,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
'@typescript-eslint/no-unused-vars': [
'off',
"@typescript-eslint/no-unused-vars": [
"off",
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],
'@typescript-eslint/no-explicit-any': [
'off',
"@typescript-eslint/no-explicit-any": [
"off",
{
ignoreRestArgs: true,
},
],
'@typescript-eslint/ban-ts-comment': [
'off'
]
"@typescript-eslint/ban-ts-comment": ["off"],
"prettier/prettier": "error",
},
},
)
);