about summary refs log tree commit diff
path: root/eslint/use-exact-imports.js
blob: 06723043fe981ad26e4737bb10e8f56b630a69d6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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',
        })
      }
    },
  }
}