Use exact imports for icons (#4549)
* Use exact imports for icons * Add a lint rule
This commit is contained in:
parent
e6213d7aa5
commit
e30575c0dc
4 changed files with 27 additions and 3 deletions
|
@ -4,6 +4,7 @@ module.exports = {
|
|||
rules: {
|
||||
'keep-i18n-patch-in-sync': require('./keep-i18n-patch-in-sync'),
|
||||
'avoid-unwrapped-text': require('./avoid-unwrapped-text'),
|
||||
'use-exact-imports': require('./use-exact-imports'),
|
||||
'use-typed-gates': require('./use-typed-gates'),
|
||||
},
|
||||
}
|
||||
|
|
22
eslint/use-exact-imports.js
Normal file
22
eslint/use-exact-imports.js
Normal file
|
@ -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',
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue