Skip to content

Commit

Permalink
setting up prettier and eslint together
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-bierman committed Aug 25, 2023
1 parent ff776c9 commit ae6f165
Show file tree
Hide file tree
Showing 6 changed files with 274 additions and 230 deletions.
35 changes: 35 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Docker related
docker-compose.yml

# Node modules and package files
node_modules/
package-lock.json
package.json

# README and other markdowns might be formatted, but if you're facing errors, you can ignore them
README.md

# Configuration files
# server/.eslintrc.js
server/nodemon.json
server/package-lock.json
server/package.json

# Client
# client/.eslintrc.js
client/package-lock.json
client/package.json

# Service account and other JSONs that shouldn't be tampered with
server/serviceAccountKey.example.json

# Binary files and other misc files (if any)
*.jpg
*.png
*.gif
*.pdf
*.key

# Any build or dist directory
dist/
build/
152 changes: 75 additions & 77 deletions client/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,81 +1,79 @@
module.exports = {
"env": {
"browser": true,
"es2021": true,
env: {
browser: true,
es2021: true,
},
extends: [
"standard-with-typescript",
"plugin:@typescript-eslint/recommended",
"prettier",
],
overrides: [
{
env: {
node: true,
},
files: [".eslintrc.{js,cjs,jsx,ts,tsx}"],
parserOptions: {
sourceType: "script",
},
},
"extends": [
"standard-with-typescript",
],
"overrides": [
{
"env": {
"node": true
},
"files": [
".eslintrc.{js,cjs,jsx,ts,tsx}"
],
"parserOptions": {
"sourceType": "script"
},
}
],
"ignorePatterns": [
".eslintrc.js",
"**/node_modules/**",
"**/dist/**",
"**/coverage/**",
"**/build/**",
"**/android/**",
"**/ios/**",
"**/web/**",
"**/config/**",
"**/constants/**",
"**/types/**",
"**/public/**",
"babel.config.js",
"metro.config.js",
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": "latest",
"sourceType": "module",
"project": "./tsconfig.json"
],
ignorePatterns: [
".eslintrc.js",
"**/node_modules/**",
"**/dist/**",
"**/coverage/**",
"**/build/**",
"**/android/**",
"**/ios/**",
"**/web/**",
"**/config/**",
"**/constants/**",
"**/types/**",
"**/public/**",
"babel.config.js",
"metro.config.js",
],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
"plugins": [
"react",
"react-native"
],
"rules": {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/prefer-nullish-coalescing": "off",
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/no-explicit-any": "off",
"react-native/no-inline-styles": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"eqeqeq": "off",
"@typescript-eslint/naming-convention": "off",
"no-unreachable": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-confusing-void-expression": "off",
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/no-misused-promises": "off",
"import/no-duplicates": "off",
"multiline-ternary": "off",
"no-dupe-keys": "off",
"@typescript-eslint/ban-ts-comment": "off",
"array-callback-return": "off",
"@typescript-eslint/array-callback-return": "off",
"no-empty": "off",
"operator-linebreak": "off",
"@typescript-eslint/await-thenable": "off",
"@typescript-eslint/prefer-optional-chain": "off",
ecmaVersion: "latest",
sourceType: "module",
project: "./tsconfig.json",
},
plugins: ["react", "react-native", "@typescript-eslint", "prettier"],
rules: {
"prettier/prettier": "error",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/prefer-nullish-coalescing": "off",
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/no-explicit-any": "off",
"react-native/no-inline-styles": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/restrict-template-expressions": "off",
eqeqeq: "off",
"@typescript-eslint/naming-convention": "off",
"no-unreachable": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-confusing-void-expression": "off",
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/no-misused-promises": "off",
"import/no-duplicates": "off",
"multiline-ternary": "off",
"no-dupe-keys": "off",
"@typescript-eslint/ban-ts-comment": "off",
"array-callback-return": "off",
"@typescript-eslint/array-callback-return": "off",
"no-empty": "off",
"operator-linebreak": "off",
"@typescript-eslint/await-thenable": "off",
"@typescript-eslint/prefer-optional-chain": "off",
},
settings: {
react: {
version: "detect",
},
"settings": {
"react": {
"version": "detect"
}
}
}
},
};
4 changes: 3 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
"mapbox-gl": "^2.13.0",
"native-base": "^3.4.28",
"osmtogeojson": "^3.0.0-beta.5",
"prettier": "^2.8.8",
"react": "18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.45.4",
Expand Down Expand Up @@ -116,11 +115,14 @@
"@types/react-test-renderer": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^6.4.1",
"eslint": "^8.47.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-standard-with-typescript": "^38.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-n": "^16.0.2",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.33.2",
"prettier": "^3.0.2",
"typescript": "^5.1.6"
},
"overrides": {
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"test:all": "npm run test:client && npm run test:server",
"test:client": "npm test --prefix client",
"test:server": "npm test --prefix server",
"prepare": "husky install",
"lint:all": "npm run lint:client && npm run lint:server",
"lint:client": "npm run lint --prefix client",
"lint:server": "npm run lint --prefix server"
Expand Down
Loading

0 comments on commit ae6f165

Please sign in to comment.