diff --git a/common/.eslintrc.js b/common/.eslintrc.js index c6f9703e..5212207a 100644 --- a/common/.eslintrc.js +++ b/common/.eslintrc.js @@ -1,5 +1,5 @@ module.exports = { - plugins: ['lodash'], + plugins: ['lodash', 'unused-imports'], extends: ['eslint:recommended'], ignorePatterns: ['lib'], env: { @@ -26,6 +26,7 @@ module.exports = { caughtErrorsIgnorePattern: '^_', }, ], + 'unused-imports/no-unused-imports': 'error', }, }, ], diff --git a/functions/.eslintrc.js b/functions/.eslintrc.js index 2c607231..55070858 100644 --- a/functions/.eslintrc.js +++ b/functions/.eslintrc.js @@ -1,5 +1,5 @@ module.exports = { - plugins: ['lodash'], + plugins: ['lodash', 'unused-imports'], extends: ['eslint:recommended'], ignorePatterns: ['dist', 'lib'], env: { @@ -26,6 +26,7 @@ module.exports = { caughtErrorsIgnorePattern: '^_', }, ], + 'unused-imports/no-unused-imports': 'error', }, }, ], diff --git a/package.json b/package.json index 05924ef0..e90daf86 100644 --- a/package.json +++ b/package.json @@ -8,20 +8,22 @@ "web" ], "scripts": { - "verify": "(cd web && yarn verify:dir); (cd functions && yarn verify:dir)" + "verify": "(cd web && yarn verify:dir); (cd functions && yarn verify:dir)", + "lint": "eslint common --fix ; eslint web --fix ; eslint functions --fix" }, "dependencies": {}, "devDependencies": { + "@types/node": "16.11.11", "@typescript-eslint/eslint-plugin": "5.25.0", "@typescript-eslint/parser": "5.25.0", - "@types/node": "16.11.11", "concurrently": "6.5.1", "eslint": "8.15.0", "eslint-plugin-lodash": "^7.4.0", + "eslint-plugin-unused-imports": "^2.0.0", + "nodemon": "2.0.19", "prettier": "2.5.0", - "typescript": "4.6.4", "ts-node": "10.9.1", - "nodemon": "2.0.19" + "typescript": "4.6.4" }, "resolutions": { "@types/react": "17.0.43" diff --git a/web/.eslintrc.js b/web/.eslintrc.js index 0f103080..56f12813 100644 --- a/web/.eslintrc.js +++ b/web/.eslintrc.js @@ -1,6 +1,6 @@ module.exports = { parser: '@typescript-eslint/parser', - plugins: ['lodash'], + plugins: ['lodash', 'unused-imports'], extends: [ 'plugin:@typescript-eslint/recommended', 'plugin:react-hooks/recommended', @@ -22,6 +22,7 @@ module.exports = { '@next/next/no-typos': 'off', 'linebreak-style': ['error', 'unix'], 'lodash/import-scope': [2, 'member'], + 'unused-imports/no-unused-imports': 'error', }, env: { browser: true, diff --git a/web/hooks/use-follows.ts b/web/hooks/use-follows.ts index 2b418658..c23543a7 100644 --- a/web/hooks/use-follows.ts +++ b/web/hooks/use-follows.ts @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react' import { listenForFollowers, listenForFollows } from 'web/lib/firebase/users' -import { contracts, listenForContractFollows } from 'web/lib/firebase/contracts' +import { listenForContractFollows } from 'web/lib/firebase/contracts' export const useFollows = (userId: string | null | undefined) => { const [followIds, setFollowIds] = useState() diff --git a/yarn.lock b/yarn.lock index f49b1ccf..e0e1eefa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5865,6 +5865,18 @@ eslint-plugin-react@^7.29.4: semver "^6.3.0" string.prototype.matchall "^4.0.7" +eslint-plugin-unused-imports@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-unused-imports/-/eslint-plugin-unused-imports-2.0.0.tgz#d8db8c4d0cfa0637a8b51ce3fd7d1b6bc3f08520" + integrity sha512-3APeS/tQlTrFa167ThtP0Zm0vctjr4M44HMpeg1P4bK6wItarumq0Ma82xorMKdFsWpphQBlRPzw/pxiVELX1A== + dependencies: + eslint-rule-composer "^0.3.0" + +eslint-rule-composer@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz#79320c927b0c5c0d3d3d2b76c8b4a488f25bbaf9" + integrity sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg== + eslint-scope@5.1.1, eslint-scope@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"