Skip to content

Commit

Permalink
Update the template according to changes done in [email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
heyqbnk committed May 11, 2024
1 parent 4e0a5a4 commit 00c245b
Show file tree
Hide file tree
Showing 23 changed files with 2,300 additions and 2,809 deletions.
118 changes: 24 additions & 94 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,106 +1,36 @@
function regexp(regex) {
return [
new RegExp(regex.source + '.*[^\\u0000]$').source,
regex.source,
];
}

module.exports = {
env: {
browser: true,
es2021: true
},
extends: [
'airbnb',
'airbnb-typescript',
'airbnb/hooks',
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended'
],
overrides: [
{
env: {
node: true
},
files: [
'.eslintrc.{js,cjs}'
],
parserOptions: {
'sourceType': 'script'
}
}
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
sourceType: 'module',
ecmaVersion: 'latest',
sourceType: 'module'
},
plugins: [
'simple-import-sort',
'@typescript-eslint',
'react'
],
rules: {
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/indent': 0,
// Sometimes this rule decreases readability.
'arrow-body-style': 0,
'consistent-return': 0,
'function-paren-newline': 0,

// We use special module resolution, that's why we need extensions.
'import/extensions': 0,
'import/first': 'error',
'import/newline-after-import': 'error',
// It's okay to use cycle imports.
'import/no-cycle': 0,
'import/no-duplicates': 'error',
'import/no-empty-named-blocks': 'error',
'import/no-mutable-exports': 0,
'import/no-self-import': 'error',
'import/no-unresolved': 0,
'import/order': 0,

// We don't use default exports anywhere.
'import/prefer-default-export': 0,

// We select line endings depending on current OS.
// See: https://stackoverflow.com/q/39114446/2771889
'linebreak-style': ['error', (process.platform === 'win32' ? 'windows' : 'unix')],
'no-await-in-loop': 0,
'no-console': 0,
'no-continue': 0,
'no-multiple-empty-lines': ['error', {
max: 1,
maxEOF: 1,
maxBOF: 0,
}],
'no-nested-ternary': 0,
// Sometimes we need to write "void promise".
'no-void': 0,
'no-duplicate-imports': 'error',
'object-curly-newline': ['error', { consistent: true }],

'operator-linebreak': 0,

// We can implement components the way we want.
// https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/function-component-definition.md
'react/function-component-definition': 0,
'react/react-in-jsx-scope': 0,
'react/require-default-props': 0,
'react/state-in-constructor': 0,
'react/jsx-props-no-spreading': 0,
'react/no-array-index-key': 0,

// Simple sort.
// https://github.com/lydell/eslint-plugin-simple-import-sort?tab=readme-ov-file#custom-grouping
'simple-import-sort/exports': 'error',
'simple-import-sort/imports': ['error', {
groups: [
// Node.js builtins prefixed with `node:`.
// node:fs
regexp(/^node:/),

// Packages.
// react
regexp(/^@?\w/),

// Tsconfig alias.
// ~/helpers
regexp(/^~\//),

// Parent imports.
// ../Typography.js
regexp(/^\.\.\//),

// Current folder imports.
// ./utils.js
regexp(/^\.\/.+\.(?!s?css)/),

// Styles.
// ./Typography.css
[/\.css$/.source],
],
}],
},
}
};
13 changes: 9 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="theme-color" content="#000000"/>
<title>Vite + React + TS</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet">
<link
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"
rel="stylesheet"
>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
<script src="/src/index.tsx" type="module"></script>
</body>
</html>
39 changes: 19 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "my-application",
"name": "reactjs-template",
"private": true,
"version": "0.0.1",
"type": "module",
Expand All @@ -14,31 +14,30 @@
"predeploy": "pnpm run build"
},
"dependencies": {
"@tma.js/react-router-integration": "^0.1.2",
"@tma.js/sdk": "^1.5.1",
"@tma.js/sdk-react": "^2.0.1",
"@tonconnect/ui-react": "^2.0.0",
"@tma.js/react-router-integration": "^1.0.0",
"@tma.js/sdk": "^2.0.0",
"@tma.js/sdk-react": "^2.1.0",
"@tonconnect/ui-react": "^2.0.2",
"eruda": "^3.0.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.22.3"
"eslint": "8.57.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.23.0"
},
"devDependencies": {
"@types/node": "^20.10.0",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@eslint/js": "^9.2.0",
"@types/node": "^20.12.11",
"@types/react": "^18.3.1",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"@vitejs/plugin-react-swc": "^3.6.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^18.0.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-simple-import-sort": "^12.0.0",
"gh-pages": "^6.1.1",
"typescript": "^5.2.2",
"vite": "^5.1.5",
"globals": "^15.2.0",
"typescript": "^5.4.5",
"typescript-eslint": "^7.8.0",
"vite": "^5.2.11",
"vite-tsconfig-paths": "^4.3.2"
}
}
Loading

0 comments on commit 00c245b

Please sign in to comment.