From 01fb23f09d6f3ac5d85181b6379929ded8a5409c Mon Sep 17 00:00:00 2001 From: David Velasco Date: Wed, 9 Sep 2020 19:59:02 +0200 Subject: [PATCH] feat: add eslint support --- .eslintignore | 26 ++++++++++++++++++++++++++ .eslintrc | 21 +++++++++++++++++++++ package.json | 7 +++++-- 3 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 .eslintignore create mode 100644 .eslintrc diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..9534f40 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,26 @@ +# ignore code-generated contents +migrations/* +models/* +# patches/* +resolvers/* +schemas/* +# validations/* + +# un-ignore static migrations +!migrations/default-sql +migrations/default-sql/* + +# un-ignore static models +!models/sql +models/sql/* +!models/index.js + +# un-ignore static models/adapters +!models/adapters +models/adapters/* +!models/adapters/index.js + +# un-ignore all role, user, and role_to_user static files +!**/*role_to_user.js +!**/*role.js +!**/*user.js \ No newline at end of file diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..390dd39 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,21 @@ +{ + "root": true, + "env": { + "es6": true, + "node": true + }, + "parser": "babel-eslint", + "rules": { + + "indent": [ "warn", 2 ], + + "linebreak-style": [ "error", "unix" ], + + "no-unused-vars": [ "warn", { "args": "none" }], + + "quotes": [ "warn", "single" ], + + "semi": [ "error", "always" ] + + } +} \ No newline at end of file diff --git a/package.json b/package.json index 0ab7dff..7104884 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "Schema as string", "main": "index.js", "scripts": { + "lint": "eslint .", "start": "node server.js", "test": "mocha test/test.js --exit" }, @@ -49,8 +50,10 @@ "xlsx": "^0.16.1" }, "devDependencies": { - "mocha": "^7.1.2", "axios": "^0.19.2", - "form-data": "^3.0.0" + "babel-eslint": "^10.1.0", + "eslint": "^7.8.1", + "form-data": "^3.0.0", + "mocha": "^7.1.2" } }