lint: добавление линтера
Reviewed-on: #5 Co-authored-by: Arswarog <arswarog@yandex.ru> Co-committed-by: Arswarog <arswarog@yandex.ru>
This commit was merged in pull request #5.
This commit is contained in:
+3
-3
@@ -1,4 +1,4 @@
|
||||
title: "Title example"
|
||||
title: 'Title example'
|
||||
project:
|
||||
org: "example"
|
||||
repo: "example"
|
||||
org: 'example'
|
||||
repo: 'example'
|
||||
|
||||
Executable
+1
@@ -0,0 +1 @@
|
||||
yarn lint-staged
|
||||
@@ -0,0 +1,7 @@
|
||||
dist
|
||||
coverage
|
||||
*.d.ts
|
||||
node_modules
|
||||
.idea
|
||||
logs
|
||||
report
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"printWidth": 100,
|
||||
"useTabs": false,
|
||||
"tabWidth": 4,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all",
|
||||
"bracketSpacing": true,
|
||||
"singleAttributePerLine": true,
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"*.json"
|
||||
],
|
||||
"options": {
|
||||
"printWidth": 10
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"*.md",
|
||||
"*.mdx"
|
||||
],
|
||||
"options": {
|
||||
"proseWrap": "always"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -14,7 +14,8 @@ yarn
|
||||
yarn start
|
||||
```
|
||||
|
||||
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
|
||||
This command starts a local development server and opens up a browser window. Most changes are
|
||||
reflected live without having to restart the server.
|
||||
|
||||
## Build
|
||||
|
||||
@@ -22,4 +23,5 @@ This command starts a local development server and opens up a browser window. Mo
|
||||
yarn build
|
||||
```
|
||||
|
||||
This command generates static content into the `build` directory and can be served using any static contents hosting service.
|
||||
This command generates static content into the `build` directory and can be served using any static
|
||||
contents hosting service.
|
||||
|
||||
+104
-104
@@ -2,120 +2,120 @@ name: 'Docusaurus Deploy'
|
||||
description: 'Builds Docusaurus docs from repo and deploys to S3'
|
||||
|
||||
inputs:
|
||||
docs-path:
|
||||
description: 'Path to docs directory in calling repo'
|
||||
default: 'docs'
|
||||
on-broken-links:
|
||||
description: 'Behavior on broken links: throw, warn, or ignore'
|
||||
default: 'throw'
|
||||
prefix:
|
||||
description: 'Prefix for S3 path'
|
||||
default: ''
|
||||
docs-path:
|
||||
description: 'Path to docs directory in calling repo'
|
||||
default: 'docs'
|
||||
on-broken-links:
|
||||
description: 'Behavior on broken links: throw, warn, or ignore'
|
||||
default: 'throw'
|
||||
prefix:
|
||||
description: 'Prefix for S3 path'
|
||||
default: ''
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Compute target URL
|
||||
shell: bash
|
||||
run: |
|
||||
REF="${{ github.head_ref || github.ref_name }}"
|
||||
REPO="${{ github.event.repository.name }}"
|
||||
ORG="${{ github.repository_owner }}"
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Compute target URL
|
||||
shell: bash
|
||||
run: |
|
||||
REF="${{ github.head_ref || github.ref_name }}"
|
||||
REPO="${{ github.event.repository.name }}"
|
||||
ORG="${{ github.repository_owner }}"
|
||||
|
||||
if [[ "$REF" == "main" || "$REF" == "master" ]]; then
|
||||
URL="http://${REPO}.${ORG}.jt4d-wiki.ru.net"
|
||||
S3_PATH="${ORG}.${REPO}"
|
||||
else
|
||||
URL="http://${REF}.${REPO}.${ORG}.jt4d-wiki.ru.net"
|
||||
S3_PATH="${ORG}.${REPO}.${REF}"
|
||||
fi
|
||||
if [[ "$REF" == "main" || "$REF" == "master" ]]; then
|
||||
URL="http://${REPO}.${ORG}.jt4d-wiki.ru.net"
|
||||
S3_PATH="${ORG}.${REPO}"
|
||||
else
|
||||
URL="http://${REF}.${REPO}.${ORG}.jt4d-wiki.ru.net"
|
||||
S3_PATH="${ORG}.${REPO}.${REF}"
|
||||
fi
|
||||
|
||||
PREFIX="${{ inputs.prefix }}"
|
||||
if [[ -n "$PREFIX" ]]; then
|
||||
S3_PATH="${PREFIX}/${S3_PATH}"
|
||||
fi
|
||||
PREFIX="${{ inputs.prefix }}"
|
||||
if [[ -n "$PREFIX" ]]; then
|
||||
S3_PATH="${PREFIX}/${S3_PATH}"
|
||||
fi
|
||||
|
||||
echo "TARGET_URL=$URL" >> $GITHUB_ENV
|
||||
echo "S3_PATH=$S3_PATH" >> $GITHUB_ENV
|
||||
echo "TARGET_URL=$URL" >> $GITHUB_ENV
|
||||
echo "S3_PATH=$S3_PATH" >> $GITHUB_ENV
|
||||
|
||||
- name: Set docs status pending
|
||||
shell: bash
|
||||
run: |
|
||||
curl -s -X POST \
|
||||
-H "Authorization: token ${{ github.token }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"state": "pending",
|
||||
"context": "Docs",
|
||||
"description": "building",
|
||||
"target_url": "${{ env.TARGET_URL }}"
|
||||
}' \
|
||||
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/statuses/${{ github.sha }}"
|
||||
- name: Set docs status pending
|
||||
shell: bash
|
||||
run: |
|
||||
curl -s -X POST \
|
||||
-H "Authorization: token ${{ github.token }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"state": "pending",
|
||||
"context": "Docs",
|
||||
"description": "building",
|
||||
"target_url": "${{ env.TARGET_URL }}"
|
||||
}' \
|
||||
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/statuses/${{ github.sha }}"
|
||||
|
||||
- name: Copy docs into Docusaurus
|
||||
shell: bash
|
||||
run: |
|
||||
DOCUSAURUS_DIR="${{ github.action_path }}"
|
||||
rm -rf "${DOCUSAURUS_DIR}/docs"
|
||||
cp -r "${{ inputs.docs-path }}" "${DOCUSAURUS_DIR}/docs"
|
||||
cp "${{ github.workspace }}/.docuservix.yml" "${DOCUSAURUS_DIR}"
|
||||
- name: Copy docs into Docusaurus
|
||||
shell: bash
|
||||
run: |
|
||||
DOCUSAURUS_DIR="${{ github.action_path }}"
|
||||
rm -rf "${DOCUSAURUS_DIR}/docs"
|
||||
cp -r "${{ inputs.docs-path }}" "${DOCUSAURUS_DIR}/docs"
|
||||
cp "${{ github.workspace }}/.docuservix.yml" "${DOCUSAURUS_DIR}"
|
||||
|
||||
- name: Prepare docs
|
||||
shell: bash
|
||||
working-directory: ${{ github.action_path }}
|
||||
run: node scripts/prepare-docs.mjs
|
||||
- name: Prepare docs
|
||||
shell: bash
|
||||
working-directory: ${{ github.action_path }}
|
||||
run: node scripts/prepare-docs.mjs
|
||||
|
||||
- name: Install Docusaurus dependencies
|
||||
shell: bash
|
||||
working-directory: ${{ github.action_path }}
|
||||
run: yarn install --frozen-lockfile
|
||||
- name: Install Docusaurus dependencies
|
||||
shell: bash
|
||||
working-directory: ${{ github.action_path }}
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
- name: Build docs
|
||||
shell: bash
|
||||
working-directory: ${{ github.action_path }}
|
||||
env:
|
||||
DOCUSERVIX_ON_BROKEN_LINKS: ${{ inputs.on-broken-links }}
|
||||
DOCUSERVIX_URL: ${{ env.TARGET_URL }}
|
||||
run: yarn docusaurus build --out-dir ${{ github.workspace }}/generated-docs
|
||||
- name: Build docs
|
||||
shell: bash
|
||||
working-directory: ${{ github.action_path }}
|
||||
env:
|
||||
DOCUSERVIX_ON_BROKEN_LINKS: ${{ inputs.on-broken-links }}
|
||||
DOCUSERVIX_URL: ${{ env.TARGET_URL }}
|
||||
run: yarn docusaurus build --out-dir ${{ github.workspace }}/generated-docs
|
||||
|
||||
- name: Upload to S3
|
||||
shell: bash
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ vars.DOCUSERVIX_S3_ACCESS }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ vars.DOCUSERVIX_S3_SECRET }}
|
||||
run: |
|
||||
aws s3 sync generated-docs/ \
|
||||
s3://${{ vars.DOCUSERVIX_S3_BUCKET }}/${{ env.S3_PATH }}\
|
||||
--endpoint-url ${{ vars.DOCUSERVIX_S3_URL }} \
|
||||
--acl public-read \
|
||||
--delete
|
||||
- name: Upload to S3
|
||||
shell: bash
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ vars.DOCUSERVIX_S3_ACCESS }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ vars.DOCUSERVIX_S3_SECRET }}
|
||||
run: |
|
||||
aws s3 sync generated-docs/ \
|
||||
s3://${{ vars.DOCUSERVIX_S3_BUCKET }}/${{ env.S3_PATH }}\
|
||||
--endpoint-url ${{ vars.DOCUSERVIX_S3_URL }} \
|
||||
--acl public-read \
|
||||
--delete
|
||||
|
||||
- name: Set docs status success
|
||||
if: success()
|
||||
shell: bash
|
||||
run: |
|
||||
curl -s -X POST \
|
||||
-H "Authorization: token ${{ github.token }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"state": "success",
|
||||
"context": "Docs",
|
||||
"description": "deployed",
|
||||
"target_url": "${{ env.TARGET_URL }}"
|
||||
}' \
|
||||
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/statuses/${{ github.sha }}"
|
||||
- name: Set docs status success
|
||||
if: success()
|
||||
shell: bash
|
||||
run: |
|
||||
curl -s -X POST \
|
||||
-H "Authorization: token ${{ github.token }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"state": "success",
|
||||
"context": "Docs",
|
||||
"description": "deployed",
|
||||
"target_url": "${{ env.TARGET_URL }}"
|
||||
}' \
|
||||
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/statuses/${{ github.sha }}"
|
||||
|
||||
- name: Set docs status failure
|
||||
if: failure()
|
||||
shell: bash
|
||||
run: |
|
||||
curl -s -X POST \
|
||||
-H "Authorization: token ${{ github.token }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"state": "failure",
|
||||
"context": "Docs",
|
||||
"description": "build failed",
|
||||
"target_url": "${{ env.TARGET_URL }}"
|
||||
}' \
|
||||
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/statuses/${{ github.sha }}"
|
||||
- name: Set docs status failure
|
||||
if: failure()
|
||||
shell: bash
|
||||
run: |
|
||||
curl -s -X POST \
|
||||
-H "Authorization: token ${{ github.token }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"state": "failure",
|
||||
"context": "Docs",
|
||||
"description": "build failed",
|
||||
"target_url": "${{ env.TARGET_URL }}"
|
||||
}' \
|
||||
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/statuses/${{ github.sha }}"
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
# Добро пожаловать в Docuservix!
|
||||
|
||||
Вам надо настроить публикацию документации по инструкции в https://git.jt4d.ru/jt4d/docuservix
|
||||
Вам надо настроить публикацию документации по инструкции в https://git.jt4d.ru/jt4d/docuservix
|
||||
|
||||
+19
-22
@@ -1,9 +1,10 @@
|
||||
import fs from 'fs';
|
||||
import yaml from 'js-yaml';
|
||||
import {themes as prismThemes} from 'prism-react-renderer';
|
||||
import type {Config} from '@docusaurus/types';
|
||||
|
||||
import type * as Preset from '@docusaurus/preset-classic';
|
||||
import type {NavbarItem} from '@docusaurus/theme-common'
|
||||
import type { NavbarItem } from '@docusaurus/theme-common';
|
||||
import type { Config } from '@docusaurus/types';
|
||||
import yaml from 'js-yaml';
|
||||
import { themes as prismThemes } from 'prism-react-renderer';
|
||||
|
||||
interface DocsConfig {
|
||||
title: string;
|
||||
@@ -13,24 +14,17 @@ interface DocsConfig {
|
||||
|
||||
const docsConfig = yaml.load(fs.readFileSync('./.docuservix.yml', 'utf8')) as DocsConfig;
|
||||
|
||||
const {
|
||||
title,
|
||||
} = docsConfig
|
||||
const { title } = docsConfig;
|
||||
|
||||
const url = process.env.DOCUSERVIX_URL;
|
||||
|
||||
const {
|
||||
org,
|
||||
repo
|
||||
} = docsConfig.project
|
||||
const { org, repo } = docsConfig.project;
|
||||
|
||||
const {
|
||||
docs: docsDir = 'docs',
|
||||
blog: blogDir
|
||||
} = docsConfig.dirs || {}
|
||||
const { docs: _docsDir = 'docs', blog: blogDir } = docsConfig.dirs || {};
|
||||
|
||||
const giteaUrl = 'https://git.jt4d.ru';
|
||||
const onBrokenLinks = (process.env.DOCUSERVIX_ON_BROKEN_LINKS as Config['onBrokenLinks']) || 'throw';
|
||||
const onBrokenLinks =
|
||||
(process.env.DOCUSERVIX_ON_BROKEN_LINKS as Config['onBrokenLinks']) || 'throw';
|
||||
|
||||
const config: Config = {
|
||||
title,
|
||||
@@ -107,11 +101,13 @@ const config: Config = {
|
||||
label: 'Документация',
|
||||
position: 'left',
|
||||
},
|
||||
blogDir ? {
|
||||
to: '/blog',
|
||||
label: 'Блог',
|
||||
position: 'left'
|
||||
} : undefined,
|
||||
blogDir
|
||||
? {
|
||||
to: '/blog',
|
||||
label: 'Блог',
|
||||
position: 'left',
|
||||
}
|
||||
: undefined,
|
||||
{
|
||||
href: `${giteaUrl}/${org}/${repo}`,
|
||||
label: 'Gitea',
|
||||
@@ -121,7 +117,8 @@ const config: Config = {
|
||||
},
|
||||
footer: {
|
||||
style: 'dark',
|
||||
copyright: `Проект хостится на JT4D.ru, документация собрана с использованием Docuservix и Docusaurus.`,
|
||||
copyright:
|
||||
'Проект хостится на JT4D.ru, документация собрана с использованием Docuservix и Docusaurus.',
|
||||
},
|
||||
prism: {
|
||||
theme: prismThemes.github,
|
||||
|
||||
@@ -0,0 +1,351 @@
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
import { fixupPluginRules } from '@eslint/compat';
|
||||
import { FlatCompat } from '@eslint/eslintrc';
|
||||
import js from '@eslint/js';
|
||||
import typescriptEslint from '@typescript-eslint/eslint-plugin';
|
||||
import tsParser from '@typescript-eslint/parser';
|
||||
import etc from 'eslint-plugin-etc';
|
||||
import _import from 'eslint-plugin-import';
|
||||
import noOnlyTests from 'eslint-plugin-no-only-tests';
|
||||
import noSkipTests from 'eslint-plugin-no-skip-tests';
|
||||
import react from 'eslint-plugin-react';
|
||||
import reactHooks from 'eslint-plugin-react-hooks';
|
||||
import unusedImports from 'eslint-plugin-unused-imports';
|
||||
import globals from 'globals';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
const compat = new FlatCompat({
|
||||
baseDirectory: __dirname,
|
||||
recommendedConfig: js.configs.recommended,
|
||||
allConfig: js.configs.all,
|
||||
});
|
||||
|
||||
export default [
|
||||
{
|
||||
ignores: [
|
||||
'**/.eslintrc.js',
|
||||
'**/node_modules',
|
||||
'**/coverage',
|
||||
'**/build',
|
||||
'**/.docusaurus',
|
||||
'**/vite.config.*.timestamp*',
|
||||
'**/vitest.config.*.timestamp*',
|
||||
],
|
||||
},
|
||||
...compat.extends(
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:prettier/recommended',
|
||||
'prettier',
|
||||
'plugin:eslint-comments/recommended',
|
||||
),
|
||||
{
|
||||
plugins: {
|
||||
import: fixupPluginRules(_import),
|
||||
react,
|
||||
'react-hooks': fixupPluginRules(reactHooks),
|
||||
'@typescript-eslint': typescriptEslint,
|
||||
etc,
|
||||
'no-only-tests': noOnlyTests,
|
||||
'no-skip-tests': noSkipTests,
|
||||
'unused-imports': unusedImports,
|
||||
},
|
||||
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.node,
|
||||
...globals.jest,
|
||||
},
|
||||
|
||||
parser: tsParser,
|
||||
ecmaVersion: 6,
|
||||
sourceType: 'module',
|
||||
|
||||
parserOptions: {
|
||||
ecmaFeatures: {
|
||||
modules: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
settings: {
|
||||
'import/resolver': {
|
||||
node: {
|
||||
extensions: ['.js', '.ts', '.tsx', '.json'],
|
||||
},
|
||||
|
||||
typescript: {
|
||||
alwaysTryTypes: true,
|
||||
},
|
||||
},
|
||||
|
||||
react: {
|
||||
version: 'detect',
|
||||
},
|
||||
},
|
||||
|
||||
rules: {
|
||||
'@typescript-eslint/interface-name-prefix': 'off',
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
|
||||
curly: ['error', 'all'],
|
||||
'max-params': 'off',
|
||||
|
||||
'no-console': [
|
||||
'error',
|
||||
{
|
||||
allow: ['warn', 'error'],
|
||||
},
|
||||
],
|
||||
|
||||
'no-warning-comments': [
|
||||
'error',
|
||||
{
|
||||
terms: ['fixme'],
|
||||
location: 'anywhere',
|
||||
},
|
||||
],
|
||||
|
||||
'no-unused-vars': 'off',
|
||||
'space-before-blocks': 'error',
|
||||
|
||||
'padding-line-between-statements': [
|
||||
'error',
|
||||
{
|
||||
blankLine: 'always',
|
||||
prev: '*',
|
||||
next: ['break', 'continue', 'return'],
|
||||
},
|
||||
{
|
||||
blankLine: 'always',
|
||||
prev: ['const', 'let'],
|
||||
next: '*',
|
||||
},
|
||||
{
|
||||
blankLine: 'any',
|
||||
prev: ['const', 'let'],
|
||||
next: ['const', 'let'],
|
||||
},
|
||||
{
|
||||
blankLine: 'always',
|
||||
prev: 'directive',
|
||||
next: '*',
|
||||
},
|
||||
{
|
||||
blankLine: 'any',
|
||||
prev: 'directive',
|
||||
next: 'directive',
|
||||
},
|
||||
{
|
||||
blankLine: 'always',
|
||||
prev: 'block-like',
|
||||
next: '*',
|
||||
},
|
||||
{
|
||||
blankLine: 'always',
|
||||
prev: '*',
|
||||
next: 'block-like',
|
||||
},
|
||||
],
|
||||
|
||||
'import/order': [
|
||||
'error',
|
||||
{
|
||||
pathGroups: [
|
||||
{
|
||||
pattern: 'react,bem-css-modules',
|
||||
group: 'builtin',
|
||||
position: 'before',
|
||||
},
|
||||
{
|
||||
pattern: '@docuservix/**',
|
||||
group: 'internal',
|
||||
},
|
||||
],
|
||||
|
||||
pathGroupsExcludedImportTypes: ['react'],
|
||||
'newlines-between': 'always',
|
||||
groups: ['builtin', 'external', 'internal', 'parent', ['sibling', 'index']],
|
||||
|
||||
alphabetize: {
|
||||
order: 'asc',
|
||||
caseInsensitive: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
'react/no-direct-mutation-state': 'error',
|
||||
'react/no-deprecated': 'error',
|
||||
'react/no-unsafe': 'error',
|
||||
'react/jsx-uses-vars': 'error',
|
||||
'react/jsx-uses-react': 'error',
|
||||
'react/jsx-curly-brace-presence': ['error', 'never'],
|
||||
'react-hooks/rules-of-hooks': 'error',
|
||||
'react-hooks/exhaustive-deps': 'warn',
|
||||
|
||||
quotes: [
|
||||
'error',
|
||||
'single',
|
||||
{
|
||||
avoidEscape: true,
|
||||
},
|
||||
],
|
||||
|
||||
'quote-props': ['warn', 'as-needed'],
|
||||
|
||||
'@typescript-eslint/no-explicit-any': [
|
||||
'warn',
|
||||
{
|
||||
ignoreRestArgs: true,
|
||||
},
|
||||
],
|
||||
|
||||
'@typescript-eslint/member-ordering': [
|
||||
'error',
|
||||
{
|
||||
default: [
|
||||
'public-static-field',
|
||||
'protected-static-field',
|
||||
'private-static-field',
|
||||
|
||||
'public-instance-field',
|
||||
'protected-instance-field',
|
||||
'private-instance-field',
|
||||
|
||||
'constructor',
|
||||
|
||||
'public-instance-method',
|
||||
'protected-instance-method',
|
||||
'private-instance-method',
|
||||
|
||||
'public-static-method',
|
||||
'protected-static-method',
|
||||
'private-static-method',
|
||||
|
||||
'signature',
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
'etc/prefer-interface': [
|
||||
'warn',
|
||||
{
|
||||
allowLocal: true,
|
||||
},
|
||||
],
|
||||
|
||||
'@typescript-eslint/ban-ts-comment': [
|
||||
'error',
|
||||
{
|
||||
'ts-ignore': 'allow-with-description',
|
||||
'ts-nocheck': 'allow-with-description',
|
||||
'ts-check': false,
|
||||
'ts-expect-error': false,
|
||||
},
|
||||
],
|
||||
|
||||
'@typescript-eslint/no-empty-interface': 'warn',
|
||||
'@typescript-eslint/no-empty-function': 'warn',
|
||||
'@typescript-eslint/no-unused-vars': 'off',
|
||||
// todo изучить и включить
|
||||
'@typescript-eslint/no-unused-expressions': 'off',
|
||||
|
||||
// todo изучить и включить
|
||||
'@typescript-eslint/no-empty-object-type': 'off',
|
||||
|
||||
'no-restricted-imports': [
|
||||
'error',
|
||||
{
|
||||
paths: [
|
||||
{
|
||||
name: '@nestjs/swagger',
|
||||
importNames: ['PartialType'],
|
||||
message:
|
||||
"Please import 'PartialType' from '@src/server/common/nest' instead.",
|
||||
},
|
||||
{
|
||||
name: 'react-bootstrap',
|
||||
importNames: [
|
||||
'Card',
|
||||
'CardHeader',
|
||||
'CardBody',
|
||||
'CardFooter',
|
||||
'Row',
|
||||
'Col',
|
||||
'Modal',
|
||||
],
|
||||
message: "Please use project's components with same name",
|
||||
},
|
||||
{
|
||||
name: 'react-bootstrap/Modal',
|
||||
message: "Please use project's components with same name",
|
||||
},
|
||||
{
|
||||
name: '@nestjs/common',
|
||||
importNames: ['Logger'],
|
||||
message: "Please import 'Logger' from '@src/server/logger' instead.",
|
||||
},
|
||||
{
|
||||
name: 'nestjs-pino',
|
||||
importNames: ['Logger', 'PinoLogger'],
|
||||
message: "Please import 'Logger' from '@src/server/logger' instead.",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
'unused-imports/no-unused-imports': 'error',
|
||||
|
||||
'unused-imports/no-unused-vars': [
|
||||
'error',
|
||||
{
|
||||
vars: 'all',
|
||||
args: 'after-used',
|
||||
ignoreRestSiblings: true,
|
||||
argsIgnorePattern: '^_',
|
||||
varsIgnorePattern: '^_',
|
||||
caughtErrorsIgnorePattern: '^_',
|
||||
},
|
||||
],
|
||||
|
||||
'eslint-comments/require-description': [
|
||||
'error',
|
||||
{
|
||||
ignore: ['eslint-enable'],
|
||||
},
|
||||
],
|
||||
|
||||
'eslint-comments/disable-enable-pair': [
|
||||
'error',
|
||||
{
|
||||
allowWholeFile: true,
|
||||
},
|
||||
],
|
||||
|
||||
complexity: ['warn', 10],
|
||||
eqeqeq: ['error'],
|
||||
'func-style': ['warn', 'declaration'],
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/*.spec.{js,jsx,ts,tsx}'],
|
||||
|
||||
rules: {
|
||||
'no-only-tests/no-only-tests': 'error',
|
||||
'no-skip-tests/no-skip-tests': 'warn',
|
||||
|
||||
'no-console': [
|
||||
'warn',
|
||||
{
|
||||
allow: ['warn', 'error'],
|
||||
},
|
||||
],
|
||||
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
},
|
||||
},
|
||||
];
|
||||
+83
-50
@@ -1,52 +1,85 @@
|
||||
{
|
||||
"name": "docusaurus",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
"start": "docusaurus start",
|
||||
"build": "docusaurus build",
|
||||
"swizzle": "docusaurus swizzle",
|
||||
"deploy": "docusaurus deploy",
|
||||
"clear": "docusaurus clear",
|
||||
"serve": "docusaurus serve",
|
||||
"write-translations": "docusaurus write-translations",
|
||||
"write-heading-ids": "docusaurus write-heading-ids",
|
||||
"typecheck": "tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.10.1",
|
||||
"@docusaurus/faster": "3.10.1",
|
||||
"@docusaurus/preset-classic": "3.10.1",
|
||||
"@docusaurus/theme-mermaid": "3.10.1",
|
||||
"@mdx-js/react": "^3.0.0",
|
||||
"clsx": "^2.0.0",
|
||||
"js-yaml": "^4.2.0",
|
||||
"prism-react-renderer": "^2.3.0",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "3.10.1",
|
||||
"@docusaurus/tsconfig": "3.10.1",
|
||||
"@docusaurus/types": "3.10.1",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/react": "^19.0.0",
|
||||
"typescript": "~6.0.2"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.5%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 3 chrome version",
|
||||
"last 3 firefox version",
|
||||
"last 5 safari version"
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.0"
|
||||
}
|
||||
"name": "docusaurus",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "docusaurus build",
|
||||
"clear": "docusaurus clear",
|
||||
"deploy": "docusaurus deploy",
|
||||
"docusaurus": "docusaurus",
|
||||
"eslint:check": "yarn eslint",
|
||||
"eslint:fix": "yarn eslint --fix",
|
||||
"lint": "run-s eslint:fix prettier:fix",
|
||||
"lint:check": "run-s eslint:check prettier:check",
|
||||
"prepare": "husky",
|
||||
"prettier:check": "prettier --check \"**/*.{ts,tsx,js,mjs,json,yml,yaml,md,mdx}\"",
|
||||
"prettier:fix": "prettier --write \"**/*.{ts,tsx,js,mjs,json,yml,yaml,md,mdx}\"",
|
||||
"serve": "docusaurus serve",
|
||||
"start": "docusaurus start",
|
||||
"swizzle": "docusaurus swizzle",
|
||||
"typecheck": "tsc",
|
||||
"write-heading-ids": "docusaurus write-heading-ids",
|
||||
"write-translations": "docusaurus write-translations"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{json,ts,tsx,js,jsx,js,mjs,md,mdx,yaml,yml}": "prettier --write",
|
||||
"{src,e2e}/**/*.{ts,tsx}": "eslint --quiet --fix"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.5%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 3 chrome version",
|
||||
"last 3 firefox version",
|
||||
"last 5 safari version"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "3.10.1",
|
||||
"@docusaurus/faster": "3.10.1",
|
||||
"@docusaurus/preset-classic": "3.10.1",
|
||||
"@docusaurus/theme-mermaid": "3.10.1",
|
||||
"@mdx-js/react": "^3.0.0",
|
||||
"clsx": "^2.0.0",
|
||||
"js-yaml": "^4.2.0",
|
||||
"prism-react-renderer": "^2.3.0",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@docusaurus/module-type-aliases": "3.10.1",
|
||||
"@docusaurus/tsconfig": "3.10.1",
|
||||
"@docusaurus/types": "3.10.1",
|
||||
"@eslint/compat": "^1.1.1",
|
||||
"@eslint/eslintrc": "^3.1.0",
|
||||
"@eslint/js": "^9.8.0",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/react": "^19.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
||||
"@typescript-eslint/parser": "^8.0.0",
|
||||
"eslint": "^9.8.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-import-resolver-typescript": "^4.4.5",
|
||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||
"eslint-plugin-etc": "^2.0.3",
|
||||
"eslint-plugin-import": "^2.32.0",
|
||||
"eslint-plugin-no-only-tests": "^3.1.0",
|
||||
"eslint-plugin-no-skip-tests": "^1.1.0",
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"eslint-plugin-react": "^7.37.5",
|
||||
"eslint-plugin-react-hooks": "^7.1.1",
|
||||
"eslint-plugin-unused-imports": "^4.0.1",
|
||||
"globals": "^17.6.0",
|
||||
"husky": "^9.1.7",
|
||||
"lint-staged": "^17.0.7",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^3.8.4",
|
||||
"typescript": "~6.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20.0"
|
||||
}
|
||||
}
|
||||
|
||||
+26
-14
@@ -1,3 +1,5 @@
|
||||
/* eslint-disable no-console -- logs required */
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
@@ -9,23 +11,33 @@ pinIndexToTop();
|
||||
* Гарантирует наличие sidebar_position: 0 в front matter файла index.md
|
||||
*/
|
||||
function pinIndexToTop() {
|
||||
const indexPath = path.join(docsDir, 'index.md');
|
||||
if (!fs.existsSync(indexPath)) return;
|
||||
const indexPath = path.join(docsDir, 'index.md');
|
||||
|
||||
let content = fs.readFileSync(indexPath, 'utf8');
|
||||
if (!fs.existsSync(indexPath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (content.startsWith('---\n')) {
|
||||
const endIdx = content.indexOf('\n---\n', 4);
|
||||
if (endIdx === -1) return;
|
||||
let content = fs.readFileSync(indexPath, 'utf8');
|
||||
|
||||
const frontMatter = content.slice(4, endIdx);
|
||||
if (/^sidebar_position\s*:/m.test(frontMatter)) return;
|
||||
if (content.startsWith('---\n')) {
|
||||
const endIdx = content.indexOf('\n---\n', 4);
|
||||
|
||||
content = '---\nsidebar_position: 0\n' + frontMatter + '\n---\n' + content.slice(endIdx + 5);
|
||||
} else {
|
||||
content = '---\nsidebar_position: 0\n---\n' + content;
|
||||
}
|
||||
if (endIdx === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
fs.writeFileSync(indexPath, content);
|
||||
console.log('prepare-docs: pinned index.md to sidebar top');
|
||||
const frontMatter = content.slice(4, endIdx);
|
||||
|
||||
if (/^sidebar_position\s*:/m.test(frontMatter)) {
|
||||
return;
|
||||
}
|
||||
|
||||
content =
|
||||
'---\nsidebar_position: 0\n' + frontMatter + '\n---\n' + content.slice(endIdx + 5);
|
||||
} else {
|
||||
content = '---\nsidebar_position: 0\n---\n' + content;
|
||||
}
|
||||
|
||||
fs.writeFileSync(indexPath, content);
|
||||
console.log('prepare-docs: pinned index.md to sidebar top');
|
||||
}
|
||||
|
||||
+36
-29
@@ -1,40 +1,47 @@
|
||||
import type {ReactNode} from 'react';
|
||||
import clsx from 'clsx';
|
||||
import Link from '@docusaurus/Link';
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
import Layout from '@theme/Layout';
|
||||
import Heading from '@theme/Heading';
|
||||
import Layout from '@theme/Layout';
|
||||
import clsx from 'clsx';
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
import styles from './index.module.css';
|
||||
|
||||
function HomepageHeader() {
|
||||
const {siteConfig} = useDocusaurusContext();
|
||||
return (
|
||||
<header className={clsx('hero hero--primary', styles.heroBanner)}>
|
||||
<div className="container">
|
||||
<Heading as="h1" className="hero__title">
|
||||
{siteConfig.title}
|
||||
</Heading>
|
||||
<p className="hero__subtitle">{siteConfig.tagline}</p>
|
||||
<div className={styles.buttons}>
|
||||
<Link
|
||||
className="button button--secondary button--lg"
|
||||
to="/docs">
|
||||
Документация
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
const { siteConfig } = useDocusaurusContext();
|
||||
|
||||
return (
|
||||
<header className={clsx('hero hero--primary', styles.heroBanner)}>
|
||||
<div className="container">
|
||||
<Heading
|
||||
as="h1"
|
||||
className="hero__title"
|
||||
>
|
||||
{siteConfig.title}
|
||||
</Heading>
|
||||
<p className="hero__subtitle">{siteConfig.tagline}</p>
|
||||
<div className={styles.buttons}>
|
||||
<Link
|
||||
className="button button--secondary button--lg"
|
||||
to="/docs"
|
||||
>
|
||||
Документация
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
export default function Home(): ReactNode {
|
||||
const {siteConfig} = useDocusaurusContext();
|
||||
return (
|
||||
<Layout
|
||||
title={`Hello from ${siteConfig.title}`}
|
||||
description="Description will go into a meta tag in <head />">
|
||||
<HomepageHeader />
|
||||
</Layout>
|
||||
);
|
||||
const { siteConfig } = useDocusaurusContext();
|
||||
|
||||
return (
|
||||
<Layout
|
||||
title={`Hello from ${siteConfig.title}`}
|
||||
description="Description will go into a meta tag in <head />"
|
||||
>
|
||||
<HomepageHeader />
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
+10
-7
@@ -2,11 +2,14 @@
|
||||
// It is here to improve your IDE experience (type-checking, autocompletion...),
|
||||
// and can also run the package.json "typecheck" script manually.
|
||||
{
|
||||
"extends": "@docusaurus/tsconfig",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"ignoreDeprecations": "6.0",
|
||||
"strict": true
|
||||
},
|
||||
"exclude": [".docusaurus", "build"]
|
||||
"extends": "@docusaurus/tsconfig",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"ignoreDeprecations": "6.0",
|
||||
"strict": true
|
||||
},
|
||||
"exclude": [
|
||||
".docusaurus",
|
||||
"build"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user