Merge pull request #1 from instat/project-configuration

keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Andrey Razdorskiy 6 years ago committed by GitHub
commit 4af72b6acd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      .eslintignore
  2. 84
      .eslintrc
  3. 22
      codegen.yml
  4. 41
      package.json
  5. 8
      src/api/operations/User/queries.graphql
  6. 3
      src/api/operations/User/queries.tsx
  7. 1
      src/api/requests/index.tsx
  8. 1
      src/api/requests/login.tsx
  9. 1
      src/config/index.tsx
  10. 2
      src/config/routes.tsx
  11. 7
      src/features/Login/index.tsx
  12. 1
      src/helpers/index.tsx
  13. 1
      src/hooks/index.tsx
  14. 1
      src/hooks/usePageId.tsx
  15. 13
      src/index.tsx
  16. 3
      src/types/index.tsx

@ -0,0 +1,4 @@
src/types/*
src/api/operations/*/operation.tsx
src/react-app-env.d.ts
src/serviceWorker.ts

@ -0,0 +1,84 @@
{
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"airbnb",
"react-app"
],
"plugins": [
"sort-destructure-keys",
"typescript-sort-keys",
"postro4no"
],
"rules": {
"@typescript-eslint/array-type": [
"warn",
{ "default" : "generic" }
],
"@typescript-eslint/indent": ["warn", 2],
"@typescript-eslint/member-delimiter-style": ["warn", {
"multiline": {
"delimiter": "comma",
"requireLast": true
},
"singleline": {
"delimiter": "comma",
"requireLast": false
}
}],
"import/extensions": [
"warn",
"never",
{
"svg": "always",
"css": "always",
"scss": "always"
}
],
"import/no-duplicates": "warn",
"import/no-extraneous-dependencies": [
"warn",
{ "devDependencies": ["src/setupTests.ts"] }
],
"jsx-quotes": [
"warn",
"prefer-single"
],
"no-param-reassign": [
"warn",
{
"props": true,
"ignorePropertyModificationsFor": ["self", "acc"]
}
],
"postro4no/function-args": "warn",
"postro4no/import": "warn",
"postro4no/object-props": "warn",
"react/jsx-filename-extension": [
"warn",
{ "extensions": [".tsx"] }
],
"react/jsx-indent": ["warn", 2],
"sort-destructure-keys/sort-destructure-keys": [
1,
{ "caseSensitive": false }
],
"sort-keys": [
"warn",
"asc", {
"caseSensitive": true,
"natural": true
}
],
"typescript-sort-keys/interface": 1,
"typescript-sort-keys/string-enum": 1,
"camelcase": "off",
"import/no-unresolved": "off",
"import/prefer-default-export": "off",
"indent": "off",
"no-unused-vars": "off",
"react/jsx-one-expression-per-line": "off",
"semi": "off"
}
}

@ -0,0 +1,22 @@
overwrite: true
schema: ''
documents: src/api/operations/**/*.graphql
generates:
src/types/index.tsx:
plugins:
- typescript
src/:
preset:
near-operation-file
presetConfig:
extension: .tsx
baseTypesPath: types
plugins:
- typescript-operations
- typescript-react-apollo
config:
withComponent: false
withHOC: false
withHooks: true
config:
typesPrefix: T

@ -3,12 +3,21 @@
"version": "0.1.0",
"private": true,
"scripts": {
"prestart ": "yarn generate",
"start": "react-scripts start",
"build": "GENERATE_SOURCEMAP=false react-scripts build && gzipper --verbose ./build",
"test": "react-scripts test --passWithNoTests --watchAll=false",
"eject": "react-scripts eject"
"test": "react-scripts test --testMatch '**/__tests__/*' --passWithNoTests --watchAll=false",
"test:watch": "react-scripts test --testMatch '**/__tests__/*'",
"eject": "react-scripts eject",
"generate": "graphql-codegen --config codegen.yml",
"lint": "eslint 'src/**/*.{ts,tsx}'"
},
"dependencies": {
"@apollo/react-common": "^3.1.4",
"@apollo/react-hooks": "^3.1.5",
"apollo-boost": "^0.4.9",
"graphql": "^15.0.0",
"lodash": "^4.17.15",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1"
@ -16,21 +25,35 @@
"devDependencies": {
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"@graphql-codegen/cli": "1.15.0",
"@graphql-codegen/import-types-preset": "^1.15.0",
"@graphql-codegen/near-operation-file-preset": "^1.15.0",
"@graphql-codegen/typescript": "1.15.0",
"@graphql-codegen/typescript-operations": "1.15.0",
"@graphql-codegen/typescript-react-apollo": "1.15.0",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"@types/jest": "^24.0.0",
"@types/lodash": "^4.14.154",
"@types/node": "^12.0.0",
"@types/react": "^16.9.0",
"@types/react-dom": "^16.9.0",
"commitizen": "^4.1.2",
"eslint": "6.8.0",
"eslint-config-airbnb": "18.1.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-postro4no": "^0.0.7",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-hooks": "2.5.0",
"eslint-plugin-sort-destructure-keys": "^1.3.4",
"eslint-plugin-typescript-sort-keys": "^1.2.0",
"gzipper": "^3.7.0",
"husky": "^4.2.5",
"lint-staged": "^10.2.7",
"typescript": "^3.9.3"
},
"eslintConfig": {
"extends": "react-app"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
@ -38,10 +61,16 @@
},
"husky": {
"hooks": {
"pre-commit": "npm test",
"pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"lint-staged": {
"src/**/*.{ts,tsx}": [
"npm run lint -- --max-warnings 0",
"npm run test -- --findRelatedTests"
]
},
"browserslist": {
"production": [
">0.2%",

@ -0,0 +1,8 @@
query User {
__schema {
types {
name
kind
}
}
}

@ -0,0 +1,3 @@
// autgenerated using https://graphql-code-generator.com/
export {}

@ -0,0 +1 @@
export * from './login'

@ -0,0 +1 @@
export const login = () => {}

@ -0,0 +1 @@
export * from './routes'

@ -0,0 +1,2 @@
export const API_ROOT = ''
export const GRAPHQL = `${API_ROOT}/graphql`

@ -0,0 +1,7 @@
import React from 'react'
export const Login = () => (
<div>
Login page
</div>
)

@ -0,0 +1 @@
export * from './usePageId'

@ -0,0 +1 @@
export const usePageId = () => {}

@ -1,15 +1,24 @@
import React from 'react'
import ReactDOM from 'react-dom'
import ApolloClient from 'apollo-boost'
import { ApolloProvider } from '@apollo/react-hooks'
import { GRAPHQL } from 'config'
import { App } from 'features/App'
import * as serviceWorker from './serviceWorker'
const client = new ApolloClient({
uri: GRAPHQL,
})
ReactDOM.render(
<React.StrictMode>
<App />
<ApolloProvider client={client}>
<App />
</ApolloProvider>
</React.StrictMode>,
document.getElementById('root')
document.getElementById('root'),
)
// If you want your app to work offline and load faster, you can change

@ -0,0 +1,3 @@
// autgenerated using https://graphql-code-generator.com/
export {}
Loading…
Cancel
Save