Skip to content

Commit d2f14ee

Browse files
cpmmoted
0 parents  commit d2f14ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+29151
-0
lines changed

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
out

.eslintrc

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
{
2+
// Configuration for JavaScript files
3+
"extends": [
4+
"airbnb-base",
5+
"next/core-web-vitals", // Needed to avoid warning in next.js build: 'The Next.js plugin was not detected in your ESLint configuration'
6+
"plugin:prettier/recommended"
7+
],
8+
"rules": {
9+
"prettier/prettier": [
10+
"warn",
11+
{
12+
"singleQuote": true,
13+
"endOfLine": "auto"
14+
}
15+
]
16+
},
17+
"overrides": [
18+
// Configuration for TypeScript files
19+
{
20+
"files": ["**/*.ts", "**/*.tsx"],
21+
"plugins": [
22+
"@typescript-eslint",
23+
"unused-imports",
24+
"tailwindcss",
25+
"simple-import-sort"
26+
],
27+
"extends": [
28+
"plugin:tailwindcss/recommended",
29+
"airbnb-typescript",
30+
"next/core-web-vitals",
31+
"plugin:prettier/recommended"
32+
],
33+
"parserOptions": {
34+
"project": "./tsconfig.json"
35+
},
36+
"rules": {
37+
"prettier/prettier": [
38+
"warn",
39+
{
40+
"singleQuote": true,
41+
"endOfLine": "auto"
42+
}
43+
],
44+
"react/destructuring-assignment": "off", // Vscode doesn't support automatically destructuring, it's a pain to add a new variable
45+
"jsx-a11y/anchor-is-valid": "off", // Next.js use his own internal link system
46+
"react/require-default-props": "off", // Allow non-defined react props as undefined
47+
"react/jsx-props-no-spreading": "off", // _app.tsx uses spread operator and also, react-hook-form
48+
"react-hooks/exhaustive-deps": "off", // Incorrectly report needed dependency with Next.js router
49+
"@next/next/no-img-element": "off", // We currently not using next/image because it isn't supported with SSG mode
50+
"@typescript-eslint/comma-dangle": "off", // Avoid conflict rule between Eslint and Prettier
51+
"@typescript-eslint/consistent-type-imports": "error", // Ensure `import type` is used when it's necessary
52+
"import/prefer-default-export": "off", // Named export is easier to refactor automatically
53+
"no-empty-pattern": "off",
54+
"tailwindcss/classnames-order": [
55+
"warn",
56+
{
57+
"officialSorting": true
58+
}
59+
], // Follow the same ordering as the official plugin `prettier-plugin-tailwindcss`
60+
"simple-import-sort/imports": "error", // Import configuration for `eslint-plugin-simple-import-sort`
61+
"simple-import-sort/exports": "error", // Export configuration for `eslint-plugin-simple-import-sort`
62+
"@typescript-eslint/no-unused-vars": "off",
63+
"unused-imports/no-unused-imports": "error",
64+
"unused-imports/no-unused-vars": [
65+
"error",
66+
{ "argsIgnorePattern": "^_" }
67+
]
68+
}
69+
},
70+
// Configuration for testing
71+
{
72+
"files": ["**/*.test.ts", "**/*.test.tsx"],
73+
"plugins": ["jest", "jest-formatting", "testing-library", "jest-dom"],
74+
"extends": [
75+
"plugin:jest/recommended",
76+
"plugin:jest-formatting/recommended",
77+
"plugin:testing-library/react",
78+
"plugin:jest-dom/recommended"
79+
]
80+
}
81+
]
82+
}

.gitignore

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next
13+
/out
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
Thumbs.db
22+
23+
# debug
24+
npm-debug.log*
25+
pnpm-debug.log*
26+
yarn-debug.log*
27+
yarn-error.log*
28+
29+
# dotenv local files
30+
.env*.local
31+
32+
# local folder
33+
local
34+
35+
# vercel
36+
.vercel
37+
38+
# License
39+
LICENSE
40+
# Readme
41+
README.md

.husky/commit-msg

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx --no -- commitlint --edit $1

.husky/pre-commit

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
# Disable concurent to run `check-types` after ESLint in lint-staged
5+
npx lint-staged --concurrent false

.vscode/extensions.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"recommendations": [
3+
"dbaeumer.vscode-eslint",
4+
"esbenp.prettier-vscode",
5+
"mikestead.dotenv",
6+
"csstools.postcss",
7+
"bradlc.vscode-tailwindcss",
8+
"Orta.vscode-jest"
9+
]
10+
}

.vscode/launch.json

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "chrome",
9+
"request": "launch",
10+
"name": "Next: Chrome",
11+
"url": "http://localhost:3000",
12+
"webRoot": "${workspaceFolder}"
13+
},
14+
{
15+
"type": "node",
16+
"request": "launch",
17+
"name": "Next: Node",
18+
"program": "${workspaceFolder}/node_modules/.bin/next",
19+
"args": ["dev"],
20+
"autoAttachChildProcesses": true,
21+
"skipFiles": ["<node_internals>/**"],
22+
"console": "integratedTerminal"
23+
}
24+
],
25+
"compounds": [
26+
{
27+
"name": "Next: Full",
28+
"configurations": ["Next: Node", "Next: Chrome"]
29+
}
30+
]
31+
}

.vscode/settings.json

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"editor.tabSize": 2,
3+
"editor.detectIndentation": false,
4+
"search.exclude": {
5+
"package-lock.json": true
6+
},
7+
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
8+
"editor.formatOnSave": false,
9+
"editor.codeActionsOnSave": [
10+
"source.addMissingImports",
11+
"source.fixAll.eslint"
12+
],
13+
"jest.autoRun": {
14+
"watch": true, // Start the jest with the watch flag
15+
"onStartup": ["all-tests"] // Run all tests upon project launch
16+
},
17+
"jest.showCoverageOnLoad": true, // Show code coverage when the project is launched
18+
"jest.showTerminalOnLaunch": false, // Don't automatically open test explorer terminal on launch
19+
// Multiple language settings for json and jsonc files
20+
"[json][jsonc]": {
21+
"editor.formatOnSave": true,
22+
"editor.defaultFormatter": "esbenp.prettier-vscode"
23+
}
24+
}

.vscode/tasks.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "Project wide type checking with TypeScript",
8+
"type": "npm",
9+
"script": "check-types",
10+
"problemMatcher": ["$tsc"],
11+
"group": {
12+
"kind": "build",
13+
"isDefault": true
14+
},
15+
"presentation": {
16+
"clear": true,
17+
"reveal": "never"
18+
}
19+
}
20+
]
21+
}

CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4+
5+
## 1.1.0 (2022-04-25)
6+
7+
8+
### Features
9+
10+
* add commitlint with config-conventional ([97a9ac7](https://github.com/ixartz/Next-js-Boilerplate/commit/97a9ac7dbbca3f8d4fad22a9e4a481c029cd2cb5))
11+
12+
13+
### Bug Fixes
14+
15+
* add missing files for commitzen ([018ba8b](https://github.com/ixartz/Next-js-Boilerplate/commit/018ba8bde81b0f6cc60230fe4668b149ac3b2e6a))
16+
* update package-lock.json ([fba016d](https://github.com/ixartz/Next-js-Boilerplate/commit/fba016dec202d5748e30804b1bf50e30c00ef120))

__mocks__/next/router.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// The easiest solution to mock `next/router`: https://github.com/vercel/next.js/issues/7479
2+
export const useRouter = () => {
3+
return {
4+
basePath: '.',
5+
};
6+
};

commitlint.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = { extends: ['@commitlint/config-conventional'] };

jest.config.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
const nextJest = require('next/jest');
2+
3+
const createJestConfig = nextJest({
4+
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
5+
dir: './',
6+
});
7+
8+
const customJestConfig = {
9+
moduleNameMapper: {
10+
// Handle module aliases (this will be automatically configured for you soon)
11+
'^@/(.*)$': '<rootDir>/src/$1',
12+
13+
'^@/public/(.*)$': '<rootDir>/public/$1',
14+
},
15+
setupFilesAfterEnv: ['./jest.setup.js'],
16+
clearMocks: true,
17+
collectCoverage: true,
18+
collectCoverageFrom: [
19+
'./src/**/*.{js,jsx,ts,tsx}',
20+
'!./src/**/_*.{js,jsx,ts,tsx}',
21+
'!**/*.d.ts',
22+
'!**/node_modules/**',
23+
],
24+
coverageThreshold: {
25+
global: {
26+
branches: 80,
27+
functions: 80,
28+
lines: 80,
29+
statements: 80,
30+
},
31+
},
32+
testEnvironment: 'jest-environment-jsdom',
33+
};
34+
35+
module.exports = createJestConfig(customJestConfig);

jest.setup.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Optional: configure or set up a testing framework before each test.
2+
// If you delete this file, remove `setupFilesAfterEnv` from `jest.config.js`
3+
import '@testing-library/jest-dom/extend-expect';

lint-staged.config.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
'*.{js,jsx,ts,tsx}': ['eslint --fix', 'eslint'],
3+
'**/*.ts?(x)': () => 'npm run check-types',
4+
'*.json': ['prettier --write'],
5+
};

netlify.toml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[build]
2+
publish = "out"
3+
command = "npm run build-prod"
4+
5+
[build.environment]
6+
NETLIFY_NEXT_PLUGIN_SKIP = "true"

next-env.d.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/// <reference types="next" />
2+
/// <reference types="next/image-types/global" />
3+
4+
// NOTE: This file should not be edited
5+
// see https://nextjs.org/docs/basic-features/typescript for more information.

next.config.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// eslint-disable-next-line import/no-extraneous-dependencies
2+
const withTM = require('next-transpile-modules')(['three']);
3+
4+
/* eslint-disable import/no-extraneous-dependencies */
5+
const withBundleAnalyzer = require('@next/bundle-analyzer')({
6+
enabled: process.env.ANALYZE === 'true',
7+
});
8+
9+
module.exports = withTM(
10+
withBundleAnalyzer({
11+
eslint: {
12+
dirs: ['.'],
13+
},
14+
poweredByHeader: false,
15+
trailingSlash: true,
16+
basePath: '',
17+
// The starter code load resources from `public` folder with `router.basePath` in React components.
18+
// So, the source code is "basePath-ready".
19+
// You can remove `basePath` if you don't need it.
20+
reactStrictMode: true,
21+
experimental: {
22+
emotion: true,
23+
},
24+
images: {
25+
domains: ['egghead.io'],
26+
},
27+
typescript: {
28+
// !! WARN !!
29+
// Dangerously allow production builds to successfully complete even if
30+
// your project has type errors.
31+
// !! WARN !!
32+
ignoreBuildErrors: true,
33+
},
34+
})
35+
);

0 commit comments

Comments
 (0)