Skip to content

Commit

Permalink
eslint, prettier, husky configured
Browse files Browse the repository at this point in the history
  • Loading branch information
AnushDeokar committed Sep 29, 2023
1 parent 58876b9 commit e8c8abb
Show file tree
Hide file tree
Showing 32 changed files with 3,716 additions and 851 deletions.
45 changes: 16 additions & 29 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,22 @@
/** @type {import("eslint").Linter.Config} */
const config = {
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: ["plugin:react/recommended", "prettier"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
},
plugins: ["@typescript-eslint", "tailwindcss"],
extends: [
"next/core-web-vitals",
"plugin:@typescript-eslint/recommended-type-checked",
"prettier",
"plugin:tailwindcss/recommended",
],
rules: {
"@typescript-eslint/consistent-type-imports": [
"warn",
{
prefer: "type-imports",
fixStyle: "inline-type-imports",
},
],
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 12,
sourceType: "module",
},
plugins: ["react", "@typescript-eslint"],
rules: {},
settings: {
tailwindcss: {
callees: ["cn"],
config: "./tailwind.config.ts",
},
next: {
rootDir: ["./"],
react: {
version: "detect",
},
},
}

module.exports = config
};
42 changes: 42 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

echo '🏗️👷 Styling, testing and building your project before committing'

# Check Prettier standards
npm run check-format ||
(
echo '🤢🤮🤢🤮 Its FOKING RAW - Your styling looks disgusting. 🤢🤮🤢🤮
Prettier Check Failed. Run npm run format, add changes and try commit again.';
false;
)

# Check ESLint Standards
# npm run check-lint ||
# (
# echo '😤🏀👋😤 Get that weak shit out of here! 😤🏀👋😤
# ESLint Check Failed. Make the required changes listed above, add changes and try to commit again.'
# false;
# )

# Check tsconfig standards
# npm run check-types ||
# (
# echo '🤡😂❌🤡 Failed Type check. 🤡😂❌🤡
# Are you seriously trying to write that? Make the changes required above.'
# false;
# )

# If everything passes... Now we can commit
echo '🤔🤔🤔🤔... Alright.... Code looks good to me... Trying to build now. 🤔🤔🤔🤔'

npm run build ||
(
echo '❌👷🔨❌ Better call Bob... Because your build failed ❌👷🔨❌
Next build failed: View the errors above to see why.
'
false;
)

# If everything passes... Now we can commit
echo '✅✅✅✅ You win this time... I am committing this now. ✅✅✅✅'
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"endOfLine": "lf",
"printWidth": 80,
"tabWidth": 2,
"trailingComma": "es5"
}
15 changes: 9 additions & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"editor.formatOnSave": true
}
{
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.fixAll.format": true
}
}
Loading

0 comments on commit e8c8abb

Please sign in to comment.