From 39ca2e530cd108368f49bf3ee1e5f1e64e4fcf1c Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 17 Oct 2020 21:38:48 +0530 Subject: [PATCH] Adds json linting and adds lint to ci --- .eslintrc.json | 4 +++- .github/workflows/checks.yml | 4 ++++ domains/@.json | 2 +- package.json | 3 ++- yarn.lock | 44 ++++++++++++++++++++++++++++++++++++ 5 files changed, 54 insertions(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 61b4916de..33dc25fe3 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,12 +1,14 @@ { "extends": [ "eslint:recommended", - "plugin:node/recommended" + "plugin:node/recommended", + "plugin:json/recommended" ], "parserOptions": { "ecmaVersion": 2020 }, "rules": { + "indent": ["error", 2], "node/exports-style": ["error", "module.exports"], "node/file-extension-in-import": ["error", "always"], "node/prefer-global/buffer": ["error", "always"], diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 6ff9fe1cd..2e43a9291 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -15,6 +15,10 @@ jobs: uses: borales/actions-yarn@v2.0.0 with: cmd: install + - name: Linting + uses: borales/actions-yarn@v2.0.0 + with: + cmd: lint - name: Running tests uses: borales/actions-yarn@v2.0.0 with: diff --git a/domains/@.json b/domains/@.json index 1a088239e..60b51ee6c 100644 --- a/domains/@.json +++ b/domains/@.json @@ -6,4 +6,4 @@ "email": "phenax5@gmail.com" }, "record": {} -} \ No newline at end of file +} diff --git a/package.json b/package.json index 9155ff64a..fcdd4252f 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ }, "scripts": { "test": "ENV=test jest", - "lint": "eslint utils scripts", + "lint": "eslint utils scripts domains --ext .json,.js", "publish-records": "node ./scripts/register-domains.js" }, "repository": { @@ -28,6 +28,7 @@ }, "devDependencies": { "eslint": "^7.11.0", + "eslint-plugin-json": "^2.1.2", "eslint-plugin-node": "^11.1.0" } } diff --git a/yarn.lock b/yarn.lock index a14509ba4..52437eede 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1278,6 +1278,14 @@ eslint-plugin-es@^3.0.0: eslint-utils "^2.0.0" regexpp "^3.0.0" +eslint-plugin-json@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-json/-/eslint-plugin-json-2.1.2.tgz#5bc1c221984583c0c5ff21c488386e8263a6bbb7" + integrity sha512-isM/fsUxS4wN1+nLsWoV5T4gLgBQnsql3nMTr8u+cEls1bL8rRQO5CP5GtxJxaOfbcKqnz401styw+H/P+e78Q== + dependencies: + lodash "^4.17.19" + vscode-json-languageservice "^3.7.0" + eslint-plugin-node@^11.1.0: version "11.1.0" resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz#c95544416ee4ada26740a30474eefc5402dc671d" @@ -2523,6 +2531,11 @@ json5@^2.1.2: dependencies: minimist "^1.2.5" +jsonc-parser@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-2.3.1.tgz#59549150b133f2efacca48fe9ce1ec0659af2342" + integrity sha512-H8jvkz1O50L3dMZCsLqiuB2tA7muqbSg1AtGEkN0leAqGjsUzDJir3Zwr02BhqdcITPg3ei3mZ+HjMocAknhhg== + jsprim@^1.2.2: version "1.4.1" resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2" @@ -3799,6 +3812,37 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" +vscode-json-languageservice@^3.7.0: + version "3.9.1" + resolved "https://registry.yarnpkg.com/vscode-json-languageservice/-/vscode-json-languageservice-3.9.1.tgz#f72b581f8cd2bd9b47445ccf8b0ddcde6aba7483" + integrity sha512-oJkknkdCVitQ5XPSRa0weHjUxt8eSCptaL+MBQQlRsa6Nb8XnEY0S5wYnLUFHzEvKzwt01/LKk8LdOixWEXkNA== + dependencies: + jsonc-parser "^2.3.1" + vscode-languageserver-textdocument "^1.0.1" + vscode-languageserver-types "3.16.0-next.2" + vscode-nls "^5.0.0" + vscode-uri "^2.1.2" + +vscode-languageserver-textdocument@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.1.tgz#178168e87efad6171b372add1dea34f53e5d330f" + integrity sha512-UIcJDjX7IFkck7cSkNNyzIz5FyvpQfY7sdzVy+wkKN/BLaD4DQ0ppXQrKePomCxTS7RrolK1I0pey0bG9eh8dA== + +vscode-languageserver-types@3.16.0-next.2: + version "3.16.0-next.2" + resolved "https://registry.yarnpkg.com/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0-next.2.tgz#940bd15c992295a65eae8ab6b8568a1e8daa3083" + integrity sha512-QjXB7CKIfFzKbiCJC4OWC8xUncLsxo19FzGVp/ADFvvi87PlmBSCAtZI5xwGjF5qE0xkLf0jjKUn3DzmpDP52Q== + +vscode-nls@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.0.tgz#99f0da0bd9ea7cda44e565a74c54b1f2bc257840" + integrity sha512-u0Lw+IYlgbEJFF6/qAqG2d1jQmJl0eyAGJHoAJqr2HT4M2BNuQYSEiSE75f52pXHSJm8AlTjnLLbBFPrdz2hpA== + +vscode-uri@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-2.1.2.tgz#c8d40de93eb57af31f3c715dd650e2ca2c096f1c" + integrity sha512-8TEXQxlldWAuIODdukIb+TR5s+9Ds40eSJrw+1iDDA9IFORPjMELarNQE3myz5XIkWWpdprmJjm1/SxMlWOC8A== + w3c-hr-time@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd"