Skip to content

Commit

Permalink
chore: genericize prettier config and add to apps/dashboard (#3396)
Browse files Browse the repository at this point in the history
* chore: genericise prettier config for apps/dashboard

This helps with format-on-save linting in IDEs like VSCode.

* chore: rename lib in .prettierignore

* fix: .prettier.config.js file name

* chore: add lint:fix script to dashboard

* chore: add eslint_d for faster fixing

---------

Co-authored-by: bodymindarts <[email protected]>
  • Loading branch information
vindard and bodymindarts authored Oct 20, 2023
1 parent 58eb8d1 commit abaaac7
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 16 deletions.
File renamed without changes.
3 changes: 2 additions & 1 deletion apps/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -42,6 +42,7 @@
"@types/react-dom": "latest",
"autoprefixer": "latest",
"eslint": "latest",
"eslint_d": "latest",
"eslint-config-next": "latest",
"postcss": "latest",
"tailwindcss": "latest",
Expand Down
3 changes: 3 additions & 0 deletions apps/dashboard/prettier.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const baseConfig = require("@galoy/eslint-config/prettier");

module.exports = baseConfig
2 changes: 1 addition & 1 deletion core/api/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
coverage
lib
dist
tmp
charts
protos
Expand Down
16 changes: 3 additions & 13 deletions lib/eslint-config/.eslintrc.base.js
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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",
Expand Down
16 changes: 16 additions & 0 deletions lib/eslint-config/.prettier.config.js
Original file line number Diff line number Diff line change
@@ -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",
}
1 change: 1 addition & 0 deletions lib/eslint-config/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ filegroup(
name = "src",
srcs = [
".eslintrc.base.js",
".prettier.config.js",
],
visibility = ["PUBLIC"],
)
3 changes: 2 additions & 1 deletion lib/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
26 changes: 26 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit abaaac7

Please sign in to comment.