Skip to content

Commit

Permalink
[config] - instala prettier e configura rotina de pre commit
Browse files Browse the repository at this point in the history
  • Loading branch information
saracampss committed Jul 24, 2024
1 parent 1c507ec commit b78573c
Show file tree
Hide file tree
Showing 28 changed files with 384 additions and 273 deletions.
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/coverage/*
/build/*
/node-modules/*
/.github/*
/.husky/*
/dist/*
26 changes: 12 additions & 14 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@ module.exports = {
root: true,
env: { browser: true, es2020: true, node: true },
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
"eslint:recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"prettier",
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
settings: { react: { version: '18.2' } },
plugins: ['react-refresh'],
ignorePatterns: ["dist", ".eslintrc.cjs"],
parserOptions: { ecmaVersion: "latest", sourceType: "module" },
settings: { react: { version: "18.2" } },
plugins: ["react-refresh", "react"],
rules: {
'react/jsx-no-target-blank': 'off',
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
"react-refresh/only-export-components": "off",
"react/jsx-no-target-blank": "off",
},
}
};
33 changes: 33 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

echo '🏗️👷 Estilizando, testando e buildando seu código antes de commitar . . .\n'

# Check Prettier standards
npm run check-format ||
(
echo '\n🤢🤮 Parece haver um problema de estilo 🤢🤮
Checagem do Prettier falhou... Rode um npm run format, adicione as alterações e tente novamente.\n';
false;
)

# Check ESLint Standards
npm run lint ||
(
echo '\n😤🏀👋😤 Daqui não passa! 😤🏀👋😤
Checagem do ESLint falhou... Faça as alterações listadas acima e tente novamente.\n'
false;
)

# If everything passes... Now we can commit
echo '\n🤔🤔🤔🤔... Tudo bem... Parece que o código tá legal... Vamos tentar buildar. 🤔🤔🤔🤔\n'

npm run build ||
(
echo '\n❌👷🔨❌ Seu build falhou!!!! ❌👷🔨❌
Falha ao buildar o React: entenda o que aconteceu vendo os erros acima.\n'
false;
)

# If everything passes... Now we can commit
echo '\n\n✅✅✅✅ Você ganhou dessa vez, commitando agora. ✅✅✅✅\n'
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build
.github
*.md
coverage
dist
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"endOfLine": "lf",
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5"
}
18 changes: 12 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
<!doctype html>
<html lang="en">
<head>
<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=Noto+Sans:ital,wght@0,100..900;1,100..900&family=Overpass:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
<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=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
<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=Noto+Sans:ital,wght@0,100..900;1,100..900&family=Overpass:ital,wght@0,100..900;1,100..900&display=swap"
rel="stylesheet"
/>
<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=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap"
rel="stylesheet"
/>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Sentinela</title>
Expand Down
Loading

0 comments on commit b78573c

Please sign in to comment.