Skip to content

Commit

Permalink
imports
Browse files Browse the repository at this point in the history
  • Loading branch information
inker committed Jan 16, 2024
1 parent 11393c2 commit c0872c4
Show file tree
Hide file tree
Showing 87 changed files with 420 additions and 328 deletions.
15 changes: 14 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,19 @@ module.exports = {
],
'inker/react-ref-name': 2,

'import/extensions': [
2,
'ignorePackages',
{
js: 'never',
mjs: 'never',
ts: 'never',
jsx: 'never',
tsx: 'never',
vue: 'never',
},
],

'import/order': [
2,
{
Expand All @@ -146,7 +159,7 @@ module.exports = {
'sibling',
'index',
],
'newlines-between': 'always-and-inside-groups',
'newlines-between': 'always',
pathGroups: [
{
pattern: 'react',
Expand Down
99 changes: 99 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,22 @@
"type": "git",
"url": "git+https://github.com/inker/draw.git"
},
"imports": {
"#assets/*": "./src/assets/*",
"#data/*": "./src/data/*",
"#engine/*": "./src/engine/*",
"#model/*": "./src/model/*",
"#pages/*": "./src/pages/*",
"#routes/*": "./src/routes/*",
"#store/*": "./src/store/*",
"#ui/*": "./src/ui/*",
"#utils/*": "./src/utils/*"
},
"scripts": {
"prepare": "patch-package && husky install",
"pre-commit": "lint-staged --allow-empty",
"lint:js": "eslint --ext .ts,.tsx --max-warnings=0 src",
"lint:css": "stylelint './src/**/*.{ts,tsx}'",
"lint:js": "eslint --ext .ts,.tsx,.js,.jsx --max-warnings=0 src",
"lint:css": "stylelint './src/**/*.{ts,tsx,js,jsx,css,scss,postcss}'",
"lint": "run-p -c \"lint:css -- {1}\" \"lint:js -- {1}\" --",
"prettier": "prettier --cache --check .",
"check-types": "tsc --project tsconfig.json --noEmit",
Expand Down Expand Up @@ -95,6 +106,7 @@
"stylelint-config-standard": "^36.0.0",
"stylelint-order": "^6.0.3",
"terser-webpack-plugin": "^5.3.1",
"tsconfig-paths-webpack-plugin": "^4.1.0",
"typescript": "^5.0.4",
"webpack": "^5.76.0",
"webpack-bundle-analyzer": "^4.5.0",
Expand Down
4 changes: 2 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import styled, { ThemeProvider } from 'styled-components'
import { HashRouter } from 'react-router-dom'
import { constant } from 'lodash'

import usePopup from 'store/usePopup'
import useIsDarkMode from 'utils/hooks/useIsDarkMode'
import usePopup from '#store/usePopup'
import useIsDarkMode from '#utils/hooks/useIsDarkMode'

import * as themes from './themes'
import Body from './Body'
Expand Down
6 changes: 3 additions & 3 deletions src/Popup.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { type ReactNode, memo, useCallback } from 'react'

import usePopup from 'store/usePopup'
import Notification from 'ui/Notification'
import Dots from 'ui/Dots'
import Notification from '#ui/Notification'
import Dots from '#ui/Dots'
import usePopup from '#store/usePopup'

interface WrappedPopupProps {
children: ReactNode
Expand Down
2 changes: 1 addition & 1 deletion src/data/countries.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type Alpha2Code } from 'i18n-iso-countries'

import { type Confederation } from 'model/types'
import { type Confederation } from '#model/types'

type Flag = Lowercase<Alpha2Code> | `gb-${string}`

Expand Down
8 changes: 4 additions & 4 deletions src/engine/predicates/uefa/gs/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { sumBy } from 'lodash'

import type Team from 'model/team/GsTeam'
import { type Predicate } from 'engine/backtracking/gs'
import getSmallestArrayLength from 'utils/getSmallestArrayLength'
import getHalfArrayOfIndex from 'utils/getHalfArrayOfIndex'
import type Team from '#model/team/GsTeam'
import { type Predicate } from '#engine/backtracking/gs'
import getSmallestArrayLength from '#utils/getSmallestArrayLength'
import getHalfArrayOfIndex from '#utils/getHalfArrayOfIndex'

import incompatibleCountries from '../utils/incompatibleCountries'
import coldCountries from '../utils/coldCountries'
Expand Down
6 changes: 3 additions & 3 deletions src/engine/predicates/uefa/ko/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type Team from 'model/team/KnockoutTeam'
import { type Predicate } from 'engine/backtracking/gs'
import getSmallestArrayLength from 'utils/getSmallestArrayLength'
import type Team from '#model/team/KnockoutTeam'
import { type Predicate } from '#engine/backtracking/gs'
import getSmallestArrayLength from '#utils/getSmallestArrayLength'

import incompatibleCountries from '../utils/incompatibleCountries'

Expand Down
2 changes: 1 addition & 1 deletion src/engine/predicates/uefa/utils/coldCountries/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type UefaCountry } from 'model/types'
import { type UefaCountry } from '#model/types'

const coldCountries: UefaCountry[] = [
'Belarus',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { stubTrue } from 'lodash'

import type Tournament from 'model/Tournament'
import type Stage from 'model/Stage'
import { type Country, type OptionalPropertyOf } from 'model/types'

import isInsideInterval from 'utils/isInsideInterval'
import type Tournament from '#model/Tournament'
import type Stage from '#model/Stage'
import { type Country, type OptionalPropertyOf } from '#model/types'
import isInsideInterval from '#utils/isInsideInterval'

interface PartialItem {
countries: readonly [Country, Country]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { stubFalse } from 'lodash'

import { type UefaCountry } from 'model/types'
import { type UefaCountry } from '#model/types'

import makeGetConflictingCountries from './makeGetConflictingCountries'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type UefaCountry } from 'model/types'
import { type UefaCountry } from '#model/types'

import constraints from './constraints'

Expand Down
10 changes: 5 additions & 5 deletions src/engine/predicates/wc/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { countBy, identity, mapValues, sumBy } from 'lodash'

import { type Confederation } from 'model/types'
import type NationalTeam from 'model/team/NationalTeam'
import type UnknownNationalTeam from 'model/team/UnknownNationalTeam'
import { type Predicate } from 'engine/backtracking/gs'
import getSmallestArrayLength from 'utils/getSmallestArrayLength'
import { type Confederation } from '#model/types'
import type NationalTeam from '#model/team/NationalTeam'
import type UnknownNationalTeam from '#model/team/UnknownNationalTeam'
import { type Predicate } from '#engine/backtracking/gs'
import getSmallestArrayLength from '#utils/getSmallestArrayLength'

import getNumGroupsByYear from './getNumGroupsByYear'

Expand Down
5 changes: 2 additions & 3 deletions src/model/getPairings.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import defaultPairings from 'data/pairings.json'

import type Tournament from 'model/Tournament'
import defaultPairings from '#data/pairings.json'
import type Tournament from '#model/Tournament'

export default async (season: number, tournament: Tournament) => {
try {
Expand Down
2 changes: 1 addition & 1 deletion src/model/pairUpTeams.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fastDelete from 'fast-delete'

import type GsTeam from 'model/team/GsTeam'
import type GsTeam from '#model/team/GsTeam'

export default (
teams: readonly GsTeam[],
Expand Down
4 changes: 2 additions & 2 deletions src/model/parsePotsData/gs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import GsTeam from 'model/team/GsTeam'
import pairUpTeams from 'model/pairUpTeams'
import GsTeam from '#model/team/GsTeam'
import pairUpTeams from '#model/pairUpTeams'

const objectToGsTeam = (o: any) =>
new GsTeam(o.name, o.country, o.coeffient, o.name)
Expand Down
2 changes: 1 addition & 1 deletion src/model/parsePotsData/ko.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import KnockoutTeam from 'model/team/KnockoutTeam'
import KnockoutTeam from '#model/team/KnockoutTeam'

const objectToKoTeam = (o: any) =>
new KnockoutTeam(o.name, o.country, o.group, o.name)
Expand Down
7 changes: 3 additions & 4 deletions src/model/parsePotsData/wc.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { chunk } from 'lodash'

import countries from 'data/countries'

import NationalTeam from 'model/team/NationalTeam'
import UnknownNationalTeam from 'model/team/UnknownNationalTeam'
import countries from '#data/countries'
import NationalTeam from '#model/team/NationalTeam'
import UnknownNationalTeam from '#model/team/UnknownNationalTeam'

const countryNameToTeam = (host: boolean) => (c: string) => {
const ctr = countries[c as keyof typeof countries]
Expand Down
2 changes: 1 addition & 1 deletion src/model/team/Club.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type UefaCountry } from 'model/types'
import { type UefaCountry } from '#model/types'

import Team from '.'

Expand Down
2 changes: 1 addition & 1 deletion src/model/team/GsTeam.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type UefaCountry } from 'model/types'
import { type UefaCountry } from '#model/types'

import Club from './Club'

Expand Down
2 changes: 1 addition & 1 deletion src/model/team/KnockoutTeam.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type UefaCountry } from 'model/types'
import { type UefaCountry } from '#model/types'

import Club from './Club'

Expand Down
2 changes: 1 addition & 1 deletion src/model/team/NationalTeam.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Confederation } from 'model/types'
import { type Confederation } from '#model/types'

import Team from '.'

Expand Down
2 changes: 1 addition & 1 deletion src/model/team/UnknownNationalTeam.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type Confederation } from 'model/types'
import { type Confederation } from '#model/types'

import Team from '.'

Expand Down
2 changes: 1 addition & 1 deletion src/model/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type countries from 'data/countries'
import type countries from '#data/countries'

type Entry<T> = {
[P in keyof T]: [P, T[P]]
Expand Down
10 changes: 5 additions & 5 deletions src/pages/cl/gs/allPossibleGroupsWorker.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import memoizeOne from 'memoize-one'

import { allPossibleGroups } from 'engine/backtracking/gs'
import getPredicate from 'engine/predicates/uefa/gs'
import type Team from 'model/team/GsTeam'
import { allPossibleGroups } from '#engine/backtracking/gs'
import getPredicate from '#engine/predicates/uefa/gs'
import type Team from '#model/team/GsTeam'
import {
type GsWorkerDataSerialized,
deserializeGsWorkerData,
} from 'model/WorkerData'
import exposeWorker, { type ExposedFuncType } from 'utils/worker/expose'
} from '#model/WorkerData'
import exposeWorker, { type ExposedFuncType } from '#utils/worker/expose'

type GetPredicateParams = Parameters<typeof getPredicate>

Expand Down
10 changes: 5 additions & 5 deletions src/pages/cl/gs/firstPossibleGroupWorker.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import memoizeOne from 'memoize-one'

import { firstPossibleGroup } from 'engine/backtracking/gs'
import getPredicate from 'engine/predicates/uefa/gs'
import type Team from 'model/team/GsTeam'
import { firstPossibleGroup } from '#engine/backtracking/gs'
import getPredicate from '#engine/predicates/uefa/gs'
import type Team from '#model/team/GsTeam'
import {
type GsWorkerDataSerialized,
deserializeGsWorkerData,
} from 'model/WorkerData'
import exposeWorker, { type ExposedFuncType } from 'utils/worker/expose'
} from '#model/WorkerData'
import exposeWorker, { type ExposedFuncType } from '#utils/worker/expose'

type GetPredicateParams = Parameters<typeof getPredicate>

Expand Down
Loading

0 comments on commit c0872c4

Please sign in to comment.