-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit fc9e103
Showing
16 changed files
with
11,793 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: 1 | ||
update_configs: | ||
- package_manager: 'javascript' | ||
directory: '/' | ||
update_schedule: 'weekly' | ||
|
||
# Apply default reviewer and label to created | ||
# pull requests | ||
default_reviewers: | ||
- 'digitals' | ||
default_labels: | ||
- 'dependencies' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
tab_width = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
max_line_length = 80 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended', | ||
'prettier/@typescript-eslint', | ||
'plugin:prettier/recommended', | ||
'plugin:sonarjs/recommended', | ||
'plugin:promise/recommended', | ||
], | ||
parserOptions: { | ||
project: './tsconfig.json', | ||
tsconfigRootDir: '.', | ||
ecmaVersion: 2018, | ||
sourceType: 'module', | ||
useJSXTextNode: true, | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
plugins: ['@typescript-eslint', 'sonarjs', 'promise', 'import'], | ||
globals: { | ||
Atomics: 'readonly', | ||
SharedArrayBuffer: 'readonly', | ||
__DEV__: true, | ||
}, | ||
ignorePatterns: ['node_modules/', 'dist'], | ||
rules: { | ||
'@typescript-eslint/member-delimiter-style': 0, | ||
'@typescript-eslint/no-empty-function': 0, | ||
'@typescript-eslint/no-explicit-any': 0, | ||
'import/prefer-default-export': 0, | ||
'import/no-named-as-default': 0, | ||
'import/no-unresolved': 0, | ||
'import/no-extraneous-dependencies': 0, | ||
'import/extensions': 0, | ||
'import/order': [ | ||
'error', | ||
{ | ||
pathGroups: [ | ||
{ | ||
pattern: '~/**', | ||
group: 'parent', | ||
position: 'before', | ||
}, | ||
{ | ||
pattern: '@*/**', | ||
group: 'external', | ||
position: 'after', | ||
}, | ||
], | ||
pathGroupsExcludedImportTypes: ['builtin'], | ||
}, | ||
], | ||
'jsx-a11y/no-noninteractive-element-interactions': 'off', | ||
'jsx-a11y/no-static-element-interactions': 'off', | ||
'jsx-a11y/click-events-have-key-events': 'off', | ||
'jsx-a11y/no-autofocus': 'off', | ||
'class-methods-use-this': 0, | ||
'no-nested-ternary': 0, | ||
'consistent-return': 0, | ||
'array-callback-return': 0, | ||
'no-duplicate-imports': 'error', | ||
'promise/prefer-await-to-callbacks': 'error', | ||
'promise/prefer-await-to-then': 'error', | ||
'react/state-in-constructor': 'off', | ||
}, | ||
settings: { | ||
react: { | ||
version: 'detect', | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
## Descrição do PR | ||
|
||
<!-- explicação do que foi feito --> | ||
|
||
## Tipo de mudança | ||
|
||
- [ ] Nova feature (mudança non-breaking que adiciona uma funcionalidade) | ||
- [ ] Bug fix (mudança non-breaking que conserta um problema) | ||
- [ ] Breaking change (ajuste ou funcionalidade que pode causar uma quebra numa funcionalidade já existente) | ||
|
||
## Checklist 🚨 | ||
|
||
- [ ] Meu código segue o code style da Builders | ||
- [ ] Testado usando Yalc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: check | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [master] | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
- uses: actions/cache@v2 | ||
id: yarn-cache | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: Install | ||
uses: borales/actions-yarn/@v2.0.0 | ||
with: | ||
cmd: install | ||
- name: Local Linter | ||
uses: borales/actions-yarn/@v2.0.0 | ||
with: | ||
cmd: lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Publish | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
name: Publish to npm | ||
steps: | ||
- uses: actions/checkout@v2 | ||
# Setup .npmrc file to publish to npm | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: '14.x' | ||
registry-url: 'https://registry.npmjs.org/' | ||
- name: Install | ||
run: npm install | ||
# Publish to npm | ||
- name: Publish | ||
run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | ||
# Setup .npmrc file to publish to GitHub Packages | ||
- uses: actions/setup-node@v1 | ||
with: | ||
registry-url: 'https://npm.pkg.github.com' | ||
scope: '@platformbuilders' | ||
# Publish to GitHub Packages | ||
- run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
# See https://help.github.com/ignore-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
node_modules | ||
|
||
# builds | ||
build | ||
dist | ||
.rpt2_cache | ||
|
||
# misc | ||
.DS_Store | ||
.env | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
semi: true, | ||
trailingComma: 'all', | ||
singleQuote: true, | ||
printWidth: 80, | ||
tabWidth: 2, | ||
arrowParens: 'always', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
![check](https://github.com/platformbuilders/template-hooks/workflows/check/badge.svg) | ||
|
||
# @platformbuilders/use-hooks | ||
|
||
## Hooks Template | ||
|
||
É só renomear o pacote, criar seu hooks e publicar para ser feliz 🙌 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ | ||
"name": "@platformbuilders/use-hooks", | ||
"version": "0.0.1", | ||
"description": "", | ||
"author": "Platform Builders <[email protected]>", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/platformbuilders/template-hooks.git" | ||
}, | ||
"main": "dist/index.js", | ||
"module": "dist/index.es.js", | ||
"types": "dist/index.d.ts", | ||
"engines": { | ||
"node": ">=8", | ||
"npm": ">=5" | ||
}, | ||
"scripts": { | ||
"test": "cross-env CI=1 react-scripts test --env=jsdom", | ||
"test:watch": "react-scripts test --env=jsdom", | ||
"build": "rm -rf dist && rollup -c", | ||
"start": "rollup -c -w", | ||
"prepare": "npm run build", | ||
"pretty": "prettier --config ./.prettierrc.js --write \"src/**/*.{js,jsx,ts,tsx,json}\"", | ||
"lint": "tsc && eslint '*/**/*.{ts, tsx}' --fix" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged", | ||
"pre-push": "lint-staged", | ||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS" | ||
} | ||
}, | ||
"lint-staged": { | ||
"**/*.ts?(x)": [ | ||
"yarn pretty", | ||
"yarn lint", | ||
"git add ." | ||
] | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.13.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.11.4", | ||
"@babel/runtime": "^7.11.2", | ||
"@testing-library/react-hooks": "^3.4.1", | ||
"@types/jest": "^26.0.10", | ||
"@types/react": "^16.9.48", | ||
"@typescript-eslint/eslint-plugin": "^3.10.1", | ||
"@typescript-eslint/parser": "^3.10.1", | ||
"cross-env": "^7.0.2", | ||
"eslint": "^7.7.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-import": "^2.22.0", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"eslint-plugin-promise": "^4.2.1", | ||
"eslint-plugin-sonarjs": "^0.5.0", | ||
"eslint-plugin-typescript": "^0.14.0", | ||
"gh-pages": "^3.1.0", | ||
"husky": "^4.2.5", | ||
"prettier": "^2.1.1", | ||
"react": "^16.13.1", | ||
"react-scripts": "^3.4.3", | ||
"react-test-renderer": "^16.13.1", | ||
"rollup": "^2.26.8", | ||
"rollup-plugin-babel": "^4.4.0", | ||
"rollup-plugin-commonjs": "^10.1.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-peer-deps-external": "^2.2.3", | ||
"rollup-plugin-typescript2": "^0.27.2", | ||
"rollup-plugin-url": "^3.0.1", | ||
"typescript": "^4.0.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import typescript from 'rollup-plugin-typescript2' | ||
import commonjs from 'rollup-plugin-commonjs' | ||
import external from 'rollup-plugin-peer-deps-external' | ||
import resolve from 'rollup-plugin-node-resolve' | ||
import url from 'rollup-plugin-url' | ||
|
||
import pkg from './package.json' | ||
|
||
export default { | ||
input: 'src/index.tsx', | ||
output: [ | ||
{ | ||
file: pkg.main, | ||
format: 'cjs', | ||
exports: 'named', | ||
sourcemap: true | ||
}, | ||
{ | ||
file: pkg.module, | ||
format: 'es', | ||
exports: 'named', | ||
sourcemap: true | ||
} | ||
], | ||
plugins: [ | ||
external(), | ||
url({ exclude: ['**/*.svg'] }), | ||
resolve(), | ||
typescript({ | ||
rollupCommonJSResolveHack: true, | ||
clean: true | ||
}), | ||
commonjs() | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { usingHooks } from './usingHooks'; | ||
import { HooksInterface } from './types'; | ||
|
||
export const useHooks = (): HooksInterface => ({ | ||
usingHooks, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export interface HooksInterface { | ||
usingHooks(): Promise<boolean>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export async function usingHooks(): Promise<boolean> { | ||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"compilerOptions": { | ||
/* Basic Options */ | ||
"target": "es6", | ||
"module": "es6", | ||
"lib": ["esnext", "DOM"], | ||
"types": ["react", "jest"], | ||
"jsx": "react", | ||
"declaration": true, | ||
"declarationMap": true, | ||
"experimentalDecorators": true, | ||
"sourceMap": true, | ||
"outDir": "dist", | ||
"importHelpers": true, | ||
"resolveJsonModule": true, | ||
"baseUrl": ".", | ||
"skipLibCheck": true, | ||
/* Strict Type-Checking Options */ | ||
"strict": true, | ||
"noImplicitAny": true, | ||
"strictNullChecks": true, | ||
"strictFunctionTypes": true, | ||
"strictPropertyInitialization": true, | ||
"noImplicitThis": true, | ||
"alwaysStrict": true, | ||
"suppressImplicitAnyIndexErrors": true, | ||
/* Additional Checks */ | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": true, | ||
/* Module Resolution Options */ | ||
"moduleResolution": "node", | ||
"allowSyntheticDefaultImports": true, | ||
"esModuleInterop": true | ||
}, | ||
"compileOnSave": true, | ||
"include": ["src"], | ||
"exclude": ["node_modules", "dist", "rollup.config.js"] | ||
} |
Oops, something went wrong.