build: set up ESLint, Prettier, Commitlint, lint-staged and Next.js configurations

This commit is contained in:
Dorian Niemiec 2024-11-05 18:13:12 +01:00
parent 489e7ebbc0
commit 1735bb1975
8 changed files with 4173 additions and 9 deletions

View file

@ -1,3 +1,3 @@
{
"extends": "next/core-web-vitals"
"extends": ["next/core-web-vitals", "prettier", "plugin:prettier/recommended"]
}

2
.husky/commit-msg Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
npx --no -- commitlint --edit "$1"

2
.husky/pre-commit Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
npx lint-staged

3
commitlint.config.js Normal file
View file

@ -0,0 +1,3 @@
module.exports = {
extends: ["@commitlint/config-conventional"],
};

10
lint-staged.config.js Normal file
View file

@ -0,0 +1,10 @@
const path = require("path");
const buildEslintCommand = (filenames) =>
`next lint --fix --file ${filenames
.map((f) => path.relative(process.cwd(), f))
.join(" --file ")}`;
module.exports = {
"*.{js,jsx,ts,tsx}": [buildEslintCommand],
};

View file

@ -1,4 +1,19 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};
const nextConfig = {
images: {
remotePatterns: [
{
protocol: "https",
hostname: "cdn.sanity.io",
port: "",
},
],
},
eslint: {
ignoreDuringBuilds: true,
},
cacheMaxMemorySize: 0,
poweredByHeader: false
};
export default nextConfig;

4120
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -4,19 +4,31 @@
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"build": "next build && swc .next/static/chunks/*.js .next/static/chunks/**/*.js -d . --include-dotfiles",
"start": "next start",
"lint": "next lint"
"lint": "next lint",
"lint:fix": "npm run lint -- --fix",
"prepare": "husky",
"cz": "cz"
},
"dependencies": {
"next": "15.0.2",
"react": "19.0.0-rc-02c0e824-20241028",
"react-dom": "19.0.0-rc-02c0e824-20241028",
"next": "15.0.2"
"react-dom": "19.0.0-rc-02c0e824-20241028"
},
"devDependencies": {
"postcss": "^8",
"tailwindcss": "^3.4.1",
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"@swc/cli": "^0.5.0",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8",
"eslint-config-next": "15.0.2"
"eslint-config-next": "15.0.2",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
"postcss": "^8",
"prettier": "^3.3.3",
"tailwindcss": "^3.4.1"
}
}