From 933ce50c6815fd96ca51a1dd6f6553476a310781 Mon Sep 17 00:00:00 2001 From: Vitor Monteiro Date: Thu, 5 May 2022 23:20:10 -0300 Subject: [PATCH] :add: Added Eslint and Prettier --- .eslintrc.json | 59 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 10 ++++++++ prettier.config.js | 3 +++ 3 files changed, 72 insertions(+) create mode 100644 .eslintrc.json create mode 100644 prettier.config.js diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..cfcf017 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,59 @@ +{ + "env": { + "browser": true, + "es2021": true + }, + "extends": [ + "eslint:recommended", + "plugin:react/recommended", + "plugin:@typescript-eslint/recommended", + "prettier" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaFeatures": { + "jsx": true + }, + "ecmaVersion": "latest", + "sourceType": "module" + }, + "plugins": ["react", "@typescript-eslint"], + "rules": { + "indent": ["error", 2, { "SwitchCase": 1 }], + "linebreak-style": ["error", "unix"], + "quotes": ["error", "single"], + "jsx-quotes": ["error", "prefer-single"], + "semi": ["error", "always"], + "react/react-in-jsx-scope": "off", + "react/jsx-max-props-per-line": [ + 1, + { "maximum": { "single": 1, "multi": 1 } } + ], + + "no-case-declarations": "off", + "function-paren-newline": ["error", "multiline-arguments"], + "brace-style": ["error", "1tbs", { "allowSingleLine": true }], + "react/self-closing-comp": [ + "error", + { + "component": true, + "html": true + } + ], + "no-multiple-empty-lines": "error", + "react/jsx-curly-brace-presence": [ + 1, + { "children": "always", "props": "never", "propElementValues": "always" } + ], + "comma-dangle": [ + "error", + { + "arrays": "never", + "objects": "always-multiline", + "imports": "never", + "exports": "never", + "functions": "never" + } + ] + } + } \ No newline at end of file diff --git a/package.json b/package.json index e8f4f56..e678590 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,16 @@ "@babel/core": "^7.12.9", "@types/react": "~17.0.21", "@types/react-native": "~0.64.12", + "@typescript-eslint/eslint-plugin": "^5.22.0", + "@typescript-eslint/parser": "^5.22.0", + "eslint": "^8.14.0", + "eslint-config-airbnb": "^19.0.4", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-jsx-a11y": "^6.5.1", + "eslint-plugin-react": "^7.29.4", + "eslint-plugin-react-hooks": "^4.5.0", + "prettier": "^2.6.2", "typescript": "~4.3.5" }, "private": true diff --git a/prettier.config.js b/prettier.config.js new file mode 100644 index 0000000..43f9a36 --- /dev/null +++ b/prettier.config.js @@ -0,0 +1,3 @@ +export const singleQuote = false; +export const trailingComma = 'all'; +export const allowParens = 'avoid';