Skip to content

Commit 20e7610

Browse files
authored
Initial commit
0 parents  commit 20e7610

Some content is hidden

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

59 files changed

+59340
-0
lines changed

Diff for: .eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
out
3+
!.storybook

Diff for: .eslintrc

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
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+
"error",
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",
30+
"airbnb-typescript",
31+
"airbnb/hooks",
32+
"next/core-web-vitals",
33+
"plugin:prettier/recommended"
34+
],
35+
"parserOptions": {
36+
"project": "./tsconfig.json"
37+
},
38+
"rules": {
39+
"prettier/prettier": [
40+
"error",
41+
{
42+
"singleQuote": true,
43+
"endOfLine": "auto"
44+
}
45+
],
46+
"react/function-component-definition": "off", // Disable Airbnb's specific function type
47+
"react/destructuring-assignment": "off", // Vscode doesn't support automatically destructuring, it's a pain to add a new variable
48+
"react/require-default-props": "off", // Allow non-defined react props as undefined
49+
"react/jsx-props-no-spreading": "off", // _app.tsx uses spread operator and also, react-hook-form
50+
"react-hooks/exhaustive-deps": "off", // Incorrectly report needed dependency with Next.js router
51+
"@next/next/no-img-element": "off", // We currently not using next/image because it isn't supported with SSG mode
52+
"@typescript-eslint/comma-dangle": "off", // Avoid conflict rule between Eslint and Prettier
53+
"@typescript-eslint/consistent-type-imports": "error", // Ensure `import type` is used when it's necessary
54+
"no-restricted-syntax": [
55+
"error",
56+
"ForInStatement",
57+
"LabeledStatement",
58+
"WithStatement"
59+
], // Overrides Airbnb configuration and enable no-restricted-syntax
60+
"import/prefer-default-export": "off", // Named export is easier to refactor automatically
61+
"simple-import-sort/imports": "error", // Import configuration for `eslint-plugin-simple-import-sort`
62+
"simple-import-sort/exports": "error", // Export configuration for `eslint-plugin-simple-import-sort`
63+
"@typescript-eslint/no-unused-vars": "off",
64+
"unused-imports/no-unused-imports": "error",
65+
"unused-imports/no-unused-vars": [
66+
"error",
67+
{ "argsIgnorePattern": "^_" }
68+
]
69+
}
70+
},
71+
// Configuration for testing
72+
{
73+
"files": ["**/*.test.ts", "**/*.test.tsx"],
74+
"plugins": ["jest", "jest-formatting", "testing-library", "jest-dom"],
75+
"extends": [
76+
"plugin:jest/recommended",
77+
"plugin:jest-formatting/recommended",
78+
"plugin:testing-library/react",
79+
"plugin:jest-dom/recommended"
80+
]
81+
},
82+
// Configuration for e2e testing (Cypress)
83+
{
84+
"files": ["cypress/**/*.ts"],
85+
"plugins": ["cypress"],
86+
"extends": ["plugin:cypress/recommended"],
87+
"parserOptions": {
88+
"project": "./cypress/tsconfig.json"
89+
}
90+
},
91+
// Configuration for Storybook
92+
{
93+
"files": ["*.stories.*"],
94+
"extends": ["plugin:storybook/recommended"],
95+
"rules": {
96+
"import/no-extraneous-dependencies": [
97+
"error",
98+
{
99+
"devDependencies": true
100+
}
101+
]
102+
}
103+
}
104+
]
105+
}

Diff for: .github/FUNDING.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
custom:
2+
["https://donate.stripe.com/7sI5m5146ehfddm7tj", "https://nextlessjs.com"]

Diff for: .github/workflows/CI.yml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
strategy:
12+
matrix:
13+
node-version: [16.x, 18.x, 20.x]
14+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
15+
16+
name: Build with ${{ matrix.node-version }}
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v3
21+
- name: Use Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
cache: "npm"
26+
- run: npm ci
27+
- run: npm run build-prod
28+
29+
test:
30+
strategy:
31+
matrix:
32+
node-version: [16.x]
33+
34+
name: Run all tests
35+
runs-on: ubuntu-latest
36+
37+
steps:
38+
- uses: actions/checkout@v3
39+
with:
40+
fetch-depth: 0 # Retrieve Git history, needed to verify commits
41+
- name: Use Node.js ${{ matrix.node-version }}
42+
uses: actions/setup-node@v3
43+
with:
44+
node-version: ${{ matrix.node-version }}
45+
cache: "npm"
46+
- run: npm ci
47+
48+
- if: github.event_name == 'pull_request'
49+
name: Validate all commits from PR
50+
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
51+
52+
- name: Linter
53+
run: npm run lint
54+
55+
- name: Type checking
56+
run: npm run check-types
57+
58+
- name: Run unit tests
59+
run: npm run test
60+
61+
- name: Run storybook tests
62+
run: npm run test-storybook:ci
63+
64+
- name: Run e2e tests
65+
run: npx percy exec -- npm run e2e:headless
66+
env:
67+
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}

Diff for: .github/workflows/release.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Release
2+
3+
on:
4+
workflow_run:
5+
workflows: ["CI"]
6+
types:
7+
- completed
8+
branches:
9+
- main
10+
11+
jobs:
12+
release:
13+
strategy:
14+
matrix:
15+
node-version: [16.x]
16+
17+
name: Create a new release
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 0
24+
- name: Use Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v3
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
cache: "npm"
29+
- run: HUSKY=0 npm ci
30+
31+
- name: Release
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
35+
run: npx semantic-release

Diff for: .github/workflows/update-deps.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Update dependencies
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 0 1 * *"
7+
8+
jobs:
9+
update:
10+
strategy:
11+
matrix:
12+
node-version: [16.x]
13+
14+
name: Update all dependencies
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Use Node.js ${{ matrix.node-version }}
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: ${{ matrix.node-version }}
23+
cache: "npm"
24+
- run: npm ci
25+
26+
- run: npx npm-check-updates -u # Update dependencies
27+
- run: rm -Rf node_modules package-lock.json
28+
- run: npm install
29+
- name: Create Pull Request
30+
uses: peter-evans/create-pull-request@v4
31+
with:
32+
commit-message: "build: update dependencies to the latest version"
33+
title: Update dependencies to the latest version

Diff for: .gitignore

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+
# storybook
12+
storybook-static
13+
14+
# cypress
15+
cypress/screenshots
16+
cypress/videos
17+
18+
# next.js
19+
/.next
20+
/out
21+
22+
# next-sitemap
23+
public/robots.txt
24+
public/sitemap.xml
25+
public/sitemap-*.xml
26+
27+
# cache
28+
.swc/
29+
30+
# production
31+
/build
32+
33+
# misc
34+
.DS_Store
35+
*.pem
36+
Thumbs.db
37+
38+
# debug
39+
npm-debug.log*
40+
pnpm-debug.log*
41+
yarn-debug.log*
42+
yarn-error.log*
43+
44+
# local env files
45+
.env*.local
46+
47+
# local folder
48+
local
49+
50+
# vercel
51+
.vercel

Diff for: .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+
cd "$(dirname "$0")/.." && npx --no -- commitlint --edit $1

Diff for: .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+
cd "$(dirname "$0")/.." && npx lint-staged --concurrent false

Diff for: .storybook/main.ts

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import type { StorybookConfig } from '@storybook/nextjs';
2+
3+
const config: StorybookConfig = {
4+
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],
5+
addons: [
6+
'@storybook/addon-links',
7+
'@storybook/addon-essentials',
8+
'@storybook/addon-interactions',
9+
],
10+
framework: {
11+
name: '@storybook/nextjs',
12+
options: {},
13+
},
14+
docs: {
15+
autodocs: 'tag',
16+
},
17+
core: {
18+
disableTelemetry: true,
19+
},
20+
};
21+
22+
export default config;

Diff for: .storybook/preview.ts

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import '../src/styles/global.css';
2+
3+
import type { Preview } from '@storybook/react';
4+
5+
const preview: Preview = {
6+
parameters: {
7+
actions: { argTypesRegex: '^on[A-Z].*' },
8+
controls: {
9+
matchers: {
10+
color: /(background|color)$/i,
11+
date: /Date$/,
12+
},
13+
},
14+
},
15+
};
16+
17+
export default preview;

Diff for: .vscode/extensions.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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+
"yoavbls.pretty-ts-errors"
10+
]
11+
}

Diff for: .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+
}

0 commit comments

Comments
 (0)