Browse Source

eslint-config: tweaking

Mokhtar Naamani 4 years ago
parent
commit
4dcf537d3e
3 changed files with 30 additions and 28 deletions
  1. 9 11
      .editorconfig
  2. 19 16
      devops/eslint-config/index.js
  3. 2 1
      package.json

+ 9 - 11
.editorconfig

@@ -1,16 +1,14 @@
 root = true
+
 [*]
-indent_style=tab
-indent_size=tab
-tab_width=4
-end_of_line=lf
+indent_style = space
+indent_size = 2
 charset=utf-8
-trim_trailing_whitespace=true
-max_line_length=120
-insert_final_newline=true
+trim_trailing_whitespace = true
+insert_final_newline = true
 
 [*.yml]
-indent_style=space
-indent_size=2
-tab_width=8
-end_of_line=lf
+indent_style = space
+indent_size = 2
+tab_width = 8
+end_of_line = lf

+ 19 - 16
devops/eslint-config/index.js

@@ -1,31 +1,34 @@
 module.exports = {
   env: {
-    es6: true,
+    es6: true
   },
   globals: {
-    Atomics: "readonly",
-    SharedArrayBuffer: "readonly",
+    Atomics: 'readonly',
+    SharedArrayBuffer: 'readonly'
   },
-  parser: "@typescript-eslint/parser",
+  parser: '@typescript-eslint/parser',
   parserOptions: {
     ecmaFeatures: {
-      jsx: true,
+      jsx: true
     },
     ecmaVersion: 2019,
-    sourceType: "module",
+    sourceType: 'module'
   },
   extends: [
-    "plugin:react/recommended",
-    "standard",
-    "plugin:jsx-a11y/recommended",
-    "plugin:prettier/recommended",
+    'plugin:react/recommended',
+    'standard',
+    'plugin:jsx-a11y/recommended',
+    // Disable eslint formatting related es-linting rules
+    'plugin:prettier/recommended',
+    'prettier/react',
+    'prettier/standard'
   ],
-  plugins: ["react", "react-hooks"],
+  plugins: ['react', 'react-hooks'],
   rules: {
-    "react-hooks/rules-of-hooks": "error",
-    "react-hooks/exhaustive-deps": "warn",
+    'react-hooks/rules-of-hooks': 'error',
+    'react-hooks/exhaustive-deps': 'warn'
   },
   settings: {
-    version: "detect",
-  },
-};
+    version: 'detect'
+  }
+}

+ 2 - 1
package.json

@@ -32,7 +32,8 @@
 		"eslint-plugin-jsx-a11y": "^6.2.3",
 		"eslint-plugin-prettier": "^3.1.3",
 		"eslint-plugin-react-hooks": "^4.0.4",
-		"husky": "^4.2.5"
+		"husky": "^4.2.5",
+		"prettier": "2.0.2"
 	},
 	"husky": {
 	  "hooks": {