about summary refs log tree commit diff
path: root/eslint
diff options
context:
space:
mode:
Diffstat (limited to 'eslint')
-rw-r--r--eslint/index.js1
-rw-r--r--eslint/use-exact-imports.js22
2 files changed, 23 insertions, 0 deletions
diff --git a/eslint/index.js b/eslint/index.js
index bb31a942d..cf5d41225 100644
--- a/eslint/index.js
+++ b/eslint/index.js
@@ -3,6 +3,7 @@
 module.exports = {
   rules: {
     'avoid-unwrapped-text': require('./avoid-unwrapped-text'),
+    'use-exact-imports': require('./use-exact-imports'),
     'use-typed-gates': require('./use-typed-gates'),
   },
 }
diff --git a/eslint/use-exact-imports.js b/eslint/use-exact-imports.js
new file mode 100644
index 000000000..06723043f
--- /dev/null
+++ b/eslint/use-exact-imports.js
@@ -0,0 +1,22 @@
+/* eslint-disable bsky-internal/use-exact-imports */
+const BANNED_IMPORTS = [
+  '@fortawesome/free-regular-svg-icons',
+  '@fortawesome/free-solid-svg-icons',
+]
+
+exports.create = function create(context) {
+  return {
+    Literal(node) {
+      if (typeof node.value !== 'string') {
+        return
+      }
+      if (BANNED_IMPORTS.includes(node.value)) {
+        context.report({
+          node,
+          message:
+            'Import the specific thing you want instead of the entire package',
+        })
+      }
+    },
+  }
+}