Przeglądaj źródła

remove jsx and react from eslint config and add eslint modules

Ersun Warncke 7 lat temu
rodzic
commit
b31022e329

+ 1 - 32
libraries/logger/.eslintrc

@@ -1,14 +1,10 @@
 {
 {
   "extends": [
   "extends": [
     "standard",
     "standard",
-    "standard-react",
     "prettier",
     "prettier",
-    "prettier/react",
-    "prettier/standard",
-    "plugin:jsx-a11y/recommended"
+    "prettier/standard"
   ],
   ],
   "plugins": [
   "plugins": [
-    "jsx-a11y",
     "mocha",
     "mocha",
     "chai-expect",
     "chai-expect",
     "chai-friendly"
     "chai-friendly"
@@ -19,17 +15,8 @@
   "globals": {
   "globals": {
     "expect": true,
     "expect": true,
     "define": true,
     "define": true,
-    "$": true,
-    "angular": true,
-    // Injected in layout.pug
-    "user_id": true,
-    "ace": true
   },
   },
   "settings": {
   "settings": {
-    // Tell eslint-plugin-react to detect which version of React we are using
-    "react": {
-      "version": "detect"
-    }
   },
   },
   "rules": {
   "rules": {
     "max-len": ["error", {
     "max-len": ["error", {
@@ -38,24 +25,6 @@
       "ignorePattern": "(^\\s*(it|describe)\\s*\\(['\"]|^import\\s*.*\\s*from\\s*['\"]|^.*\\s*=\\s*require\\(['\"])"
       "ignorePattern": "(^\\s*(it|describe)\\s*\\(['\"]|^import\\s*.*\\s*from\\s*['\"]|^.*\\s*=\\s*require\\(['\"])"
     }],
     }],
 
 
-    // Fix conflict between prettier & standard by overriding to prefer
-    // double quotes
-    "jsx-quotes": ["error", "prefer-double"],
-
-    // Override weird behaviour of jsx-a11y label-has-for (says labels must be
-    // nested *and* have for/id attributes)
-    "jsx-a11y/label-has-for": [
-      "error",
-      {
-        "required": {
-          "some": [
-            "nesting",
-            "id"
-          ]
-        }
-      }
-    ],
-
     // Add some mocha specific rules
     // Add some mocha specific rules
     "mocha/handle-done-callback": "error",
     "mocha/handle-done-callback": "error",
     "mocha/no-exclusive-tests": "error",
     "mocha/no-exclusive-tests": "error",

+ 4 - 1
libraries/logger/logging-manager.js

@@ -1,7 +1,7 @@
 const bunyan = require('bunyan')
 const bunyan = require('bunyan')
 const request = require('request')
 const request = require('request')
 
 
-Logger = module.exports = {
+const Logger = module.exports = {
   initialize(name) {
   initialize(name) {
     this.isProduction =
     this.isProduction =
       (process.env['NODE_ENV'] || '').toLowerCase() === 'production'
       (process.env['NODE_ENV'] || '').toLowerCase() === 'production'
@@ -50,6 +50,9 @@ Logger = module.exports = {
       }-setLogLevelEndTime`
       }-setLogLevelEndTime`
     }
     }
     request(options, (err, response, body) => {
     request(options, (err, response, body) => {
+      if (err) {
+        return
+      }
       if (parseInt(body) > Date.now()) {
       if (parseInt(body) > Date.now()) {
         this.logger.level('trace')
         this.logger.level('trace')
       } else {
       } else {

+ 12 - 1
libraries/logger/package.json

@@ -10,7 +10,8 @@
   "scripts": {
   "scripts": {
     "test": "mocha test/**/*.js",
     "test": "mocha test/**/*.js",
     "format": "prettier-eslint '**/*.js' --list-different",
     "format": "prettier-eslint '**/*.js' --list-different",
-    "format:fix": "prettier-eslint '**/*.js' --write"
+    "format:fix": "prettier-eslint '**/*.js' --write",
+    "lint": "eslint -f unix ."
   },
   },
   "dependencies": {
   "dependencies": {
     "bunyan": "1.8.12",
     "bunyan": "1.8.12",
@@ -19,6 +20,16 @@
   },
   },
   "devDependencies": {
   "devDependencies": {
     "chai": "4.2.0",
     "chai": "4.2.0",
+    "eslint": "^4.18.1",
+    "eslint-config-prettier": "^3.1.0",
+    "eslint-config-standard": "^11.0.0",
+    "eslint-plugin-chai-expect": "^1.1.1",
+    "eslint-plugin-chai-friendly": "^0.4.1",
+    "eslint-plugin-import": "^2.9.0",
+    "eslint-plugin-mocha": "^5.2.0",
+    "eslint-plugin-node": "^6.0.0",
+    "eslint-plugin-promise": "^3.6.0",
+    "eslint-plugin-standard": "^3.0.1",
     "mocha": "5.2.0",
     "mocha": "5.2.0",
     "sandboxed-module": "2.0.3",
     "sandboxed-module": "2.0.3",
     "sinon": "7.2.3",
     "sinon": "7.2.3",