From 54768389350f273106cc714f56671b0697b726d9 Mon Sep 17 00:00:00 2001 From: David Ernst Date: Thu, 15 Jun 2023 15:53:31 -0700 Subject: [PATCH] Add lint rule to warn about unused exports --- .eslintrc.js | 4 +++- package.json | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 59ecd71b..4f05eea0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -10,6 +10,7 @@ module.exports = { 'plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended', 'plugin:typescript-sort-keys/recommended', + 'plugin:import/typescript', ], parser: '@typescript-eslint/parser', parserOptions: { @@ -19,10 +20,11 @@ module.exports = { ecmaVersion: 2018, sourceType: 'module', }, - plugins: ['react', '@typescript-eslint', 'typescript-sort-keys', 'sort-destructure-keys', 'sort-keys-fix'], + plugins: ['react', '@typescript-eslint', 'typescript-sort-keys', 'sort-destructure-keys', 'sort-keys-fix', 'import'], rules: { '@typescript-eslint/explicit-module-boundary-types': 0, // Verbose '@typescript-eslint/no-empty-function': 0, // unnecessary + 'import/no-unused-modules': [1, { unusedExports: true }], // Warn about dead code noise 'react/jsx-sort-props': [2, { callbacksLast: true, shorthandFirst: true }], // style 'react/react-in-jsx-scope': 0, // Handled by Next.js 'sort-destructure-keys/sort-destructure-keys': 2, // style diff --git a/package.json b/package.json index d6355b07..f4263354 100644 --- a/package.json +++ b/package.json @@ -96,6 +96,7 @@ "eslint": "^8", "eslint-config-prettier": "^6.10.1", "eslint-plugin-cypress": "^2.12.1", + "eslint-plugin-import": "^2.27.5", "eslint-plugin-react": "^7.20.1", "eslint-plugin-sort-destructure-keys": "^1.3.5", "eslint-plugin-sort-keys-fix": "^1.1.1",