From 29da1ceace69ff782e165edf21d65d9412dbe76b Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Wed, 1 May 2024 16:57:32 +0300 Subject: [PATCH] Linter rules update --- .eslintrc.json | 25 +++++++++++++++++++++-- src/App.tsx | 8 ++++---- src/components/InputElements.tsx | 24 +++++++++++----------- src/components/PageControls.tsx | 4 ++-- src/components/PageElements.tsx | 22 ++++++++++----------- src/components/Sidebar.tsx | 8 ++++---- src/components/Table.tsx | 2 +- src/components/TitledPage.tsx | 12 +++++------ src/components/UserControls.tsx | 8 ++++---- src/pages/Login.tsx | 34 ++++++++++++++++---------------- src/pages/Recover.tsx | 4 ++-- src/pages/Register.tsx | 16 +++++++-------- src/pages/admin/Admin.tsx | 10 +++++----- src/pages/admin/Flags.tsx | 14 ++++++------- src/pages/admin/Users.tsx | 20 +++++++++---------- src/pages/home/Applications.tsx | 14 ++++++------- src/pages/home/Home.tsx | 6 +++--- src/pages/home/Profile.tsx | 11 ++++++----- src/util/ClickDetector.tsx | 6 +++--- src/util/ErrorBoundary.tsx | 8 ++++---- src/util/Util.ts | 2 +- src/views/PermissionsView.tsx | 8 ++++---- src/views/RateLimitsView.tsx | 8 ++++---- 23 files changed, 148 insertions(+), 126 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index f4f0fe9..1e40eb7 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -15,7 +15,8 @@ "jsx": true }, "ecmaVersion": 12, - "sourceType": "module" + "sourceType": "module", + "project": "./tsconfig.json" }, "plugins": [ "react", @@ -31,11 +32,18 @@ "allman" ], "indent": ["warn", 4, { - "SwitchCase": 1 + "SwitchCase": 1, + "VariableDeclarator": "first", + "FunctionDeclaration": {"parameters": "first"}, + "CallExpression": {"arguments": "first"}, + "ArrayExpression": "first", + "ObjectExpression": "first", + "ImportDeclaration": "first" }], "no-warning-comments": [1, { "terms": ["todo", "fixme"] }], + "no-multi-spaces": ["warn", {"ignoreEOLComments": true, "exceptions": {"ImportDeclaration": true}}], "prefer-arrow-callback": "warn", "prefer-const": "warn", "prefer-destructuring": "warn", @@ -77,7 +85,20 @@ "no-console": "warn", "no-constant-binary-expression": "error", "no-trailing-spaces": "warn", + "no-tabs": "error", "quotes": ["error" , "single"], + "jsx-quotes": [ + "error", + "prefer-single" + ], + "key-spacing": [ + "warn", + { + "beforeColon": false, + "afterColon": true, + "align": "value" + } + ], "guard-for-in": "warn", "yoda": [ "warn", diff --git a/src/App.tsx b/src/App.tsx index 164fe84..f77a9ac 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -77,13 +77,13 @@ const App = () => const menuItems: SidebarMenuItem[] = [ { - to: '/home', label: 'Home', items: [ + to: '/home', label: 'Home', items: [ { to: '/profile', label: 'Profile', relative: true }, { to: '/applications', label: 'Applications', relative: true, permission: [ 'applications:*', 1 ] } ] }, { - to: '/admin', label: 'Admin', permission: [ 'administrator:*', 1 ], items: [ + to: '/admin', label: 'Admin', permission: [ 'administrator:*', 1 ], items: [ { to: '/users', label: 'Users', relative: true, permission: [ 'administrator:users:*', 1 ] }, { to: '/roles', label: 'Roles', relative: true, permission: [ 'administrator:roles:*', 1 ] }, { to: '/flags', label: 'Flags', relative: true, permission: [ 'administrator:flags:*', 1 ] }, @@ -101,7 +101,7 @@ const App = () => {user ?
-
+
{/* */}
@@ -153,7 +153,7 @@ const App = () =>
-

Made with by Navy.gif  |  Front-end magic by D3vision

+

Made with by Navy.gif  |  Front-end magic by D3vision

diff --git a/src/components/InputElements.tsx b/src/components/InputElements.tsx index 5da8c5b..40aff8c 100644 --- a/src/components/InputElements.tsx +++ b/src/components/InputElements.tsx @@ -25,11 +25,11 @@ export const FileSelector = ({ file, cb, types = '' }: { types?: string, file: F cb(file); }; - return