Parcourir la source

[misc] setup eslint and prettier and fix any errors

Jakob Ackermann il y a 5 ans
Parent
commit
8858f05eaa
5 fichiers modifiés avec 1043 ajouts et 52 suppressions
  1. 17 0
      .eslintrc
  2. 8 0
      .prettierrc
  3. 944 5
      package-lock.json
  4. 17 0
      package.json
  5. 57 47
      services.js

+ 17 - 0
.eslintrc

@@ -0,0 +1,17 @@
+{
+  "extends": [
+    "eslint:recommended",
+    "standard",
+    "prettier"
+  ],
+  "parserOptions": {
+    "ecmaVersion": 2018
+  },
+  "env": {
+    "node": true
+  },
+  "rules": {
+    // Do not allow importing of implicit dependencies.
+    "import/no-extraneous-dependencies": "error"
+  }
+}

+ 8 - 0
.prettierrc

@@ -0,0 +1,8 @@
+{
+  "arrowParens": "avoid",
+  "semi": false,
+  "singleQuote": true,
+  "trailingComma": "es5",
+  "tabWidth": 2,
+  "useTabs": false
+}

Fichier diff supprimé car celui-ci est trop grand
+ 944 - 5
package-lock.json


+ 17 - 0
package.json

@@ -2,6 +2,12 @@
   "name": "sharelatex",
   "version": "0.0.1",
   "description": "An online collaborative LaTeX editor",
+  "scripts": {
+    "lint": "eslint --max-warnings 0 --format unix .",
+    "lint:fix": "eslint --fix .",
+    "format": "prettier --list-different $PWD/'**/*.js'",
+    "format:fix": "prettier --write $PWD/'**/*.js'"
+  },
   "dependencies": {
     "async": "^0.9.0",
     "bson": "^1.0.4",
@@ -21,11 +27,22 @@
   "devDependencies": {
     "grunt": "~0.4.2",
     "bunyan": "~0.22.1",
+    "eslint": "^7.21.0",
+    "eslint-config-prettier": "^8.1.0",
+    "eslint-config-standard": "^16.0.2",
+    "eslint-plugin-chai-expect": "^2.2.0",
+    "eslint-plugin-chai-friendly": "^0.6.0",
+    "eslint-plugin-import": "^2.22.1",
+    "eslint-plugin-mocha": "^8.0.0",
+    "eslint-plugin-node": "^11.1.0",
+    "eslint-plugin-promise": "^4.2.1",
+    "eslint-plugin-standard": "^5.0.0",
     "grunt-bunyan": "~0.5.0",
     "grunt-execute": "~0.1.5",
     "grunt-available-tasks": "~0.4.1",
     "grunt-concurrent": "~0.4.3",
     "grunt-contrib-coffee": "~0.10.1",
+    "prettier": "^2.2.1",
     "semver": "~2.2.1",
     "knox": "~0.8.9"
   }

+ 57 - 47
services.js

@@ -1,47 +1,57 @@
-module.exports =
-
-[{
-	name: "web",
-	repo: "https://github.com/sharelatex/web-sharelatex.git",
-	version: "master"
-}, {
-	name: "real-time",
-	repo: "https://github.com/sharelatex/real-time-sharelatex.git",
-	version: "master"
-}, {
-	name: "document-updater",
-	repo: "https://github.com/sharelatex/document-updater-sharelatex.git",
-	version: "master"
-}, {
-	name: "clsi",
-	repo: "https://github.com/sharelatex/clsi-sharelatex.git",
-	version: "master"
-}, {
-	name: "filestore",
-	repo: "https://github.com/sharelatex/filestore-sharelatex.git",
-	version: "master"
-}, {
-	name: "track-changes",
-	repo: "https://github.com/sharelatex/track-changes-sharelatex.git",
-	version: "master"
-}, {
-	name: "docstore",
-	repo: "https://github.com/sharelatex/docstore-sharelatex.git",
-	version: "master"
-}, {
-	name: "chat",
-	repo: "https://github.com/sharelatex/chat-sharelatex.git",
-	version: "master"
-}, {
-	name: "spelling",
-	repo: "https://github.com/sharelatex/spelling-sharelatex.git",
-	version: "master"
-}, {
-	name: "contacts",
-	repo: "https://github.com/sharelatex/contacts-sharelatex.git",
-	version: "master"
-}, {
-	name: "notifications",
-	repo: "https://github.com/sharelatex/notifications-sharelatex.git",
-	version: "master"
-}]
+module.exports = [
+  {
+    name: 'web',
+    repo: 'https://github.com/sharelatex/web-sharelatex.git',
+    version: 'master',
+  },
+  {
+    name: 'real-time',
+    repo: 'https://github.com/sharelatex/real-time-sharelatex.git',
+    version: 'master',
+  },
+  {
+    name: 'document-updater',
+    repo: 'https://github.com/sharelatex/document-updater-sharelatex.git',
+    version: 'master',
+  },
+  {
+    name: 'clsi',
+    repo: 'https://github.com/sharelatex/clsi-sharelatex.git',
+    version: 'master',
+  },
+  {
+    name: 'filestore',
+    repo: 'https://github.com/sharelatex/filestore-sharelatex.git',
+    version: 'master',
+  },
+  {
+    name: 'track-changes',
+    repo: 'https://github.com/sharelatex/track-changes-sharelatex.git',
+    version: 'master',
+  },
+  {
+    name: 'docstore',
+    repo: 'https://github.com/sharelatex/docstore-sharelatex.git',
+    version: 'master',
+  },
+  {
+    name: 'chat',
+    repo: 'https://github.com/sharelatex/chat-sharelatex.git',
+    version: 'master',
+  },
+  {
+    name: 'spelling',
+    repo: 'https://github.com/sharelatex/spelling-sharelatex.git',
+    version: 'master',
+  },
+  {
+    name: 'contacts',
+    repo: 'https://github.com/sharelatex/contacts-sharelatex.git',
+    version: 'master',
+  },
+  {
+    name: 'notifications',
+    repo: 'https://github.com/sharelatex/notifications-sharelatex.git',
+    version: 'master',
+  },
+]

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff