xenopomp-essentials 0.3.3 → 0.3.4-hotfix.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli-tools/index.d.mts +60 -0
- package/cli-tools/index.d.ts +60 -0
- package/cli-tools/index.mjs +1 -0
- package/eslint/index.d.mts +39 -0
- package/eslint/index.d.ts +39 -0
- package/eslint/index.mjs +3 -0
- package/index.d.mts +613 -0
- package/index.d.ts +613 -0
- package/index.mjs +1 -0
- package/next/index.d.mts +67 -0
- package/next/index.d.ts +67 -0
- package/next/index.mjs +11 -0
- package/package.json +4 -1
- package/.config/.lintstagedrc.json +0 -3
- package/.config/build.config.ts +0 -41
- package/.config/testing-exclusions/index.ts +0 -2
- package/.config/testing-exclusions/istanbul-exclusions.ts +0 -1
- package/.config/testing-exclusions/vitest-exclusions.ts +0 -8
- package/.config/ts/tsconfig.lint.json +0 -10
- package/.config/vitest.config.ts +0 -18
- package/.gitattributes +0 -25
- package/.github/workflows/ci.yml +0 -54
- package/.github/workflows/npm-publish.yml +0 -27
- package/.husky/pre-commit +0 -1
- package/.idea/codeStyles/Project.xml +0 -59
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/prettier.xml +0 -7
- package/.idea/runConfigurations/_template__of_Vitest.xml +0 -9
- package/.idea/runConfigurations/build.xml +0 -13
- package/.idea/runConfigurations/coverage.xml +0 -12
- package/.idea/runConfigurations/lint.xml +0 -13
- package/.idea/runConfigurations/lint_code.xml +0 -13
- package/.idea/vcs.xml +0 -6
- package/.idea/xenopomp-essentials-js.iml +0 -14
- package/.prettierrc +0 -20
- package/.yarnrc +0 -2
- package/README.md +0 -0
- package/__tests__/assets/assertions/expect-deep-equal.ts +0 -14
- package/__tests__/assets/assertions/expect-to-render.ts +0 -26
- package/__tests__/assets/assertions/index.ts +0 -3
- package/__tests__/assets/assertions/not-throwing.ts +0 -6
- package/__tests__/assets/index.ts +0 -1
- package/__tests__/data/index.ts +0 -1
- package/__tests__/data/parseVersion.data.ts +0 -52
- package/__tests__/unit/cli/path-builder.test.ts +0 -39
- package/__tests__/unit/components/hoc/jsx-dot-notation/component.test-source.tsx +0 -24
- package/__tests__/unit/components/hoc/jsx-dot-notation/hoc.test.tsx +0 -11
- package/__tests__/unit/components/metrika.test.tsx +0 -14
- package/__tests__/unit/components/react-scan.test.tsx +0 -10
- package/__tests__/unit/eslint/config.test.tsx +0 -41
- package/__tests__/unit/utils/capitalize.test.ts +0 -17
- package/__tests__/unit/utils/minmax.test.ts +0 -21
- package/__tests__/unit/utils/parseVersion.test.ts +0 -22
- package/__tests__/unit/utils/pipe.test.ts +0 -23
- package/__tests__/unit/utils/transliterate.test.ts +0 -17
- package/_templates/generator/help/index.ejs.t +0 -5
- package/_templates/generator/new/hello.ejs.t +0 -18
- package/_templates/generator/with-prompt/hello.ejs.t +0 -18
- package/_templates/generator/with-prompt/prompt.ejs.t +0 -14
- package/_templates/init/repo/new-repo.ejs.t +0 -4
- package/_templates/type/new/module.ejs.t +0 -7
- package/_templates/type/new/type.ejs.t +0 -7
- package/_templates/util/new/func.ejs.t +0 -7
- package/_templates/util/new/module.ejs.t +0 -7
- package/_templates/util/new/test.ejs.t +0 -13
- package/eslint.config.ts +0 -17
- package/src/cli-tools/changeFile.ts +0 -1
- package/src/cli-tools/index.ts +0 -2
- package/src/cli-tools/pathBuilder.ts +0 -89
- package/src/eslint/config.ts +0 -145
- package/src/eslint/configs/all.ts +0 -74
- package/src/eslint/configs/deprecation.ts +0 -33
- package/src/eslint/configs/index.ts +0 -7
- package/src/eslint/configs/markdown.ts +0 -30
- package/src/eslint/configs/next.ts +0 -40
- package/src/eslint/configs/old.ts +0 -67
- package/src/eslint/configs/prettier.ts +0 -6
- package/src/eslint/configs/react.ts +0 -18
- package/src/eslint/index.ts +0 -7
- package/src/eslint/prefixes/author.ts +0 -2
- package/src/eslint/prefixes/index.ts +0 -1
- package/src/eslint/types/configs.ts +0 -4
- package/src/eslint/types/custom-config.ts +0 -4
- package/src/eslint/types/index.ts +0 -2
- package/src/index.ts +0 -3
- package/src/next/Metrika/Metrika.props.ts +0 -11
- package/src/next/Metrika/Metrika.tsx +0 -56
- package/src/next/ReactScan/ReactScan.tsx +0 -33
- package/src/next/index.ts +0 -2
- package/src/react/hoc/index.ts +0 -1
- package/src/react/hoc/jsxDotNotation.tsx +0 -38
- package/src/react/index.ts +0 -1
- package/src/repo-eslint-rules/deep-type-naming.rule.ts +0 -49
- package/src/repo-eslint-rules/index.ts +0 -9
- package/src/schemas/import-meta.schema.ts +0 -12
- package/src/schemas/index.ts +0 -1
- package/src/types/aliases/AnyObject.ts +0 -5
- package/src/types/aliases/EmptyObject.ts +0 -8
- package/src/types/aliases/Fn.ts +0 -12
- package/src/types/aliases/index.ts +0 -3
- package/src/types/index.ts +0 -4
- package/src/types/next/NextParams.ts +0 -26
- package/src/types/next/index.ts +0 -1
- package/src/types/react/AnyFc.ts +0 -6
- package/src/types/react/AsyncFC.ts +0 -16
- package/src/types/react/DataAttributes.ts +0 -21
- package/src/types/react/FCProps.ts +0 -19
- package/src/types/react/FunctionalChildren.ts +0 -13
- package/src/types/react/SetState.ts +0 -11
- package/src/types/react/VariableFC.ts +0 -48
- package/src/types/react/VariableProps.ts +0 -9
- package/src/types/react/index.ts +0 -8
- package/src/types/utilities/ArrayType.ts +0 -12
- package/src/types/utilities/AsyncReturnType.ts +0 -14
- package/src/types/utilities/DeepInject.ts +0 -22
- package/src/types/utilities/Defined.ts +0 -5
- package/src/types/utilities/Jsonish.ts +0 -11
- package/src/types/utilities/LenientAutocomplete.ts +0 -24
- package/src/types/utilities/MatchType.ts +0 -26
- package/src/types/utilities/MergeTypes.ts +0 -12
- package/src/types/utilities/Modify.ts +0 -10
- package/src/types/utilities/Nullable.ts +0 -5
- package/src/types/utilities/OneOf.ts +0 -42
- package/src/types/utilities/Prettify.ts +0 -15
- package/src/types/utilities/RecordKey.ts +0 -9
- package/src/types/utilities/RecordValue.ts +0 -9
- package/src/types/utilities/ReplaceReturnType.ts +0 -10
- package/src/types/utilities/SelectivePartial.ts +0 -17
- package/src/types/utilities/StrictOmit.ts +0 -19
- package/src/types/utilities/Synchronous.ts +0 -18
- package/src/types/utilities/Undefinable.ts +0 -5
- package/src/types/utilities/WeakOmit.ts +0 -17
- package/src/types/utilities/Writeable.ts +0 -18
- package/src/types/utilities/index.ts +0 -24
- package/src/utils/capitalize.ts +0 -15
- package/src/utils/index.ts +0 -7
- package/src/utils/minmax.ts +0 -35
- package/src/utils/parseVersion.ts +0 -42
- package/src/utils/pipe.ts +0 -29
- package/src/utils/transliterate.ts +0 -8
- package/tsconfig.json +0 -43
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import type { TypedFlatConfigItem } from '@antfu/eslint-config';
|
|
2
|
-
|
|
3
|
-
import { AUTHOR_NAME_LOWER } from '../prefixes';
|
|
4
|
-
|
|
5
|
-
export async function all(): Promise<TypedFlatConfigItem[]> {
|
|
6
|
-
return [
|
|
7
|
-
{
|
|
8
|
-
name: `${AUTHOR_NAME_LOWER}:all`,
|
|
9
|
-
rules: {
|
|
10
|
-
'antfu/no-cjs-exports': 'off',
|
|
11
|
-
|
|
12
|
-
'import/prefer-default-export': 'off',
|
|
13
|
-
'import/extensions': 'off',
|
|
14
|
-
'no-restricted-globals': 'off',
|
|
15
|
-
|
|
16
|
-
'node/prefer-global/process': 'off',
|
|
17
|
-
|
|
18
|
-
'jsonc/comma-dangle': 'off',
|
|
19
|
-
'style/jsx-quotes': ['error', 'prefer-double'],
|
|
20
|
-
'style/jsx-one-expression-per-line': [
|
|
21
|
-
'error',
|
|
22
|
-
{ allow: 'single-line' },
|
|
23
|
-
],
|
|
24
|
-
'style/arrow-parens': ['error', 'as-needed'],
|
|
25
|
-
|
|
26
|
-
'unused-imports/no-unused-imports': 'error',
|
|
27
|
-
'unused-imports/no-unused-vars': [
|
|
28
|
-
'warn',
|
|
29
|
-
{
|
|
30
|
-
vars: 'all',
|
|
31
|
-
varsIgnorePattern: '^_',
|
|
32
|
-
args: 'after-used',
|
|
33
|
-
argsIgnorePattern: '^_',
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
'@stylistic/indent': [
|
|
37
|
-
'error',
|
|
38
|
-
2,
|
|
39
|
-
{
|
|
40
|
-
ArrayExpression: 1,
|
|
41
|
-
CallExpression: {
|
|
42
|
-
arguments: 1,
|
|
43
|
-
},
|
|
44
|
-
flatTernaryExpressions: false,
|
|
45
|
-
FunctionDeclaration: {
|
|
46
|
-
body: 1,
|
|
47
|
-
parameters: 1,
|
|
48
|
-
},
|
|
49
|
-
FunctionExpression: {
|
|
50
|
-
body: 1,
|
|
51
|
-
parameters: 1,
|
|
52
|
-
},
|
|
53
|
-
ignoreComments: false,
|
|
54
|
-
ignoredNodes: [
|
|
55
|
-
'TemplateLiteral *',
|
|
56
|
-
'TSIntersectionType',
|
|
57
|
-
'TSTypeParameterInstantiation',
|
|
58
|
-
'FunctionExpression > .params[decorators.length > 0]',
|
|
59
|
-
'FunctionExpression > .params > :matches(Decorator, :not(:first-child))',
|
|
60
|
-
'ClassBody.body > PropertyDefinition[decorators.length > 0] > .key',
|
|
61
|
-
],
|
|
62
|
-
ImportDeclaration: 1,
|
|
63
|
-
MemberExpression: 1,
|
|
64
|
-
ObjectExpression: 1,
|
|
65
|
-
offsetTernaryExpressions: true,
|
|
66
|
-
outerIIFEBody: 1,
|
|
67
|
-
SwitchCase: 1,
|
|
68
|
-
VariableDeclarator: 1,
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
];
|
|
74
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { TypedFlatConfigItem } from '@antfu/eslint-config';
|
|
2
|
-
import { fixupPluginRules } from '@eslint/compat';
|
|
3
|
-
import type { Linter } from 'eslint';
|
|
4
|
-
import plugin from 'eslint-plugin-deprecation';
|
|
5
|
-
|
|
6
|
-
import type { Options as ConfigOptions } from '../config';
|
|
7
|
-
|
|
8
|
-
type Options = Pick<ConfigOptions, 'tsconfigPath'>;
|
|
9
|
-
|
|
10
|
-
export async function deprecation(
|
|
11
|
-
severity: Linter.RuleEntry,
|
|
12
|
-
options?: Options,
|
|
13
|
-
): Promise<TypedFlatConfigItem[]> {
|
|
14
|
-
return [
|
|
15
|
-
{
|
|
16
|
-
name: 'Deprecation plugin',
|
|
17
|
-
languageOptions: {
|
|
18
|
-
parserOptions: {
|
|
19
|
-
project: options?.tsconfigPath ?? './tsconfig.json',
|
|
20
|
-
projectSource: true,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
plugins: {
|
|
24
|
-
// @ts-expect-error Wrong library types
|
|
25
|
-
deprecation: fixupPluginRules(plugin),
|
|
26
|
-
},
|
|
27
|
-
rules: {
|
|
28
|
-
'deprecation/deprecation': severity,
|
|
29
|
-
},
|
|
30
|
-
files: ['**/*.ts', '**/*.tsx'],
|
|
31
|
-
},
|
|
32
|
-
];
|
|
33
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { GLOB_MARKDOWN_CODE } from '@antfu/eslint-config';
|
|
2
|
-
import type { TypedFlatConfigItem } from '@antfu/eslint-config';
|
|
3
|
-
|
|
4
|
-
import { AUTHOR_NAME_LOWER } from '../prefixes';
|
|
5
|
-
|
|
6
|
-
export async function markdown(): Promise<TypedFlatConfigItem[]> {
|
|
7
|
-
return [
|
|
8
|
-
{
|
|
9
|
-
name: `${AUTHOR_NAME_LOWER}:markdown`,
|
|
10
|
-
files: [GLOB_MARKDOWN_CODE],
|
|
11
|
-
rules: {
|
|
12
|
-
'import/no-unresolved': 'off',
|
|
13
|
-
'unused-imports/no-unused-imports': 'off',
|
|
14
|
-
'unused-imports/no-unused-vars': 'off',
|
|
15
|
-
'no-alert': 'off',
|
|
16
|
-
'no-console': 'off',
|
|
17
|
-
'no-restricted-imports': 'off',
|
|
18
|
-
'no-undef': 'off',
|
|
19
|
-
'no-unused-expressions': 'off',
|
|
20
|
-
'no-unused-vars': 'off',
|
|
21
|
-
'antfu/no-cjs-exports': 'off',
|
|
22
|
-
'antfu/no-ts-export-equal': 'off',
|
|
23
|
-
'ts/no-redeclare': 'off',
|
|
24
|
-
'ts/no-unused-vars': 'off',
|
|
25
|
-
'ts/no-var-requires': 'off',
|
|
26
|
-
'ts/consistent-type-imports': 'off',
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
];
|
|
30
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { TypedFlatConfigItem } from '@antfu/eslint-config';
|
|
2
|
-
import { interopDefault } from '@antfu/eslint-config';
|
|
3
|
-
|
|
4
|
-
import { AUTHOR_NAME_LOWER } from '../prefixes';
|
|
5
|
-
|
|
6
|
-
export async function next(): Promise<TypedFlatConfigItem[]> {
|
|
7
|
-
// @ts-expect-error un typed
|
|
8
|
-
const next = await interopDefault(import('@next/eslint-plugin-next'));
|
|
9
|
-
|
|
10
|
-
return [
|
|
11
|
-
{
|
|
12
|
-
name: `${AUTHOR_NAME_LOWER}:next`,
|
|
13
|
-
plugins: { '@next/next': next },
|
|
14
|
-
rules: {
|
|
15
|
-
'@next/next/google-font-display': 'warn',
|
|
16
|
-
'@next/next/google-font-preconnect': 'warn',
|
|
17
|
-
'@next/next/next-script-for-ga': 'warn',
|
|
18
|
-
'@next/next/no-async-client-component': 'warn',
|
|
19
|
-
'@next/next/no-before-interactive-script-outside-document': 'warn',
|
|
20
|
-
'@next/next/no-css-tags': 'warn',
|
|
21
|
-
'@next/next/no-head-element': 'warn',
|
|
22
|
-
'@next/next/no-html-link-for-pages': 'warn',
|
|
23
|
-
'@next/next/no-img-element': 'warn',
|
|
24
|
-
'@next/next/no-page-custom-font': 'warn',
|
|
25
|
-
'@next/next/no-styled-jsx-in-document': 'warn',
|
|
26
|
-
'@next/next/no-sync-scripts': 'warn',
|
|
27
|
-
'@next/next/no-title-in-document-head': 'warn',
|
|
28
|
-
'@next/next/no-typos': 'warn',
|
|
29
|
-
'@next/next/no-unwanted-polyfillio': 'warn',
|
|
30
|
-
// errors
|
|
31
|
-
'@next/next/inline-script-id': 'error',
|
|
32
|
-
'@next/next/no-assign-module-variable': 'error',
|
|
33
|
-
'@next/next/no-document-import-in-page': 'error',
|
|
34
|
-
'@next/next/no-duplicate-head': 'error',
|
|
35
|
-
'@next/next/no-head-import-in-document': 'error',
|
|
36
|
-
'@next/next/no-script-component-in-head': 'error',
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
];
|
|
40
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import type { TypedFlatConfigItem } from '@antfu/eslint-config';
|
|
2
|
-
import globals from 'globals';
|
|
3
|
-
|
|
4
|
-
import { AUTHOR_NAME_LOWER } from '../prefixes';
|
|
5
|
-
|
|
6
|
-
export async function old(): Promise<TypedFlatConfigItem[]> {
|
|
7
|
-
return [
|
|
8
|
-
{
|
|
9
|
-
name: `${AUTHOR_NAME_LOWER}:old_config`,
|
|
10
|
-
languageOptions: {
|
|
11
|
-
globals: {
|
|
12
|
-
...globals.browser,
|
|
13
|
-
...globals.jquery,
|
|
14
|
-
...globals.node,
|
|
15
|
-
|
|
16
|
-
// Rewrite globals anyway
|
|
17
|
-
document: 'readonly',
|
|
18
|
-
navigator: 'readonly',
|
|
19
|
-
window: 'readonly',
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
// Ignore patterns
|
|
24
|
-
ignores: [
|
|
25
|
-
'**/.next/*',
|
|
26
|
-
'**/node_modules/*',
|
|
27
|
-
'**/.github/*',
|
|
28
|
-
'cypress',
|
|
29
|
-
'**/__tests__/e2e/*',
|
|
30
|
-
'*.json',
|
|
31
|
-
'**/*.d.ts',
|
|
32
|
-
'.eslintrc.js',
|
|
33
|
-
'eslint.config.js',
|
|
34
|
-
'.prettierrc',
|
|
35
|
-
'.stylelintrc.js',
|
|
36
|
-
'tsconfig.json',
|
|
37
|
-
'package.json',
|
|
38
|
-
'*.md',
|
|
39
|
-
'*.config.ts',
|
|
40
|
-
'*.config.js',
|
|
41
|
-
'*.md',
|
|
42
|
-
],
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: `${AUTHOR_NAME_LOWER}:rules_breakup_1`,
|
|
46
|
-
rules: { '@next/next/no-duplicate-head': 'off' },
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
name: `${AUTHOR_NAME_LOWER}:rules_breakup_2`,
|
|
50
|
-
rules: {
|
|
51
|
-
'style/operator-linebreak': 'off',
|
|
52
|
-
'test/consistent-test-it': 'off',
|
|
53
|
-
'test/prefer-lowercase-title': 'off',
|
|
54
|
-
'style/jsx-quotes': 'off',
|
|
55
|
-
'style/multiline-ternary': 'off',
|
|
56
|
-
'style/indent': 'off',
|
|
57
|
-
},
|
|
58
|
-
ignores: ['cypress'],
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: `${AUTHOR_NAME_LOWER}:prettier`,
|
|
62
|
-
rules: {
|
|
63
|
-
'antfu/if-newline': 'off',
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
];
|
|
67
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { TypedFlatConfigItem } from '@antfu/eslint-config';
|
|
2
|
-
import { GLOB_JSX, GLOB_TSX } from '@antfu/eslint-config';
|
|
3
|
-
|
|
4
|
-
import { AUTHOR_NAME_LOWER } from '../prefixes';
|
|
5
|
-
|
|
6
|
-
export async function react(): Promise<TypedFlatConfigItem[]> {
|
|
7
|
-
return [
|
|
8
|
-
{
|
|
9
|
-
files: [GLOB_JSX, GLOB_TSX],
|
|
10
|
-
name: `${AUTHOR_NAME_LOWER}:react`,
|
|
11
|
-
rules: {
|
|
12
|
-
'react-refresh/only-export-components': 'off',
|
|
13
|
-
'react/no-clone-element': 'off',
|
|
14
|
-
'react/no-missing-component-display-name': 'off',
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
];
|
|
18
|
-
}
|
package/src/eslint/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './author';
|
package/src/index.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import Script from 'next/script';
|
|
2
|
-
import type { FC } from 'react';
|
|
3
|
-
|
|
4
|
-
import type { MetrikaProps } from './Metrika.props';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* This component allows you to use Yandex.Metrika
|
|
8
|
-
* in your Next.js projects.
|
|
9
|
-
*
|
|
10
|
-
* @since 0.0.1
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* import { Metrika } from 'xenopomp-essentials/next';
|
|
14
|
-
*
|
|
15
|
-
* export default function RootLayout({
|
|
16
|
-
* children,
|
|
17
|
-
* }: {
|
|
18
|
-
* children: React.ReactNode
|
|
19
|
-
* }) {
|
|
20
|
-
* return (
|
|
21
|
-
* <html lang="en">
|
|
22
|
-
* <head>
|
|
23
|
-
* <Metrika id={123456789} />
|
|
24
|
-
* </head>
|
|
25
|
-
* <body>{children}</body>
|
|
26
|
-
* </html>
|
|
27
|
-
* )
|
|
28
|
-
* }
|
|
29
|
-
*
|
|
30
|
-
* @see https://metrika.yandex.ru
|
|
31
|
-
*/
|
|
32
|
-
export const Metrika: FC<MetrikaProps> = ({
|
|
33
|
-
id,
|
|
34
|
-
clickMap = true,
|
|
35
|
-
trackLinks = true,
|
|
36
|
-
accurateTrackBounce = true,
|
|
37
|
-
}) => {
|
|
38
|
-
return (
|
|
39
|
-
<Script
|
|
40
|
-
id='metrika-counter'
|
|
41
|
-
strategy='afterInteractive'
|
|
42
|
-
>
|
|
43
|
-
{` (function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
|
|
44
|
-
m[i].l=1*new Date();
|
|
45
|
-
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
|
|
46
|
-
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
|
|
47
|
-
(window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");
|
|
48
|
-
|
|
49
|
-
ym(${id}, "init", {
|
|
50
|
-
clickmap:${clickMap},
|
|
51
|
-
trackLinks:${trackLinks},
|
|
52
|
-
accurateTrackBounce:${accurateTrackBounce}
|
|
53
|
-
});`}
|
|
54
|
-
</Script>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { FC } from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Adds react-scan to your Next.js application.
|
|
5
|
-
* @constructor
|
|
6
|
-
* @since 0.0.1
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* import { ReactScan } from 'xenopomp-essentials/next';
|
|
10
|
-
*
|
|
11
|
-
* export default function RootLayout({
|
|
12
|
-
* children,
|
|
13
|
-
* }: {
|
|
14
|
-
* children: React.ReactNode
|
|
15
|
-
* }) {
|
|
16
|
-
* return (
|
|
17
|
-
* <html lang="en">
|
|
18
|
-
* <head>
|
|
19
|
-
* <ReactScan />
|
|
20
|
-
* </head>
|
|
21
|
-
* <body>{children}</body>
|
|
22
|
-
* </html>
|
|
23
|
-
* )
|
|
24
|
-
*}
|
|
25
|
-
*/
|
|
26
|
-
export const ReactScan: FC<unknown> = () => {
|
|
27
|
-
return (
|
|
28
|
-
<script
|
|
29
|
-
src='https://unpkg.com/react-scan/dist/auto.global.js'
|
|
30
|
-
async
|
|
31
|
-
/>
|
|
32
|
-
);
|
|
33
|
-
};
|
package/src/next/index.ts
DELETED
package/src/react/hoc/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './jsxDotNotation';
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { FC } from 'react';
|
|
2
|
-
|
|
3
|
-
import type { EmptyObject } from '@/types';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Creates properly type object with jsxDotNotation.
|
|
7
|
-
*
|
|
8
|
-
* @param comp
|
|
9
|
-
* @param rest
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* const FlexComp: FC<PropsWithChildren> = ({ children }) => <div>{children}</div>;
|
|
13
|
-
* const FlexRow: FC<PropsWithChildren & { short?: boolean }> = ({ children }) => (
|
|
14
|
-
* <div>{children}</div>
|
|
15
|
-
* );
|
|
16
|
-
* const FlexCol: FC<PropsWithChildren> = ({ children }) => <div>{children}</div>;
|
|
17
|
-
*
|
|
18
|
-
* const Flex = jsxDotNotation(FlexComp, {
|
|
19
|
-
* Row: FlexRow,
|
|
20
|
-
* Col: FlexCol,
|
|
21
|
-
* });
|
|
22
|
-
*
|
|
23
|
-
* const Am = () => {
|
|
24
|
-
* return (
|
|
25
|
-
* <Flex>
|
|
26
|
-
* <Flex.Row short>
|
|
27
|
-
* <Flex.Col></Flex.Col>
|
|
28
|
-
* </Flex.Row>
|
|
29
|
-
* </Flex>
|
|
30
|
-
* );
|
|
31
|
-
* };
|
|
32
|
-
*/
|
|
33
|
-
export function jsxDotNotation<
|
|
34
|
-
Props = EmptyObject,
|
|
35
|
-
Rest extends Record<string, FC<any>> = EmptyObject,
|
|
36
|
-
>(comp: FC<Props>, rest: Rest) {
|
|
37
|
-
return Object.assign(comp, rest);
|
|
38
|
-
}
|
package/src/react/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './hoc';
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { TSESTree } from '@typescript-eslint/utils';
|
|
2
|
-
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
3
|
-
|
|
4
|
-
const createRule = ESLintUtils.RuleCreator(
|
|
5
|
-
() => 'https://github.com/XenoPOMP/xenopomp-essentials-js',
|
|
6
|
-
);
|
|
7
|
-
|
|
8
|
-
export const deepTypeNamingRule = createRule({
|
|
9
|
-
name: 'deep-types-naming',
|
|
10
|
-
defaultOptions: [],
|
|
11
|
-
meta: {
|
|
12
|
-
type: 'suggestion',
|
|
13
|
-
docs: {
|
|
14
|
-
description: 'Naming convention for deep types.',
|
|
15
|
-
},
|
|
16
|
-
messages: {
|
|
17
|
-
invalidName: 'Deep type name have to follow "TypeDeep" convention.',
|
|
18
|
-
},
|
|
19
|
-
schema: [],
|
|
20
|
-
},
|
|
21
|
-
create(context) {
|
|
22
|
-
function doesNotFollowConvention(name: string): boolean {
|
|
23
|
-
// Word Deep not detected. Stop visitor execution.
|
|
24
|
-
if (!/Deep/.test(name)) {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Word "Deep" is presented inside type declaration name.
|
|
29
|
-
// Checking for convention.
|
|
30
|
-
return !/^\w+Deep/.test(name);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return {
|
|
34
|
-
'TSInterfaceDeclaration, TSTypeAliasDeclaration': function (
|
|
35
|
-
node: TSESTree.TSInterfaceDeclaration | TSESTree.TSTypeAliasDeclaration,
|
|
36
|
-
) {
|
|
37
|
-
const { id } = node;
|
|
38
|
-
|
|
39
|
-
if (doesNotFollowConvention(id.name)) {
|
|
40
|
-
// Report that problem is detected.
|
|
41
|
-
context.report({
|
|
42
|
-
messageId: 'invalidName',
|
|
43
|
-
node: node.id,
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
},
|
|
49
|
-
});
|
package/src/schemas/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './import-meta.schema';
|
package/src/types/aliases/Fn.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Simple alias for creating function types. You can use it for type guards
|
|
3
|
-
* as representation of any function, also you can create cleaner type declarations
|
|
4
|
-
* for functions.
|
|
5
|
-
*
|
|
6
|
-
* @since 0.0.1
|
|
7
|
-
* @example
|
|
8
|
-
* type MyFn = Fn<[a: string, b: string], string>;
|
|
9
|
-
*/
|
|
10
|
-
export type Fn<Args extends any[] = any[], Res = unknown> = (
|
|
11
|
-
...args: Args
|
|
12
|
-
) => Res;
|
package/src/types/index.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
type ParamObj<P extends string> = Record<P, string>;
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Represents Next.js routing params.
|
|
5
|
-
* @since 0.0.1
|
|
6
|
-
*/
|
|
7
|
-
export interface NextParams<P extends string> {
|
|
8
|
-
params: ParamObj<P>;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Represents Next.js routing search params.
|
|
13
|
-
* @since 0.0.1
|
|
14
|
-
*/
|
|
15
|
-
export interface NextSearchParams<P extends string> {
|
|
16
|
-
searchParams: ParamObj<P>;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* This type describes Next error page params.
|
|
21
|
-
* @since 0.0.1
|
|
22
|
-
*/
|
|
23
|
-
export interface NextErrorParams<E extends Error = any> {
|
|
24
|
-
error: E;
|
|
25
|
-
reset: () => void;
|
|
26
|
-
}
|
package/src/types/next/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './NextParams';
|
package/src/types/react/AnyFc.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { FC, ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
import type { ReplaceReturnType } from '@/types';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Same as **FC** (or FunctionalComponent), but it returns Promise.
|
|
7
|
-
*
|
|
8
|
-
* @since 0.0.1
|
|
9
|
-
* @example
|
|
10
|
-
* const Header: AsyncFC<HeaderProps> = async ({}) => {
|
|
11
|
-
* // Do async stuff here...
|
|
12
|
-
*
|
|
13
|
-
* return <div></div>;
|
|
14
|
-
* };
|
|
15
|
-
*/
|
|
16
|
-
export type AsyncFC<T = unknown> = ReplaceReturnType<FC<T>, Promise<ReactNode>>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type that represents data-{attr} keys.
|
|
3
|
-
*/
|
|
4
|
-
type Attribute = `data-${string}`;
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Matches any proper data-{attr} keys.
|
|
8
|
-
*/
|
|
9
|
-
type DataAttributeShape = Record<Attribute, any>;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Represents React`s data-{attr} properties for components.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* type AdditionalAttributes = DataAttributes<{ 'data-disabled': boolean }>;
|
|
16
|
-
*
|
|
17
|
-
* const attrs: AdditionalAttributes = {
|
|
18
|
-
* 'data-disabled': false, // this attr is required
|
|
19
|
-
* };
|
|
20
|
-
*/
|
|
21
|
-
export type DataAttributes<Shape extends DataAttributeShape> = Shape;
|