Skip to content

Commit

Permalink
feat: initial commit, setup react project with vite, typescript, tail…
Browse files Browse the repository at this point in the history
…wind, eslint, prettier, husky
  • Loading branch information
verkhohliad committed Sep 12, 2024
0 parents commit 30ef60d
Show file tree
Hide file tree
Showing 54 changed files with 11,483 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .cz.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"path": "cz-conventional-changelog"
}
207 changes: 207 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
{
"root": true,
"env": {
"browser": true,
"node": true,
"es2021": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
},
"projectService": true,
"tsconfigRootDir": "./",
"project": ["tsconfig.json"]
},
"plugins": ["react-prefer-function-component"],
"extends": [
"eslint:all",
"plugin:@typescript-eslint/all",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:react/all",
"plugin:jsx-a11y/recommended",
"airbnb",
"airbnb-typescript",
"airbnb/hooks",
"plugin:react/jsx-runtime",
"plugin:unicorn/all",
"plugin:react-prefer-function-component/recommended",
"prettier"
],
"rules": {
"import/prefer-default-export": "off",

"no-dupe-else-if": "error",
"no-promise-executor-return": "error",
"no-unreachable-loop": "error",
"no-useless-backreference": "error",
"require-atomic-updates": "error",
"default-case-last": "error",
"grouped-accessor-pairs": "error",
"no-constructor-return": "error",
"no-implicit-coercion": "error",
"prefer-regex-literals": "error",
"capitalized-comments": "error",
"no-restricted-syntax": [
"error",
{
"selector": "ForInStatement",
"message": "for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array."
},
{
"selector": "LabeledStatement",
"message": "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand."
},
{
"selector": "WithStatement",
"message": "`with` is disallowed in strict mode because it makes code impossible to predict and optimize."
}
],
"no-void": "off",

"@typescript-eslint/padding-line-between-statements": "off",
"@typescript-eslint/prefer-enum-initializers": "off",
"@typescript-eslint/prefer-readonly-parameter-types": "off",
"@typescript-eslint/prefer-regexp-exec": "off",
"@typescript-eslint/no-magic-numbers": [
"error",
{
"ignoreEnums": true,
"ignore": [0],
"enforceConst": true,
"detectObjects": true
}
],
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/init-declarations": "off",
"@typescript-eslint/no-confusing-void-expression": [
"error",
{ "ignoreArrowShorthand": true }
],
"@typescript-eslint/non-nullable-type-assertion-style": "off",
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/no-implicit-any-catch": "off",
"@typescript-eslint/member-ordering": "off",
"@typescript-eslint/prefer-includes": "off",
"@typescript-eslint/no-restricted-imports": "off",

"import/no-deprecated": "error",
"import/order": "off",
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": [
"cypress.config.ts",
"vite.config.ts",
"src/setupTests.ts",
"src/testUtils.tsx",
"src/mocks/**",
"**/__tests__/*.{ts,tsx}"
]
}
],

"react/no-did-update-set-state": "off",
"react/no-find-dom-node": "off",
"react/no-is-mounted": "off",
"react/no-redundant-should-component-update": "off",
"react/no-render-return-value": "off",
"react/no-string-refs": "off",
"react/no-this-in-sfc": "off",
"react/no-will-update-set-state": "off",
"react/prefer-es6-class": "off",
"react/no-unused-state": "off",
"react/prefer-stateless-function": "off",
"react/require-render-return": "off",
"react/sort-comp": "off",
"react/state-in-constructor": "off",
"react/static-property-placement": "off",

"react/boolean-prop-naming": [
"error",
{
"validateNested": true
}
],
"react/function-component-definition": [
"error",
{
"namedComponents": "function-declaration"
}
],
"react/no-unstable-nested-components": "error",
"react/jsx-handler-names": [
"error",
{
"eventHandlerPrefix": "on",
"eventHandlerPropPrefix": "on",
"checkLocalVariables": true,
"checkInlineFunction": true
}
],
"react/jsx-key": "error",
"react/jsx-no-bind": [
"error",
{
"ignoreRefs": false,
"allowArrowFunctions": true,
"allowFunctions": true,
"allowBind": false,
"ignoreDOMComponents": false
}
],
"react/jsx-no-constructed-context-values": "error",
"react/jsx-no-script-url": "error",
"react/jsx-no-useless-fragment": "error",

"unicorn/filename-case": [
"error",
{
"cases": {
"camelCase": true,
"pascalCase": true
}
}
],
"unicorn/no-nested-ternary": ["error"]
},
"settings": {
"react": {
"version": "detect"
}
},
"overrides": [
{
"files": ["src/**/*.ts?(x)"],
"parserOptions": {
"project": ["./tsconfig.json"]
}
},
{
"files": ["vite.config.ts", "cypress.config.ts", "tailwind.config.ts"],
"parserOptions": {
"project": ["./tsconfig.node.json"]
}
},
{
"files": ["**/__tests__/**/*.ts?(x)"],
"extends": ["plugin:testing-library/react"],
"rules": {
"@typescript-eslint/no-magic-numbers": ["off"],
"testing-library/no-await-sync-events": [
"error",
{
"eventModules": ["fire-event"]
}
],
"testing-library/no-manual-cleanup": "error",
"testing-library/prefer-explicit-assert": "error",
"testing-library/prefer-user-event": "error"
}
}
]
}
30 changes: 30 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CodeQL

on:
push:
branches: [main]
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
analyze:
runs-on: ubuntu-latest

permissions:
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: javascript

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
38 changes: 38 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Test

on:
push:
branches: [main]
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
Test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: pnpm/[email protected]
with:
version: latest

- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'

- name: Install dependencies
run: pnpm i && pnpm cypress install

- name: Validate
run: pnpm run-p lint test:ci test:e2e:ci
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}

- name: Upload coverage
uses: codecov/codecov-action@v4
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules
.DS_Store
dist
dist-ssr
*.local
.eslintcache
coverage
.nyc_output
.stylelintcache
cypress/videos
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

pnpm lint-staged
5 changes: 5 additions & 0 deletions .idea/.gitignore

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

12 changes: 12 additions & 0 deletions .idea/circles-explorer.iml

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

59 changes: 59 additions & 0 deletions .idea/codeStyles/Project.xml

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

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

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

7 changes: 7 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

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

Loading

0 comments on commit 30ef60d

Please sign in to comment.