Skip to content

Commit 829a258

Browse files
committed
refactor(checkout): CHECKOUT-9388 Add eslint rule to enforce imports from essential package only if importing concrete implementations
1 parent 5565182 commit 829a258

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

.eslintrc.json

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,18 @@
8484
"fixStyle": "inline-type-imports",
8585
"disallowTypeAnnotations": false
8686
}
87+
],
88+
"@typescript-eslint/no-restricted-imports": [
89+
"error",
90+
{
91+
"paths": [
92+
{
93+
"name": "@bigcommerce/checkout-sdk",
94+
"message": "Direct imports from '@bigcommerce/checkout-sdk' are not allowed. Use type-only imports (import type { ... }) or import from subpaths like '@bigcommerce/checkout-sdk/essential' or '@bigcommerce/checkout-sdk/integrations'.",
95+
"allowTypeImports": true
96+
}
97+
]
98+
}
8799
]
88100
}
89101
},
@@ -138,7 +150,17 @@
138150
"plugin:jest-dom/recommended"
139151
],
140152
"rules": {
141-
"@typescript-eslint/consistent-type-assertions": "off"
153+
"@typescript-eslint/consistent-type-assertions": "off",
154+
"@typescript-eslint/no-restricted-imports": "off"
155+
}
156+
},
157+
{
158+
"files": [
159+
"*.mock.ts",
160+
"*.mock.tsx"
161+
],
162+
"rules": {
163+
"@typescript-eslint/no-restricted-imports": "off"
142164
}
143165
}
144166
]

0 commit comments

Comments
 (0)