-
Notifications
You must be signed in to change notification settings - Fork 0
chore: set up linting and formatting infrastructure #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| #!/usr/bin/env sh | ||
| . "$(dirname -- "$0")/_/husky.sh" | ||
|
|
||
| # Run lint-staged for backend | ||
| cd backend && npx lint-staged | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| #!/usr/bin/env sh | ||
| . "$(dirname -- "$0")/_/husky.sh" | ||
|
|
||
| # Run type checking before push | ||
| # TODO: Re-enable tests after Vitest setup is complete | ||
| cd backend && npm run type-check | ||
| # cd backend && npm run type-check && npm test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "default": true, | ||
| "MD013": { | ||
| "line_length": 100, | ||
| "code_blocks": false, | ||
| "tables": false | ||
| }, | ||
| "MD033": false, | ||
| "MD041": false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # EditorConfig helps maintain consistent coding styles across different editors and IDEs | ||
| # https://editorconfig.org | ||
|
|
||
| root = true | ||
|
|
||
| [*] | ||
| charset = utf-8 | ||
| end_of_line = lf | ||
| insert_final_newline = true | ||
| trim_trailing_whitespace = true | ||
|
|
||
| [*.{js,ts,tsx,json,yml,yaml}] | ||
| indent_style = space | ||
| indent_size = 2 | ||
|
|
||
| [*.md] | ||
| trim_trailing_whitespace = false | ||
| max_line_length = 100 | ||
|
|
||
| [*.{sh,bash}] | ||
| indent_style = space | ||
| indent_size = 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "*.{ts,tsx}": ["eslint --fix", "prettier --write"], | ||
| "*.{json,md}": ["prettier --write"], | ||
| "*.md": ["markdownlint-cli2 --fix"] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "default": true, | ||
| "MD013": { | ||
| "line_length": 100, | ||
| "code_blocks": false, | ||
| "tables": false | ||
| }, | ||
| "MD033": false, | ||
| "MD041": false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| node_modules | ||
| dist | ||
| coverage | ||
| *.log | ||
| .env | ||
| .env.local | ||
| package-lock.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "semi": true, | ||
| "trailingComma": "all", | ||
| "singleQuote": false, | ||
| "printWidth": 80, | ||
| "tabWidth": 2, | ||
| "useTabs": false, | ||
| "arrowParens": "always", | ||
| "endOfLine": "lf", | ||
| "bracketSpacing": true, | ||
| "overrides": [ | ||
| { | ||
| "files": "*.md", | ||
| "options": { | ||
| "printWidth": 100, | ||
| "proseWrap": "always" | ||
| } | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| import js from "@eslint/js"; | ||
| import tsPlugin from "@typescript-eslint/eslint-plugin"; | ||
| import tsParser from "@typescript-eslint/parser"; | ||
| import prettierConfig from "eslint-config-prettier"; | ||
|
|
||
| export default [ | ||
| js.configs.recommended, | ||
| { | ||
| files: ["**/*.ts", "**/*.tsx"], | ||
| languageOptions: { | ||
| parser: tsParser, | ||
| parserOptions: { | ||
| ecmaVersion: "latest", | ||
| sourceType: "module", | ||
| project: "./tsconfig.json", | ||
| }, | ||
| globals: { | ||
| console: "readonly", | ||
| process: "readonly", | ||
| Buffer: "readonly", | ||
| __dirname: "readonly", | ||
| __filename: "readonly", | ||
| NodeJS: "readonly", | ||
| }, | ||
| }, | ||
| plugins: { | ||
| "@typescript-eslint": tsPlugin, | ||
| }, | ||
| rules: { | ||
| ...tsPlugin.configs.recommended.rules, | ||
|
|
||
| // TypeScript specific rules | ||
| "@typescript-eslint/explicit-function-return-type": "off", | ||
| "@typescript-eslint/explicit-module-boundary-types": "off", | ||
| "@typescript-eslint/no-explicit-any": "warn", | ||
| "@typescript-eslint/no-unused-vars": [ | ||
| "error", | ||
| { | ||
| argsIgnorePattern: "^_", | ||
| varsIgnorePattern: "^_", | ||
| }, | ||
| ], | ||
|
|
||
| // General rules | ||
| "no-console": "off", // Allow console in Node.js backend | ||
| "no-unused-vars": "off", // Use TS version instead | ||
|
|
||
| // Code quality | ||
| "prefer-const": "error", | ||
| "no-var": "error", | ||
| eqeqeq: ["error", "always"], | ||
| curly: ["error", "all"], | ||
| }, | ||
| }, | ||
| { | ||
| files: ["**/*.test.ts", "**/*.spec.ts"], | ||
| languageOptions: { | ||
| globals: { | ||
| describe: "readonly", | ||
| it: "readonly", | ||
| expect: "readonly", | ||
| beforeEach: "readonly", | ||
| afterEach: "readonly", | ||
| beforeAll: "readonly", | ||
| afterAll: "readonly", | ||
| vi: "readonly", | ||
| }, | ||
| }, | ||
| rules: { | ||
| "@typescript-eslint/no-explicit-any": "off", // Allow any in tests | ||
| }, | ||
| }, | ||
| prettierConfig, // Must be last to override other configs | ||
| { | ||
| ignores: [ | ||
| "node_modules/**", | ||
| "dist/**", | ||
| "coverage/**", | ||
| "*.js", // Ignore JS files in root (like this config) | ||
| ], | ||
| }, | ||
| ]; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a big question about using Husky. I don’t think it’s necessary, and I’m worried it will actually make our work more complicated. It’s much more convenient to make intermediate commits without thinking about the linter every time, and then run one general check before pushing. So I suggest we remove .husky/pre-commit.