Skip to content

Commit

Permalink
Add steiger linting tool to satisfy FSD
Browse files Browse the repository at this point in the history
  • Loading branch information
pijng committed Jul 26, 2024
1 parent ceca0ff commit 5e8e7de
Show file tree
Hide file tree
Showing 65 changed files with 1,013 additions and 159 deletions.
953 changes: 900 additions & 53 deletions web/package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"watch": "npx parcel ./src/index.html",
"lint": "eslint --ignore-path .gitignore .",
"lint:fix": "npm run lint -- --fix",
"steiger": "npx steiger ./src",
"tsc": "tsc --noEmit"
},
"devDependencies": {
Expand All @@ -20,6 +21,7 @@
"postcss": "^8.4.28",
"prettier": "^3.0.2",
"process": "^0.11.10",
"steiger": "^0.4.0",
"tailwind-scrollbar": "^3.1.0",
"tailwindcss": "^3.3.3",
"typescript": "^5.1.6"
Expand Down
8 changes: 7 additions & 1 deletion web/src/app/chains/auth.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { forbiddenRoute, homeRoute, loginRoute, notFoundRoute, registerAdminRoute } from "@/shared/routing";
import { $isAuthorized, createInitialAdmin, notAllowedTriggered, notFoundTriggered, unauthorizedTriggered } from "@/shared/auth";
import {
$isAuthorized,
createInitialAdmin,
notAllowedTriggered,
notFoundTriggered,
unauthorizedTriggered,
} from "@/shared/session";
import { redirect } from "atomic-router";
import { sample } from "effector";

Expand Down
2 changes: 1 addition & 1 deletion web/src/app/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import "./chains";
import { userModel } from "@/entities/user";
import { notFoundTriggered, obtainSession } from "@/shared/auth";
import { notFoundTriggered, obtainSession } from "@/shared/session";
import { Link, history, router } from "@/shared/routing";
import { sidebarClosed } from "@/shared/ui";
import { linkRouter, onAppMount } from "atomic-router-forest";
Expand Down
2 changes: 1 addition & 1 deletion web/src/entities/api-token/model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ApiToken, getApiToken, getApiTokens } from "@/shared/api/api-tokens";
import { ApiToken, getApiToken, getApiTokens } from "@/shared/api";
import { createEffect, createStore } from "effector";

const getApiTokensFx = createEffect(() => {
Expand Down
4 changes: 2 additions & 2 deletions web/src/entities/log/model.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Log, getLogs } from "@/shared/api";
import { Level, LogsGroup, getLogGroup } from "@/shared/api/logs";
import { Level, LogsGroup, getLogGroup } from "@/shared/api";
import { DATEFORMAT_OPTIONS, objectToQueryString, queryStringToObject } from "@/shared/lib";
import { $preferredLanguage } from "@/shared/lib/i18n/locale";
import { $preferredLanguage } from "@/shared/lib";
import { combine, createEffect, createEvent, createStore, sample } from "effector";

const reset = createEffect();
Expand Down
4 changes: 2 additions & 2 deletions web/src/entities/user/model.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { User, getUsers, getUser } from "@/shared/api";
import { setCurrentAccount } from "@/shared/auth";
import { setLanguage } from "@/shared/lib/i18n";
import { setCurrentAccount } from "@/shared/session";
import { setLanguage } from "@/shared/lib";
import { createEffect, createEvent, createStore, sample } from "effector";

const LOCALE_KEY = "locale";
Expand Down
2 changes: 1 addition & 1 deletion web/src/features/action-create/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { h, list, remap, spec } from "forest";
import { $creationError, events, actionForm } from "./model";
import { combine, createEvent, createStore, sample } from "effector";
import { intersection, trigger } from "@/shared/lib";
import { i18n } from "@/shared/lib/i18n";
import { i18n } from "@/shared/lib";
import { schemaModel } from "@/entities/schema";
import { ActionToCreate, Condition } from "@/shared/api";

Expand Down
3 changes: 1 addition & 2 deletions web/src/features/action-edit/model.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { actionsRoute } from "@/shared/routing";
import { ActionToCreate, ActionToUpdate, Condition, deleteAction, editAction } from "@/shared/api";
import { rules } from "@/shared/lib";
import { rules, i18n } from "@/shared/lib";
import { attach, createEffect, createEvent, createStore, sample } from "effector";
import { createForm } from "effector-forms";
import { actionModel } from "@/entities/action";
import { i18n } from "@/shared/lib/i18n";
import { redirect } from "atomic-router";

const addCondition = createEvent<Condition>();
Expand Down
3 changes: 1 addition & 2 deletions web/src/features/action-edit/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { Button, ErrorHint, Input, Label, Multiselect, PlusIcon, Select, Text, T
import { h, list, remap, spec } from "forest";
import { $editError, events, actionForm, deleteActionClicked } from "./model";
import { combine, createEvent, createStore, sample } from "effector";
import { intersection, trigger } from "@/shared/lib";
import { i18n } from "@/shared/lib/i18n";
import { intersection, trigger, i18n } from "@/shared/lib";
import { ActionToCreate, Condition } from "@/shared/api";
import { schemaModel } from "@/entities/schema";

Expand Down
2 changes: 1 addition & 1 deletion web/src/features/api-token-create/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Button, ErrorHint, Input } from "@/shared/ui";
import { h, spec } from "forest";
import { $creationError, $freshToken, apiTokenForm } from "./model";
import { createEvent } from "effector";
import { i18n } from "@/shared/lib/i18n";
import { i18n } from "@/shared/lib";

export const NewApiTokenForm = () => {
h("form", () => {
Expand Down
3 changes: 1 addition & 2 deletions web/src/features/api-token-edit/model.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { apiTokenModel } from "@/entities/api-token";
import { apiTokensRoute } from "@/shared/routing";
import { ApiTokenToUpdate, deleteApiToken, editApiToken } from "@/shared/api";
import { rules } from "@/shared/lib";
import { i18n } from "@/shared/lib/i18n";
import { rules, i18n } from "@/shared/lib";
import { redirect } from "atomic-router";
import { attach, createEffect, createEvent, createStore, sample } from "effector";
import { createForm } from "effector-forms";
Expand Down
2 changes: 1 addition & 1 deletion web/src/features/api-token-edit/ui.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Button, ErrorHint, Input } from "@/shared/ui";
import { h, spec } from "forest";
import { $editError, apiTokenForm, deleteApiTokenClicked } from "./model";
import { i18n } from "@/shared/lib/i18n";
import { i18n } from "@/shared/lib";

export const EditApiTokenForm = () => {
h("form", () => {
Expand Down
2 changes: 1 addition & 1 deletion web/src/features/auth/model.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { userModel } from "@/entities/user";
import { homeRoute } from "@/shared/routing";
import { postSession } from "@/shared/api";
import { getSessionFx, tokenReceived } from "@/shared/auth";
import { getSessionFx, tokenReceived } from "@/shared/session";
import { rules } from "@/shared/lib";
import { createEffect, createEvent, createStore, sample } from "effector";
import { createForm } from "effector-forms";
Expand Down
2 changes: 1 addition & 1 deletion web/src/features/auth/ui.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Button, ErrorHint, Input } from "@/shared/ui";
import { $authError, authForm } from "./model";
import { h, spec } from "forest";
import { i18n } from "@/shared/lib/i18n";
import { i18n } from "@/shared/lib";

export const Auth = () => {
h("div", () => {
Expand Down
2 changes: 1 addition & 1 deletion web/src/features/filter-date-logs/ui.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { i18n } from "@/shared/lib/i18n";
import { i18n } from "@/shared/lib";
import { Button, ButtonVariant, ClockIcon, DownIcon, Input } from "@/shared/ui";
import { Event, Store, createEvent, createStore, sample } from "effector";
import { DOMElement, h, node, spec } from "forest";
Expand Down
5 changes: 2 additions & 3 deletions web/src/features/filter-level-logs/ui.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Level } from "@/shared/api";
import { i18n } from "@/shared/lib/i18n";
import { Button, ButtonVariant, DownIcon } from "@/shared/ui";
import { FireIcon } from "@/shared/ui/icons";
import { i18n } from "@/shared/lib";
import { Button, ButtonVariant, DownIcon, FireIcon } from "@/shared/ui";
import { Event, Store, combine, createEvent, createStore, sample } from "effector";
import { DOMElement, h, list, node, spec } from "forest";

Expand Down
5 changes: 2 additions & 3 deletions web/src/features/filter-logs/ui.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Button, ButtonVariant, DownIcon, Dropdown } from "@/shared/ui";
import { Button, ButtonVariant, DownIcon, Dropdown, FilterIcon } from "@/shared/ui";
import { Event, Store, createEvent, createStore, sample } from "effector";
import { DOMElement, h, node, spec } from "forest";
import { FilterIcon } from "@/shared/ui";
import { i18n } from "@/shared/lib/i18n";
import { i18n } from "@/shared/lib";

export type FilterItem = {
name: string;
Expand Down
14 changes: 0 additions & 14 deletions web/src/features/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion web/src/features/register-admin/ui.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Button, ErrorHint, Input } from "@/shared/ui";
import { $registrationError, registerAdminForm } from "./model";
import { h, spec } from "forest";
import { i18n } from "@/shared/lib/i18n";
import { i18n } from "@/shared/lib";

export const RegisterAdmin = () => {
h("div", () => {
Expand Down
3 changes: 1 addition & 2 deletions web/src/features/schema-create/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import { Button, ErrorHint, Input, Label, PlusIcon, Select, TrashIcon } from "@/
import { h, list, spec } from "forest";
import { $creationError, events, schemaForm } from "./model";
import { createEvent, sample } from "effector";
import { trigger } from "@/shared/lib";
import { trigger, i18n } from "@/shared/lib";
import { tagModel } from "@/entities/tag";
import { i18n } from "@/shared/lib/i18n";

export const NewSchemaForm = () => {
h("form", () => {
Expand Down
3 changes: 1 addition & 2 deletions web/src/features/schema-edit/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { schemaModel } from "@/entities/schema";
import { tagModel } from "@/entities/tag";
import { homeRoute } from "@/shared/routing";
import { SchemaField, SchemaKind, SchemaToUpdate, deleteSchema, editSchema } from "@/shared/api";
import { rules } from "@/shared/lib";
import { i18n } from "@/shared/lib/i18n";
import { rules, i18n } from "@/shared/lib";
import { redirect } from "atomic-router";
import { attach, createEffect, createEvent, createStore, sample } from "effector";
import { createForm } from "effector-forms";
Expand Down
3 changes: 1 addition & 2 deletions web/src/features/schema-edit/ui.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Button, ErrorHint, Input, Label, PlusIcon, Select, TrashIcon } from "@/shared/ui";
import { h, list, spec } from "forest";
import { $editError, deleteSchemaClicked, events, schemaForm } from "./model";
import { trigger } from "@/shared/lib";
import { trigger, i18n } from "@/shared/lib";
import { createEvent, sample } from "effector";
import { tagModel } from "@/entities/tag";
import { i18n } from "@/shared/lib/i18n";

export const EditSchemaForm = () => {
h("form", () => {
Expand Down
2 changes: 1 addition & 1 deletion web/src/features/tag-create/ui.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Button, ErrorHint, Input } from "@/shared/ui";
import { h } from "forest";
import { $creationError, tagForm } from "./model";
import { i18n } from "@/shared/lib/i18n";
import { i18n } from "@/shared/lib";

export const NewTagForm = () => {
h("form", () => {
Expand Down
3 changes: 1 addition & 2 deletions web/src/features/tag-edit/model.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { tagModel } from "@/entities/tag";
import { tagsRoute } from "@/shared/routing";
import { TagToUpdate, deleteTag, editTag } from "@/shared/api";
import { rules } from "@/shared/lib";
import { i18n } from "@/shared/lib/i18n";
import { rules, i18n } from "@/shared/lib";
import { redirect } from "atomic-router";
import { attach, createEffect, createEvent, createStore, sample } from "effector";
import { createForm } from "effector-forms";
Expand Down
2 changes: 1 addition & 1 deletion web/src/features/tag-edit/ui.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Button, ErrorHint, Input } from "@/shared/ui";
import { h, spec } from "forest";
import { $editError, tagForm, deleteTagClicked } from "./model";
import { i18n } from "@/shared/lib/i18n";
import { i18n } from "@/shared/lib";

export const EditTagForm = () => {
h("form", () => {
Expand Down
4 changes: 2 additions & 2 deletions web/src/features/user-create/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { Button, ErrorHint, Input, Multiselect, Select } from "@/shared/ui";
import { h, spec } from "forest";
import { $creationError, events, memberForm } from "./model";
import { createStore } from "effector";
import { UserRole } from "@/shared/api/users";
import { UserRole } from "@/shared/api";
import { tagModel } from "@/entities/tag";
import { i18n } from "@/shared/lib/i18n";
import { i18n } from "@/shared/lib";

export const NewMemberForm = () => {
h("form", () => {
Expand Down
5 changes: 2 additions & 3 deletions web/src/features/user-edit/model.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { userModel } from "@/entities/user";
import { membersRoute } from "@/shared/routing";
import { UserToUpdate, editUser } from "@/shared/api";
import { deleteUser } from "@/shared/api/users";
import { rules } from "@/shared/lib";
import { i18n } from "@/shared/lib/i18n";
import { deleteUser } from "@/shared/api";
import { rules, i18n } from "@/shared/lib";
import { redirect } from "atomic-router";
import { attach, createEffect, createEvent, createStore, sample } from "effector";
import { createForm } from "effector-forms";
Expand Down
4 changes: 2 additions & 2 deletions web/src/features/user-edit/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { Button, ErrorHint, Input, Multiselect, Select } from "@/shared/ui";
import { h, spec } from "forest";
import { $editError, deleteUserClicked, events, memberForm } from "./model";
import { createStore } from "effector";
import { UserRole } from "@/shared/api/users";
import { UserRole } from "@/shared/api";
import { tagModel } from "@/entities/tag";
import { i18n } from "@/shared/lib/i18n";
import { i18n } from "@/shared/lib";

export const EditMemberForm = () => {
h("form", () => {
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/action-create/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { h, spec } from "forest";

import { actionCreateRoute } from "@/shared/routing";
import { Header } from "@/shared/ui";
import { NewActionForm } from "@/features";
import { NewActionForm } from "@/features/action-create";
import { i18n } from "@/shared/lib/i18n";

export const ActionCreatePage = () => {
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/action-edit/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { h, spec } from "forest";

import { actionEditRoute } from "@/shared/routing";
import { Header } from "@/shared/ui";
import { EditActionForm } from "@/features";
import { EditActionForm } from "@/features/action-edit";
import { i18n } from "@/shared/lib/i18n";

export const ActionEditPage = () => {
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/actions-list/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { withRoute } from "atomic-router-forest";
import { h, spec } from "forest";

import { actionCreateRoute, actionsRoute } from "@/shared/routing";
import { HeaderWithCreation } from "@/widgets";
import { HeaderWithCreation } from "@/widgets/header-with-creation";
import { i18n } from "@/shared/lib/i18n";
import { ActionsList } from "@/widgets/actions-list";

Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/api-token-create/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { h, spec } from "forest";

import { apiTokenCreateRoute } from "@/shared/routing";
import { Header } from "@/shared/ui";
import { NewApiTokenForm } from "@/features";
import { NewApiTokenForm } from "@/features/api-token-create";
import { i18n } from "@/shared/lib/i18n";

export const ApiTokenCreatePage = () => {
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/api-token-edit/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { h, spec } from "forest";

import { apiTokenEditRoute } from "@/shared/routing";
import { Header } from "@/shared/ui";
import { EditApiTokenForm } from "@/features";
import { EditApiTokenForm } from "@/features/api-token-edit";
import { i18n } from "@/shared/lib/i18n";

export const ApiTokenEditPage = () => {
Expand Down
4 changes: 2 additions & 2 deletions web/src/pages/api-tokens-list/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { withRoute } from "atomic-router-forest";
import { h, spec } from "forest";

import { apiTokenCreateRoute, apiTokensRoute } from "@/shared/routing";
import { HeaderWithCreation } from "@/widgets";
import { ApiTokensList } from "@/widgets";
import { HeaderWithCreation } from "@/widgets/header-with-creation";
import { ApiTokensList } from "@/widgets/api-tokens-list";
import { i18n } from "@/shared/lib/i18n";

export const ApiTokensListPage = () => {
Expand Down
3 changes: 2 additions & 1 deletion web/src/pages/home/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { h } from "forest";
import { withRoute } from "atomic-router-forest";

import { homeRoute, schemaCreateRoute } from "@/shared/routing";
import { HeaderWithCreation, SchemasList } from "@/widgets";
import { HeaderWithCreation } from "@/widgets/header-with-creation";
import { SchemasList } from "@/widgets/schemas-list";
import { i18n } from "@/shared/lib/i18n";

export const HomePage = () => {
Expand Down
4 changes: 3 additions & 1 deletion web/src/pages/log/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import { h, spec } from "forest";
import { logModel } from "@/entities/log";
import { router, showLogRoute } from "@/shared/routing";
import { Spinner } from "@/shared/ui";
import { GroupActionsList, LogsCard, SchemaHeader } from "@/widgets";
import { GroupActionsList } from "@/widgets/group-actions-list";
import { SchemaHeader } from "@/widgets/schema-header";
import { LogsCard } from "@/widgets/logs-card";
import { schemaModel } from "@/entities/schema";
import { combine } from "effector";

Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/login/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { h, spec } from "forest";
import { withRoute } from "atomic-router-forest";

import { loginRoute } from "@/shared/routing";
import { AuthForm } from "@/widgets";
import { AuthForm } from "@/widgets/auth-form";

export const LoginPage = () => {
h("div", {
Expand Down
5 changes: 4 additions & 1 deletion web/src/pages/logs-list/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import { withRoute } from "atomic-router-forest";
import { h, spec } from "forest";

import { logsRoute } from "@/shared/routing";
import { LogsFilter, LogsList, SchemaHeader, SearchBar } from "@/widgets";
import { LogsFilter } from "@/widgets/logs-filter";
import { LogsList } from "@/widgets/logs-list";
import { SchemaHeader } from "@/widgets/schema-header";
import { SearchBar } from "@/widgets/search-bar";
import { Pagination, Spinner } from "@/shared/ui";
import { logModel } from "@/entities/log";

Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/profile/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { withRoute } from "atomic-router-forest";

import { profileRoute } from "@/shared/routing";
import { Header } from "@/shared/ui";
import { UserProfile } from "@/widgets";
import { UserProfile } from "@/widgets/user-profile";
import { i18n } from "@/shared/lib/i18n";

export const ProfilePage = () => {
Expand Down
Loading

0 comments on commit 5e8e7de

Please sign in to comment.