Add eslint rule to fix imports without the #/ path alias (#5175)

This commit is contained in:
Samuel Newman
2024-09-20 09:11:29 +01:00
committed by GitHub
parent 22410a3cee
commit f42d44112d
4 changed files with 45 additions and 4 deletions
+4 -4
View File
@@ -1,4 +1,3 @@
/* eslint-disable bsky-internal/use-exact-imports */
const BANNED_IMPORTS = [
'@fortawesome/free-regular-svg-icons',
'@fortawesome/free-solid-svg-icons',
@@ -6,11 +5,12 @@ const BANNED_IMPORTS = [
exports.create = function create(context) {
return {
Literal(node) {
if (typeof node.value !== 'string') {
ImportDeclaration(node) {
const source = node.source
if (typeof source.value !== 'string') {
return
}
if (BANNED_IMPORTS.includes(node.value)) {
if (BANNED_IMPORTS.includes(source.value)) {
context.report({
node,
message: