Skip to content

Commit

Permalink
Add global formatting for the webapp. (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
ultraviolet10 authored Mar 3, 2024
2 parents 2fb40c1 + a5ada27 commit 639f9ff
Show file tree
Hide file tree
Showing 8 changed files with 148 additions and 185 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
Expand All @@ -20,4 +21,3 @@ jobs:
run: mkdir -p packages/contracts/out && echo "{}" > packages/contracts/out/deployment.json
- run: make setup
- run: make check

10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ==================================================================================================
# BASICS COMMANDS
# To get the project running locally.
# BASIC COMMANDS
# To get the project running locally.

# To be run when first setting up the repository.
setup: init-modules install-frozen
Expand Down Expand Up @@ -40,6 +40,12 @@ check:
cd packages/webapp && make check
.PHONY: check

# Performs code formatting for the webapp files and contracts in their respective directories.
format:
cd packages/webapp && make format
cd packages/contract && make format
.PHONY: format

# ==================================================================================================
# IMPLEMENTATION DETAILS

Expand Down
51 changes: 26 additions & 25 deletions packages/webapp/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
/** @type {import("eslint").Linter.Config} */
const config = {
extends: ["next/core-web-vitals", "plugin:@typescript-eslint/recommended"],
parser: '@typescript-eslint/parser',
parserOptions: {
project: "./tsconfig.json",
},
plugins: ['@typescript-eslint'],
root: true,
ignorePatterns: ["node_modules", "src/hooks/useScrollBox.ts"],
rules: {
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"react/no-unescaped-entities": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-ts-comment": "off",
extends: ["next/core-web-vitals", "plugin:@typescript-eslint/recommended", "prettier"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./tsconfig.json",
},
plugins: ["@typescript-eslint"],
root: true,
ignorePatterns: ["node_modules", "src/hooks/useScrollBox.ts"],
rules: {
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"react/no-unescaped-entities": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-ts-comment": "off",

"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{ // ignore unused args that start with underscore
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
],
},
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
// ignore unused args that start with underscore
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
},
}

module.exports = config
8 changes: 8 additions & 0 deletions packages/webapp/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"semi": false,
"trailingComma": "es5",
"singleQuote": false,
"tabWidth": 4,
"useTabs": false,
"printWidth": 120
}
11 changes: 9 additions & 2 deletions packages/webapp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,12 @@ lint:
.PHONY: lint

# Runs code quality checks.
check: lint build
.PHONY: check
check:
pnpm eslint .
pnpm prettier --check "**/*.{js,jsx,ts,tsx,json,css}"
.PHONY: check

# Runs prettier formatting across webapp files with specified file extensions.
format:
pnpm prettier --write "**/*.{js,jsx,ts,tsx,json,css}"
.PHONY: format
113 changes: 57 additions & 56 deletions packages/webapp/package.json
Original file line number Diff line number Diff line change
@@ -1,58 +1,59 @@
{
"name": "@xfable/webapp",
"version": "0.1.0",
"private": true,
"browser": {
"fs": false,
"path": false,
"os": false
},
"dependencies": {
"@dnd-kit/core": "^6.0.8",
"@dnd-kit/sortable": "^7.0.2",
"@dnd-kit/utilities": "^3.2.1",
"@emotion/react": "^11.11.1",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-navigation-menu": "^1.1.4",
"@radix-ui/react-slot": "^1.0.2",
"circomlibjs": "^0.1.7",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"connectkit": "^1.5.3",
"jotai": "^2.4.3",
"jotai-devtools": "^0.7.0",
"lodash": "^4.17.21",
"lucide-react": "^0.309.0",
"next": "^13.5.6",
"next-themes": "^0.2.1",
"next-transpile-modules": "^10.0.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-icons": "^4.11.0",
"snarkjs": "^0.7.1",
"sonner": "^1.4.0",
"tailwind-merge": "^2.2.0",
"tailwindcss-animate": "^1.0.7",
"viem": "^1.16.6",
"wagmi": "^1.4.5"
},
"devDependencies": {
"@swc-jotai/debug-label": "^0.1.0",
"@swc-jotai/react-refresh": "^0.1.0",
"@types/eslint": "^8.44.6",
"@types/lodash": "^4.14.200",
"@types/node": "^20.8.7",
"@types/react": "^18.2.31",
"@types/react-dom": "^18.2.14",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"@wagmi/cli": "^1.5.2",
"@welldone-software/why-did-you-render": "^7.0.1",
"autoprefixer": "^10.4.16",
"eslint": "^8.52.0",
"eslint-config-next": "^13.5.6",
"postcss": "^8.4.31",
"tailwindcss": "^3.3.3",
"typescript": "^5.2.2"
}
"name": "@xfable/webapp",
"version": "0.1.0",
"private": true,
"browser": {
"fs": false,
"path": false,
"os": false
},
"dependencies": {
"@dnd-kit/core": "^6.0.8",
"@dnd-kit/sortable": "^7.0.2",
"@dnd-kit/utilities": "^3.2.1",
"@emotion/react": "^11.11.1",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-navigation-menu": "^1.1.4",
"@radix-ui/react-slot": "^1.0.2",
"circomlibjs": "^0.1.7",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"connectkit": "^1.5.3",
"eslint-config-prettier": "^9.1.0",
"jotai": "^2.4.3",
"jotai-devtools": "^0.7.0",
"lodash": "^4.17.21",
"lucide-react": "^0.309.0",
"next": "^13.5.6",
"next-themes": "^0.2.1",
"next-transpile-modules": "^10.0.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-icons": "^4.11.0",
"snarkjs": "^0.7.1",
"sonner": "^1.4.0",
"tailwind-merge": "^2.2.0",
"tailwindcss-animate": "^1.0.7",
"viem": "^1.16.6",
"wagmi": "^1.4.5"
},
"devDependencies": {
"@swc-jotai/debug-label": "^0.1.0",
"@swc-jotai/react-refresh": "^0.1.0",
"@types/eslint": "^8.44.6",
"@types/lodash": "^4.14.200",
"@types/node": "^20.8.7",
"@types/react": "^18.2.31",
"@types/react-dom": "^18.2.14",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"@wagmi/cli": "^1.5.2",
"@welldone-software/why-did-you-render": "^7.0.1",
"autoprefixer": "^10.4.16",
"eslint": "^8.52.0",
"eslint-config-next": "^13.5.6",
"postcss": "^8.4.31",
"tailwindcss": "^3.3.3",
"typescript": "^5.2.2"
}
}
66 changes: 27 additions & 39 deletions packages/webapp/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,29 @@
{
"compilerOptions": {
"target": "es2022",
"baseUrl": "./src",
"paths": {
"src/*": [
"./*"
],
"contracts/*": [
"../../contracts/*"
]
},
"lib": [
"dom",
"dom.iterable",
"es2022"
],
"allowJs": true,
"checkJs": true,
"skipLibCheck": true,
"strict": true,
"alwaysStrict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
//"node_modules"
]
"compilerOptions": {
"target": "es2022",
"baseUrl": "./src",
"paths": {
"src/*": ["./*"],
"contracts/*": ["../../contracts/*"]
},
"lib": ["dom", "dom.iterable", "es2022"],
"allowJs": true,
"checkJs": true,
"skipLibCheck": true,
"strict": true,
"alwaysStrict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": [
//"node_modules"
]
}
Loading

0 comments on commit 639f9ff

Please sign in to comment.