Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions YandexOuth/.husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm test
3 changes: 3 additions & 0 deletions YandexOuth/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.eslintrc.json
.eslint.config.js
.eslint.config.mjs
7 changes: 7 additions & 0 deletions YandexOuth/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"singleQuote": true,
"trailingComma": "all",
"printWidth": 80,
"tabWidth": 2,
"useTabs": false
}
4 changes: 4 additions & 0 deletions YandexOuth/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
56 changes: 56 additions & 0 deletions YandexOuth/dist/assets/index-IJt9-ood.js

Large diffs are not rendered by default.

Binary file added YandexOuth/dist/favicon.ico
Binary file not shown.
93 changes: 93 additions & 0 deletions YandexOuth/dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="/favicon.ico" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover"
/>
<!--<meta http-equiv="X-UA-Compatible" content="ie=edge" />-->
/
<!--<meta name="theme-color" content="#000000" />-->
<meta name="description" content="React Application" />
<!--<script src="https://yastatic.net/s3/passport-sdk/autofill/v1/sdk-suggest-with-polyfills-latest.js"></script>
<script src="https://yastatic.net/s3/passport-sdk/autofill/v1/sdk-suggest-token-with-polyfills-latest.js"></script>
-->
<!--
<meta
http-equiv="Content-Security-Policy"
X-Frame-Options="SAMEORIGIN"
content="default-src 'self' https: ; object-src 'none'"
/>
-->
<title>React</title>
<script type="module" crossorigin src="/assets/index-IJt9-ood.js"></script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
<!--
<!doctype html>
<html lang="ru">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, shrink-to-fit=no, viewport-fit=cover"
/>
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<style>
html,
body {
background: #eee;
}
</style>
<script src="https://yastatic.net/s3/passport-sdk/autofill/v1/sdk-suggest-with-polyfills-latest.js"></script>
<script src="https://yastatic.net/s3/passport-sdk/autofill/v1/sdk-suggest-token-with-polyfills-latest.js"></script>
</head>

<body>
<script>
window.onload = function () {
window.YaAuthSuggest.init(
{
client_id: 'd9ff50ec155f4aed98859bcf27710588',
response_type: 'token',
redirect_uri: 'http://localhost:3000/auth',
},
'http://localhost:3000',
{
view: 'button',
parentId: 'container',
buttonView: 'main',
buttonTheme: 'light',
buttonSize: 'm',
buttonBorderRadius: 0,
},
)
.then(function (result) {
return result.handler();
})
.then(function (data) {
console.log('Сообщение с токеном: ', data);
document.body.innerHTML += `Сообщение с токеном: ${JSON.stringify(data)}`;
})
.catch(function (error) {
console.log('Что-то пошло не так: ', error);
document.body.innerHTML += `Что-то пошло не так: ${JSON.stringify(error)}`;
});
};
</script>
<script>
window.onload = function () {
window.YaSendSuggestToken('http://localhost:3000', {
kek: true,
});
};
</script>
</body>
</html>
-->
Expand Down
198 changes: 198 additions & 0 deletions YandexOuth/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
import { defineConfig, globalIgnores } from 'eslint/config';
import checkFile from 'eslint-plugin-check-file';
import globals from 'globals';
import { fixupConfigRules } from '@eslint/compat';
import tsParser from '@typescript-eslint/parser';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

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 defineConfig([
globalIgnores([
'node_modules/*',
'.pnp',
'**/.pnp.js',
'./coverage',
'build',
'**/.DS_Store',
'**/.env.local',
'**/.env.development.local',
'**/.env.test.local',
'**/.env.production.local',
'**/npm-debug.log*',
'**/yarn-debug.log*',
'**/yarn-error.log*',
]),
{
extends: compat.extends('eslint:recommended'),

plugins: {
'check-file': checkFile,
},

languageOptions: {
globals: {
...globals.node,
},

ecmaVersion: 'latest',
sourceType: 'module',
},
},
{
files: ['**/*.ts', '**/*.tsx'],

extends: fixupConfigRules(
compat.extends(
'eslint:recommended',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:import/typescript',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:jsx-a11y/recommended',
'plugin:prettier/recommended',
'plugin:vitest/legacy-recommended',
),
),

languageOptions: {
globals: {
...globals.browser,
...globals.node,
},

parser: tsParser,
},

settings: {
react: {
version: 'detect',
},

'import/resolver': {
typescript: {},
},
},

rules: {
'import/no-restricted-paths': [
'error',
{
zones: [
{
target: './src/features/auth',
from: './src/features',
except: ['./auth'],
},
{
target: './src/features/comments',
from: './src/features',
except: ['./comments'],
},
{
target: './src/features/users',
from: './src/features',
except: ['./users'],
},
{
target: './src/features',
from: './src/app',
},
{
target: [
'./src/components',
'./src/hooks',
'./src/lib',
'./src/types',
'./src/utils',
],

from: ['./src/features', './src/app'],
},
],
},
],

'import/no-cycle': 'error',
'linebreak-style': ['error', 'unix'],
'react/prop-types': 'off',

'import/order': [
'error',
{
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'object',
],
'newlines-between': 'always',

alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],

'import/default': 'off',
'import/no-named-as-default-member': 'off',
'import/no-named-as-default': 'off',
'react/react-in-jsx-scope': 'off',
'jsx-a11y/anchor-is-valid': 'off',
'@typescript-eslint/no-unused-vars': ['error'],
'@typescript-eslint/explicit-function-return-type': ['off'],
'@typescript-eslint/explicit-module-boundary-types': ['off'],
'@typescript-eslint/no-empty-function': ['off'],
'@typescript-eslint/no-explicit-any': ['off'],

'prettier/prettier': [
'error',
{},
{
usePrettierrc: true,
},
],

'check-file/filename-naming-convention': [
'error',
{
'**/*.{ts,tsx}': 'KEBAB_CASE',
},
{
ignoreMiddleExtensions: true,
},
],
},
},
{
files: ['src/**/!(__tests__)/*'],

plugins: {
'check-file': checkFile,
},

rules: {
'check-file/folder-naming-convention': [
'error',
{
'**/*': 'KEBAB_CASE',
},
],
},
},
]);
Loading