Skip to content

Commit

Permalink
Merge pull request #2 from trustfractal/feature/v1
Browse files Browse the repository at this point in the history
Feature/v1
  • Loading branch information
tiagofragoso authored Jul 15, 2022
2 parents af2f3f4 + 23f350c commit cee602c
Show file tree
Hide file tree
Showing 60 changed files with 15,340 additions and 31,207 deletions.
267 changes: 267 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
{
"env": {
"browser": true,
"node": true,
"es6": true,
"es2020": true
},
"globals": {
"jsdom": true,
"jsSDK": true
},
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
}
},
"plugins": [
"react",
"babel"
],
"extends": [
"eslint:recommended",
"plugin:react/recommended"
],
"settings": {
"react": {
"version": "16.14"
}
},
"rules": {
// Possible Errors
"no-misleading-character-class": "error",
"no-template-curly-in-string": "error",
"no-console": "warn",
// Best practices
"array-callback-return": "error",
"consistent-return": "error",
"default-case": "error",
"eqeqeq": "error",
"no-eq-null": "error",
"no-param-reassign": "error",
"no-return-assign": "error",
"no-return-await": "error",
"babel/no-unused-expressions": "error",
"require-await": "error",
"radix": "error",
// Variables
"no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
],
"no-shadow-restricted-names": "error",
// Stylistic issues
"array-bracket-spacing": "error",
"block-spacing": [
"error",
"always"
],
"comma-dangle": [
"error",
{
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "always-multiline"
}
],
"comma-spacing": [
"error",
{
"before": false,
"after": true
}
],
"comma-style": [
"error",
"last"
],
"computed-property-spacing": [
"error",
"never"
],
"eol-last": [
"error",
"always"
],
"indent": [
"error",
2,
{
"SwitchCase": 1,
"ignoredNodes": [
"TemplateLiteral"
]
}
],
"jsx-quotes": [
"error",
"prefer-double"
],
"key-spacing": [
"error",
{
"beforeColon": false
}
],
"keyword-spacing": "error",
"max-len": [
"error",
{
"code": 140,
"ignoreTemplateLiterals": true,
"ignoreUrls": true,
"ignoreStrings": true
}
],
"new-parens": "error",
"no-mixed-operators": "error",
"no-multiple-empty-lines": [
"error",
{
"max": 1,
"maxEOF": 0
}
],
"no-nested-ternary": "error",
"no-trailing-spaces": "error",
"no-tabs": "error",
"object-curly-spacing": [
"error",
"always"
],
"prefer-object-spread": "error",
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always",
{
"omitLastInOneLineBlock": true
}
],
"semi-spacing": [
"error",
{
"before": false,
"after": true
}
],
"space-before-blocks": [
"error",
"always"
],
"space-before-function-paren": [
"error",
{
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
}
],
"space-in-parens": "error",
"space-infix-ops": "error",
"space-unary-ops": [
"error",
{
"words": true,
"nonwords": false
}
],
"spaced-comment": [
"error",
"always",
{
"exceptions": [
"-"
]
}
],
"switch-colon-spacing": [
"error",
{
"after": true,
"before": false
}
],
// ECMAScript 6
"arrow-spacing": "error",
"arrow-body-style": [
"error",
"as-needed"
],
"arrow-parens": [
"error",
"always"
],
"no-duplicate-imports": "error",
"no-var": "error",
"prefer-const": [
"error",
{
"destructuring": "all"
}
],
"prefer-template": "error",
"template-curly-spacing": "off",
// React
"react/prop-types": "off",
"react/no-unescaped-entities": "off",
"no-import-assign": "warn"
},
"overrides": [
{
"files": [
"src/**/*.ts",
"src/**/*.tsx"
],
"excludedFiles": [
"src/components/ui/**/*.ts",
"src/components/ui/**/*.tsx"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true,
"modules": true
},
"sourceType": "module",
"project": "./tsconfig.json",
"createDefaultProgram": true
},
"plugins": [
"@typescript-eslint",
"react",
"babel"
],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"rules": {
"@typescript-eslint/no-floating-promises": "warn",
"@typescript-eslint/no-unsafe-assignment": "warn",
"@typescript-eslint/no-unsafe-member-access": "warn",
"@typescript-eslint/no-unsafe-call": "warn",
"@typescript-eslint/no-misused-promises": "warn",
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
]
}
}
]
}
68 changes: 68 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Pull request

on:
pull_request:
push:
branches: master

# This will cancel previous jobs in case of new push.
concurrency:
group: ${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.13.1

- name: Find yarn cache location
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: JS package cache
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install packages
run: yarn install --pure-lockfile

- name: Run audit
run: yarn audit-ci

eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.13.1

- name: Find yarn cache location
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: JS package cache
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install packages
run: yarn install --pure-lockfile

- name: Run linters
run: yarn lint:js
Loading

0 comments on commit cee602c

Please sign in to comment.