Skip to content

Commit

Permalink
chore: add code formatting and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Armoghan-ul-Mohmin committed Oct 22, 2024
1 parent 5a51c96 commit 95339f6
Show file tree
Hide file tree
Showing 11 changed files with 2,126 additions and 185 deletions.
14 changes: 14 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[flake8]
max-line-length = 88
ignore = E203, E266, E501, W503
exclude =
.git,
__pycache__,
node_modules,
migrations,
app/static,
tests,
.venv,
.devcontainer
per-file-ignores =
app.py: E402, F403
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npx --no-install commitlint --edit '$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
16 changes: 16 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Ignore specific directories
node_modules/*
.github/*
.vscode/*
.git/*
.devcontainer/*
.husky/*

# Ignore specific files
package.json
package-lock.json
.gitignore
.prettierrc.cjs
.prettierignore
eslint.config.mjs
.flake8
23 changes: 23 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
semi: true,
tabWidth: 2,
useTabs: false,
singleQuote: true,
trailingComma: 'es5',
bracketSpacing: true,
arrowParens: 'always',
endOfLine: 'lf',
printWidth: 80,
htmlWhitespaceSensitivity: 'ignore',
cssWhitespaceSensitivity: 'strict',
proseWrap: 'preserve',
overrides: [
{
files: '*.html',
options: {
printWidth: 120,
},
},
],
};

1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ["@commitlint/config-conventional"] };
59 changes: 59 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import prettier from "eslint-plugin-prettier";

export default [
{
ignores: [
"**/node_modules/**",
"**/.github/**",
"**/.vscode/**",
"**/.git/**",
"**/.devcontainer/**",
"**/.husky/**",
"**/package.json",
"**/package-lock.json",
"**/.eslintignore",
"**/.prettierrc.cjs",
"**/migrations/**",
"**/tests/**",
],
},
{
languageOptions: { globals: globals.browser },
},
pluginJs.configs.recommended,
{
files: ['**/*.js'],
linterOptions: {
noInlineConfig: true,
},
plugins: { prettier },
rules: {
"prettier/prettier": "error",
semi: ["error", "always"],
quotes: ["error", "single"],
"comma-dangle": ["error", "always-multiline"],
indent: ["error", 2],
"lines-around-comment": ["error", { beforeBlockComment: true }],
"no-unused-vars": [
"error",
{ vars: "all", args: "none", ignoreRestSiblings: false },
],
"no-extra-semi": "error",
"no-console": "warn",
"object-curly-spacing": ["error", "always"],
"space-in-parens": ["error", "never"],
camelcase: ["error", { properties: "always" }],
"function-call-argument-newline": ["error", "consistent"],
},
},
{
files: ['**/*.html'],
rules: {
semi: ["error", "always"],
quotes: ["error", "double"],
indent: ["error", 2],
},
},
];
Loading

0 comments on commit 95339f6

Please sign in to comment.