diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 00000000..58d5657e --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,59 @@ +module.exports = { + root: true, + env: { + browser: true, + es2021: true, + node: true, + }, + extends: [ + "eslint:recommended", + "plugin:react/recommended", + "plugin:react/jsx-runtime", + "plugin:@typescript-eslint/recommended", + "prettier", + ], + parser: "@typescript-eslint/parser", + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + ecmaVersion: "latest", + sourceType: "module", + }, + plugins: ["react", "@typescript-eslint", "prettier"], + settings: { + react: { + version: "detect", + }, + }, + rules: { + "prettier/prettier": "error", + "react/react-in-jsx-scope": "off", + "react/prop-types": "off", + "react/no-unknown-property": "off", + "react/display-name": "off", + "@typescript-eslint/no-unused-vars": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-var-requires": "off", + "@typescript-eslint/no-require-imports": "off", + "@typescript-eslint/ban-ts-comment": "off", + "@typescript-eslint/no-empty-object-type": "off", + "no-console": "off", + "no-undef": "off", + "no-useless-escape": "off", + "no-prototype-builtins": "off", + "no-constant-condition": "off", + "no-misleading-character-class": "off", + "react/no-unescaped-entities": "off", + }, + ignorePatterns: [ + "node_modules/", + "build/", + ".docusaurus/", + ".cache-loader/", + "tmp/", + "static/", + "*.config.js", + "babel.config.js", + ], +}; diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..9904b049 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,17 @@ +# Documentation +docs/**/*.md +docs/**/*.mdx +blog/**/*.md +blog/**/*.mdx +*.md +*.mdx + +# Build outputs +node_modules/ +build/ +.docusaurus/ +.cache-loader/ +tmp/ + +# Package files +package-lock.json diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..ad37b825 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,6 @@ +{ + "singleQuote": false, + "semi": true, + "tabWidth": 2, + "printWidth": 80 +} diff --git a/package.json b/package.json index ac0ba67e..a8b1fe0f 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,11 @@ "serve": "docusaurus serve", "write-translations": "docusaurus write-translations", "write-heading-ids": "docusaurus write-heading-ids", - "typecheck": "tsc" + "typecheck": "tsc", + "lint": "eslint . --ext .ts,.tsx,.js,.jsx", + "lint:fix": "eslint . --ext .ts,.tsx,.js,.jsx --fix", + "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css}\"", + "format:check": "prettier --check ." }, "dependencies": { "@docusaurus/core": "^3.9.1", @@ -65,8 +69,15 @@ "@types/canvas-confetti": "^1.9.0", "@types/react": "^19.1.9", "@types/react-dom": "^19.1.7", + "@typescript-eslint/eslint-plugin": "^8.45.0", + "@typescript-eslint/parser": "^8.45.0", "autoprefixer": "^10.4.21", + "eslint": "^8.57.1", + "eslint-config-prettier": "^10.1.8", + "eslint-plugin-prettier": "^5.5.4", + "eslint-plugin-react": "^7.37.5", "postcss": "^8.5.3", + "prettier": "^3.6.2", "tailwindcss": "^4.1.4", "typescript": "~5.3" },