Commit
·
3317833
1
Parent(s):
bed675d
Add Prettier and ESLint configuration files
Browse files- .prettierignore +7 -0
- .prettierrc +8 -0
- eslint.config.mjs +113 -0
.prettierignore
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
**/build
|
| 2 |
+
**/.eslintrc.cjs
|
| 3 |
+
.yarn/*
|
| 4 |
+
.pnp*
|
| 5 |
+
eslint.config.mjs
|
| 6 |
+
.husky
|
| 7 |
+
node_modules
|
.prettierrc
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"printWidth": 100,
|
| 3 |
+
"arrowParens": "always",
|
| 4 |
+
"bracketSpacing": true,
|
| 5 |
+
"tabWidth": 2,
|
| 6 |
+
"trailingComma": "es5",
|
| 7 |
+
"semi": true
|
| 8 |
+
}
|
eslint.config.mjs
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import js from '@eslint/js'
|
| 2 |
+
import prettier from "eslint-config-prettier";
|
| 3 |
+
import importPlugin from "eslint-plugin-import";
|
| 4 |
+
import prettierPlugin from "eslint-plugin-prettier";
|
| 5 |
+
import reactHooks from 'eslint-plugin-react-hooks'
|
| 6 |
+
import reactRefresh from 'eslint-plugin-react-refresh'
|
| 7 |
+
import globals from 'globals'
|
| 8 |
+
import tseslint from 'typescript-eslint'
|
| 9 |
+
export default [
|
| 10 |
+
{
|
| 11 |
+
ignores: [
|
| 12 |
+
"dist",
|
| 13 |
+
"node_modules",
|
| 14 |
+
".yarn",
|
| 15 |
+
"eslint.config.*",
|
| 16 |
+
"tailwind.config.*",
|
| 17 |
+
"dist",
|
| 18 |
+
".husky",
|
| 19 |
+
".vscode",
|
| 20 |
+
"postcss.config.js",
|
| 21 |
+
".husky",
|
| 22 |
+
".prettierrc"
|
| 23 |
+
],
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
files: ["**/*.{ts,tsx}"],
|
| 27 |
+
},
|
| 28 |
+
{languageOptions: {
|
| 29 |
+
ecmaVersion: 2020,
|
| 30 |
+
globals: globals.browser,
|
| 31 |
+
}},
|
| 32 |
+
js.configs.recommended,
|
| 33 |
+
...tseslint.configs.recommended,
|
| 34 |
+
{
|
| 35 |
+
plugins: {
|
| 36 |
+
"@typescript-eslint": tseslint.plugin,
|
| 37 |
+
"react-hooks": reactHooks,
|
| 38 |
+
"react-refresh": reactRefresh,
|
| 39 |
+
prettier: prettierPlugin,
|
| 40 |
+
import: importPlugin,
|
| 41 |
+
},
|
| 42 |
+
rules: {
|
| 43 |
+
...reactHooks.configs.recommended.rules,
|
| 44 |
+
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }],
|
| 45 |
+
"prettier/prettier": "error",
|
| 46 |
+
"@typescript-eslint/no-unused-vars": [
|
| 47 |
+
"error",
|
| 48 |
+
{
|
| 49 |
+
args: "all", // Enforce all unused parameters
|
| 50 |
+
argsIgnorePattern: "^_", // Allow unused params prefixed with an underscore (common convention)
|
| 51 |
+
},
|
| 52 |
+
],
|
| 53 |
+
"import/order": [
|
| 54 |
+
"error",
|
| 55 |
+
{
|
| 56 |
+
"newlines-between": "always",
|
| 57 |
+
"pathGroups": [
|
| 58 |
+
{
|
| 59 |
+
"pattern": "react",
|
| 60 |
+
"group": "builtin",
|
| 61 |
+
"position": "before"
|
| 62 |
+
},
|
| 63 |
+
{
|
| 64 |
+
"pattern": "@/**",
|
| 65 |
+
"group": "internal",
|
| 66 |
+
"position": "after"
|
| 67 |
+
}
|
| 68 |
+
],
|
| 69 |
+
|
| 70 |
+
"alphabetize": {
|
| 71 |
+
"order": "asc",
|
| 72 |
+
"caseInsensitive": true
|
| 73 |
+
},
|
| 74 |
+
"groups": [
|
| 75 |
+
["builtin", "external"],
|
| 76 |
+
"internal",
|
| 77 |
+
["parent", "sibling"],
|
| 78 |
+
"index",
|
| 79 |
+
"object",
|
| 80 |
+
"type"
|
| 81 |
+
],
|
| 82 |
+
|
| 83 |
+
"warnOnUnassignedImports": false
|
| 84 |
+
}
|
| 85 |
+
],
|
| 86 |
+
"import/newline-after-import": ["error", { count: 1, considerComments: true }],
|
| 87 |
+
"import/no-cycle": ["error", { ignoreExternal: true }],
|
| 88 |
+
// Error Prevention
|
| 89 |
+
"no-console": "warn",
|
| 90 |
+
"no-debugger": "warn",
|
| 91 |
+
"no-duplicate-imports": "error",
|
| 92 |
+
"no-var": "error",
|
| 93 |
+
// Best Practices
|
| 94 |
+
"prefer-const": "error",
|
| 95 |
+
"no-else-return": "error",
|
| 96 |
+
"eqeqeq": ["error", "always"],
|
| 97 |
+
// Modern JavaScript
|
| 98 |
+
"prefer-template": "error",
|
| 99 |
+
"prefer-destructuring": ["error", {
|
| 100 |
+
array: true,
|
| 101 |
+
object: true,
|
| 102 |
+
}],
|
| 103 |
+
"object-shorthand": "error",
|
| 104 |
+
"import/no-absolute-path": "error",
|
| 105 |
+
},
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
// disable type-aware linting on JS files
|
| 109 |
+
files: ["**/*.js"],
|
| 110 |
+
...tseslint.configs.disableTypeChecked,
|
| 111 |
+
},
|
| 112 |
+
prettier
|
| 113 |
+
];
|