Skip to content

Commit

Permalink
Configure Eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
eliezerbasubi committed Apr 28, 2022
1 parent 0b98d4f commit 3c82329
Show file tree
Hide file tree
Showing 4 changed files with 604 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": "next/core-web-vitals"
"extends": ["next/core-web-vitals", "prettier"]
}
10 changes: 10 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -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],
};
22 changes: 20 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "next lint",
"type-check": "tsc --pretty --noEmit",
"format": "prettier --write ."
},
"dependencies": {
"antd": "^4.20.1",
Expand All @@ -21,8 +23,24 @@
"autoprefixer": "^10.4.5",
"eslint": "8.14.0",
"eslint-config-next": "12.1.5",
"eslint-config-prettier": "^8.5.0",
"husky": "^4.2.3",
"lint-staged": "^10.5.4",
"postcss": "^8.4.12",
"tailwindcss": "^3.0.24",
"typescript": "4.6.3"
"typescript": "^4.6.0"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"pre-push": "npm run type-check && npm run lint"
}
},
"lint-staged": {
"*.@(ts|tsx)": [
"npm run lint",
"npm run format",
"git add ."
]
}
}
Loading

0 comments on commit 3c82329

Please sign in to comment.