diff --git a/apps/dashboard/.eslintrc.cjs b/apps/dashboard/.eslintrc.js similarity index 100% rename from apps/dashboard/.eslintrc.cjs rename to apps/dashboard/.eslintrc.js diff --git a/apps/dashboard/package.json b/apps/dashboard/package.json index 780d85c8bd..9d3c829aaf 100644 --- a/apps/dashboard/package.json +++ b/apps/dashboard/package.json @@ -6,7 +6,7 @@ "dev": "next dev", "build": "next build", "start": "next start -p 3001", - "lint": "next lint", + "lint:fix": "eslint --fix --ext .ts,.tsx .", "codegen": "graphql-codegen --config codegen.yml" }, "dependencies": { @@ -42,6 +42,7 @@ "@types/react-dom": "latest", "autoprefixer": "latest", "eslint": "latest", + "eslint_d": "latest", "eslint-config-next": "latest", "postcss": "latest", "tailwindcss": "latest", diff --git a/apps/dashboard/prettier.config.cjs b/apps/dashboard/prettier.config.cjs new file mode 100644 index 0000000000..d34f78aaf6 --- /dev/null +++ b/apps/dashboard/prettier.config.cjs @@ -0,0 +1,3 @@ +const baseConfig = require("@galoy/eslint-config/prettier"); + +module.exports = baseConfig diff --git a/core/api/.prettierignore b/core/api/.prettierignore index f22edae5a4..e7b05e946f 100644 --- a/core/api/.prettierignore +++ b/core/api/.prettierignore @@ -1,5 +1,5 @@ coverage -lib +dist tmp charts protos diff --git a/lib/eslint-config/.eslintrc.base.js b/lib/eslint-config/.eslintrc.base.js index 3dc12ecd6e..97f9fb193e 100644 --- a/lib/eslint-config/.eslintrc.base.js +++ b/lib/eslint-config/.eslintrc.base.js @@ -1,6 +1,8 @@ +const prettierConfig = require('./.prettier.config'); const { execSync } = require('child_process'); const actualProjectDir = execSync('npm prefix').toString().replace(/\n/g, ''); + module.exports = { env: { browser: true, @@ -37,19 +39,7 @@ module.exports = { "prettier/prettier": [ "error", - { - semi: false, - trailingComma: "all", - printWidth: 90, - quoteProps: "consistent", - singleQuote: false, - tabWidth: 2, - useTabs: false, - bracketSpacing: true, - arrowParens: "always", - proseWrap: "preserve", - endOfLine: "lf" - } + prettierConfig ], "arrow-body-style": "off", diff --git a/lib/eslint-config/.prettier.config.js b/lib/eslint-config/.prettier.config.js new file mode 100644 index 0000000000..c23e0516c9 --- /dev/null +++ b/lib/eslint-config/.prettier.config.js @@ -0,0 +1,16 @@ +module.exports = { + // Custom: + semi: false, + trailingComma: "all", + printWidth: 90, + quoteProps: "consistent", + + // Defaults: + singleQuote: false, + tabWidth: 2, + useTabs: false, + bracketSpacing: true, + arrowParens: "always", + proseWrap: "preserve", + endOfLine: "lf", +} diff --git a/lib/eslint-config/BUCK b/lib/eslint-config/BUCK index 54b852e306..14487c9546 100644 --- a/lib/eslint-config/BUCK +++ b/lib/eslint-config/BUCK @@ -7,6 +7,7 @@ filegroup( name = "src", srcs = [ ".eslintrc.base.js", + ".prettier.config.js", ], visibility = ["PUBLIC"], ) diff --git a/lib/eslint-config/package.json b/lib/eslint-config/package.json index 44936be537..02f1d4a2f4 100644 --- a/lib/eslint-config/package.json +++ b/lib/eslint-config/package.json @@ -6,7 +6,8 @@ "preinstall": "npx only-allow pnpm" }, "exports": { - "./base": "./.eslintrc.base.js" + "./base": "./.eslintrc.base.js", + "./prettier": "./.prettier.config.js" }, "devDependencies": { "@typescript-eslint/eslint-plugin": "^6.8.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2216d7aceb..b3d759d635 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -209,6 +209,9 @@ importers: eslint-config-next: specifier: latest version: 13.5.4(eslint@8.51.0)(typescript@5.2.2) + eslint_d: + specifier: latest + version: 13.0.0 postcss: specifier: latest version: 8.4.31 @@ -8035,6 +8038,12 @@ packages: resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} dev: true + /core_d@6.0.0: + resolution: {integrity: sha512-r0d8vUgwRyf6Ln45YrJUYXBTrEdrj5XrljmdY5DpLuN+xQ2I5SKZ3iSTnnxEfSxnrhUmyiPIRr6WfRYqVT2huA==} + dependencies: + supports-color: 8.1.1 + dev: true + /cors@2.8.5: resolution: {integrity: sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==} engines: {node: '>= 0.10'} @@ -9432,6 +9441,18 @@ packages: - supports-color dev: true + /eslint_d@13.0.0: + resolution: {integrity: sha512-j9QABrJYIIm2hheAs5PbyTYtONP1dOYOJ1Nn007XxyEmsw1oplR0c+S8SxxIcL87UEAFB+q0/IiwFKm37oUnFQ==} + hasBin: true + dependencies: + core_d: 6.0.0 + eslint: 8.51.0 + nanolru: 1.0.0 + optionator: 0.9.3 + transitivePeerDependencies: + - supports-color + dev: true + /esm@3.2.25: resolution: {integrity: sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==} engines: {node: '>=6'} @@ -13631,6 +13652,11 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true + /nanolru@1.0.0: + resolution: {integrity: sha512-GyQkE8M32pULhQk7Sko5raoIbPalAk90ICG+An4fq6fCsFHsP6fB2K46WGXVdoJpy4SGMnZ/EKbo123fZJomWg==} + engines: {node: '>= 0.4.0'} + dev: true + /natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} dev: true