[WEB-1390] chore: Add pre commit hook to check for lint and formatting errors (#4537)

* Add pre commit hook

* Add comments
This commit is contained in:
Satish Gandham 2024-05-22 15:50:15 +05:30 committed by GitHub
parent b084844565
commit 6236adf4bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 362 additions and 11 deletions

62
.eslintrc-staged.js Normal file
View file

@ -0,0 +1,62 @@
/**
* Adds three new lint plugins over the existing configuration:
* This is used to lint staged files only.
* We should remove this file once the entire codebase follows these rules.
*/
module.exports = {
root: true,
extends: [
"custom",
"eslint:recommended",
"plugin:react/recommended",
"plugin:prettier/recommended",
],
parser: "@typescript-eslint/parser",
settings: {
"import/resolver": {
typescript: {},
node: {
moduleDirectory: ["node_modules", "."],
},
},
},
rules: {
"import/order": [
"error",
{
groups: ["builtin", "external", "internal", "parent", "sibling"],
pathGroups: [
{
pattern: "react",
group: "external",
position: "before",
},
{
pattern: "lucide-react",
group: "external",
position: "after",
},
{
pattern: "@headlessui/**",
group: "external",
position: "after",
},
{
pattern: "@plane/**",
group: "external",
position: "after",
},
{
pattern: "@/**",
group: "internal",
},
],
pathGroupsExcludedImportTypes: ["builtin", "internal", "react"],
alphabetize: {
order: "asc",
caseInsensitive: true,
},
},
],
},
};