Skip to content

Commit

Permalink
also automatically organize imports (#10)
Browse files Browse the repository at this point in the history
* also automatically organize imports

* run formatting
  • Loading branch information
codekansas authored May 28, 2024
1 parent 5a1d91a commit 47e3fe1
Show file tree
Hide file tree
Showing 12 changed files with 18,306 additions and 18,236 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Python Checks
name: CI Checks (Linting and Tests)

on:
push:
Expand Down
25 changes: 10 additions & 15 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,39 +1,34 @@
{
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features",
"editor.tabSize": 2,
"editor.formatOnSave": true
},
// Configuration languages.
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2,
"editor.formatOnSave": true
},
// Static frontend languages.
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features",
"editor.tabSize": 2,
"editor.formatOnSave": true
},
// React languages.
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2,
"editor.formatOnSave": true
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2,
"editor.codeActionsOnSave": {
"source.fixAll": "always"
},
"editor.formatOnSave": true
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "always"
},
"editor.formatOnSave": true
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2,
"editor.formatOnSave": true
},
// Backend languages.
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true,
Expand Down
22 changes: 19 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,38 @@ start-docker:
@docker run --name store-db -d -p 8000:8000 amazon/dynamodb-local

# ------------------------ #
# Static Checks #
# Code Formatting #
# ------------------------ #

format:
format-backend:
@black store
@ruff format store
.PHONY: format

format-frontend:
@cd frontend && npm run format
.PHONY: format

static-checks:
format: format-backend format-frontend
.PHONY: format

# ------------------------ #
# Static Checks #
# ------------------------ #

static-checks-backend:
@black --diff --check store
@ruff check store
@mypy --install-types --non-interactive store
.PHONY: lint

static-checks-frontend:
@cd frontend && npm run lint
.PHONY: lint

static-checks: static-checks-backend static-checks-frontend
.PHONY: lint

# ------------------------ #
# Unit tests #
# ------------------------ #
Expand Down
40 changes: 40 additions & 0 deletions frontend/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module.exposts = {
env: {
browser: true,
es2021: true,
},
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:prettier/recommended",
],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 12,
sourceType: "module",
},
plugins: ["react", "import"],
rules: {
"import/order": [
"error",
{
groups: [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
],
"newlines-between": "always",
alphabetize: { order: "asc", caseInsensitive: true },
},
],
"prettier/prettier": "error",
},
};
3 changes: 2 additions & 1 deletion frontend/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"tabWidth": 2
"tabWidth": 2,
"plugins": ["prettier-plugin-organize-imports"]
}
Loading

0 comments on commit 47e3fe1

Please sign in to comment.