diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 92555d66..691a2b79 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,35 @@ jobs: run: yarn install - name: 🧹 Run lint - run: yarn lint + run: yarn next lint + + type-check: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Use Node.js 16.x + uses: actions/setup-node@v2 + with: + node-version: 16.x + + # Cache node modules and next folder + - name: 📬 Caching + uses: actions/cache@v2 + with: + path: | + ${{ github.workspace }}/node_modules + ${{ github.workspace }}/.next/cache + key: ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/*.{js,jsx,ts,tsx}') }} + restore-keys: | + ${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}- + + - name: 🧰 Install dependencies + run: yarn install + + - name: 🔧 Check validity of types + run: yarn tsc --noEmit --pretty test: runs-on: ubuntu-latest @@ -103,7 +131,7 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} build: - needs: lint + needs: [lint, type-check] runs-on: ubuntu-latest steps: - name: Checkout code diff --git a/.gitignore b/.gitignore index 65907502..8974a4e4 100755 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ # testing /coverage +/reports # next.js /.next/ diff --git a/next.config.js b/next.config.js index 3b081d25..3a898dc0 100755 --- a/next.config.js +++ b/next.config.js @@ -1,4 +1,4 @@ -const { PHASE_DEVELOPMENT_SERVER, PHASE_TEST } = require('next/constants'); +const { PHASE_DEVELOPMENT_SERVER, PHASE_TEST } = require("next/constants") /** @type {import('next').NextConfig} */ const nextConfig = (phase, { defaultConfig }) => ({ @@ -7,29 +7,29 @@ const nextConfig = (phase, { defaultConfig }) => ({ swcMinify: true, compiler: { ...(phase !== PHASE_DEVELOPMENT_SERVER && - phase !== PHASE_TEST && { removeConsole: true }), + phase !== PHASE_TEST && { removeConsole: true }) }, async redirects() { return [ { - source: '/', - destination: '/categorias', - permanent: false, - }, - ]; - }, - typescript: { - // !! WARN !! - // Dangerously allow production builds to successfully complete even if - // your project has type errors. - // !! WARN !! - ignoreBuildErrors: true, - }, - eslint: { - // Warning: This allows production builds to successfully complete even if - // your project has ESLint errors. - ignoreDuringBuilds: true, - }, -}); + source: "/", + destination: "/categorias", + permanent: false + } + ] + } + // typescript: { + // // !! WARN !! + // // Dangerously allow production builds to successfully complete even if + // // your project has type errors. + // // !! WARN !! + // ignoreBuildErrors: true, + // }, + // eslint: { + // // Warning: This allows production builds to successfully complete even if + // // your project has ESLint errors. + // ignoreDuringBuilds: true, + // }, +}) -module.exports = nextConfig; +module.exports = nextConfig diff --git a/reports/eslint-report.json b/reports/eslint-report.json deleted file mode 100644 index 0d10b5d3..00000000 --- a/reports/eslint-report.json +++ /dev/null @@ -1 +0,0 @@ -[{"filePath":"/home/eduardo/2022-1-schedula-front/src/components/DashboardOptions.tsx","messages":[],"suppressedMessages":[{"ruleId":"react-perf/jsx-no-new-object-as-prop","severity":2,"message":"JSX attribute values should not contain objects created in the same scope","line":27,"column":17,"nodeType":"ObjectExpression","endLine":27,"endColumn":50,"suppressions":[{"kind":"directive","justification":"its necessary since _hover NEEDS a css style object"}]}],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/components/ListIcon.tsx","messages":[],"suppressedMessages":[{"ruleId":"react-perf/jsx-no-new-object-as-prop","severity":2,"message":"JSX attribute values should not contain objects created in the same scope","line":87,"column":17,"nodeType":"ObjectExpression","endLine":87,"endColumn":41,"suppressions":[{"kind":"directive","justification":"its necessary since _hover NEEDS a css style object"}]}],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/components/ListItem.tsx","messages":[],"suppressedMessages":[{"ruleId":"react-perf/jsx-no-new-object-as-prop","severity":2,"message":"JSX attribute values should not contain objects created in the same scope","line":89,"column":18,"nodeType":"ObjectExpression","endLine":94,"endColumn":14,"suppressions":[{"kind":"directive","justification":"Its not css."}]},{"ruleId":"react-perf/jsx-no-new-object-as-prop","severity":2,"message":"JSX attribute values should not contain objects created in the same scope","line":104,"column":19,"nodeType":"ObjectExpression","endLine":111,"endColumn":14,"suppressions":[{"kind":"directive","justification":"Its not css."}]},{"ruleId":"react-perf/jsx-no-new-object-as-prop","severity":2,"message":"JSX attribute values should not contain objects created in the same scope","line":121,"column":21,"nodeType":"ObjectExpression","endLine":128,"endColumn":14,"suppressions":[{"kind":"directive","justification":"Its not css."}]}],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/components/ListagemButtonCad.tsx","messages":[],"suppressedMessages":[{"ruleId":"react-perf/jsx-no-new-object-as-prop","severity":2,"message":"JSX attribute values should not contain objects created in the same scope","line":35,"column":17,"nodeType":"ObjectExpression","endLine":39,"endColumn":10,"suppressions":[{"kind":"directive","justification":"its necessary since _hover NEEDS a css style object"}]}],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/components/ListagemHeader.tsx","messages":[],"suppressedMessages":[],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/components/ModalCad&Edit.tsx","messages":[],"suppressedMessages":[],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/components/ModalDel.tsx","messages":[],"suppressedMessages":[],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/components/SideBar/Sidebar.spec.tsx","messages":[],"suppressedMessages":[],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/components/SideBar/SidebarItem/SideBarItem.tsx","messages":[],"suppressedMessages":[{"ruleId":"react-perf/jsx-no-new-object-as-prop","severity":2,"message":"JSX attribute values should not contain objects created in the same scope","line":57,"column":17,"nodeType":"ObjectExpression","endLine":61,"endColumn":10,"suppressions":[{"kind":"directive","justification":"não irei implementar uma classe que aplica hover"}]}],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/components/SideBar/index.tsx","messages":[],"suppressedMessages":[],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/components/loading.tsx","messages":[],"suppressedMessages":[],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/layout/DefaultLayout.tsx","messages":[],"suppressedMessages":[],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/pages/_app.tsx","messages":[],"suppressedMessages":[],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/pages/_document.tsx","messages":[],"suppressedMessages":[],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/pages/cadastro.tsx","messages":[],"suppressedMessages":[],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/pages/index.tsx","messages":[],"suppressedMessages":[],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/pages/listaCategoria.tsx","messages":[],"suppressedMessages":[],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/pages/listaCidades.tsx","messages":[],"suppressedMessages":[],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/pages/teste.tsx","messages":[],"suppressedMessages":[],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/routes/index.tsx","messages":[],"suppressedMessages":[],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/services/DataType.ts","messages":[],"suppressedMessages":[],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/services/FunctionList.ts","messages":[],"suppressedMessages":[],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/services/RequestCad.ts","messages":[],"suppressedMessages":[],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/services/RequestDel.ts","messages":[],"suppressedMessages":[],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/services/RequestEdit.ts","messages":[],"suppressedMessages":[],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/services/testApi.ts","messages":[],"suppressedMessages":[],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/styles/ColorTheme.ts","messages":[],"suppressedMessages":[],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]},{"filePath":"/home/eduardo/2022-1-schedula-front/src/types.d.ts","messages":[],"suppressedMessages":[],"errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":[]}] \ No newline at end of file