Skip to content

Commit

Permalink
feat: migrate eslint and add husky
Browse files Browse the repository at this point in the history
  • Loading branch information
moonlitgrace committed Aug 28, 2024
1 parent 411a161 commit d291ddb
Show file tree
Hide file tree
Showing 8 changed files with 1,913 additions and 20 deletions.
3 changes: 0 additions & 3 deletions .eslintrc.json

This file was deleted.

1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no-install commitlint --edit "$1"
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
4 changes: 4 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"**/*.{js,jsx,ts,tsx}": ["eslint --max-warnings=0", "prettier --write"],
"**/*.{html,json,css,scss,md,mdx}": ["prettier -w"]
}
26 changes: 26 additions & 0 deletions commitlint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { UserConfig } from '@commitlint/types';

const Configuration: UserConfig = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [
2,
'always',
[
'feat',
'fix',
'docs',
'chore',
'style',
'refactor',
'ci',
'test',
'revert',
'perf',
'vercel',
],
],
},
};

export default Configuration;
22 changes: 22 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [{
ignores: [
"**/.next/",
"**/node_modules/",
"**/coverage/",
"**/__snapshots__/",
"**/package-lock.json",
],
}, ...compat.extends("next/core-web-vitals")];
Loading

0 comments on commit d291ddb

Please sign in to comment.