Skip to content

Commit 609e1a0

Browse files
committed
chore: add lint rule to not import spec components from index files
1 parent 228d527 commit 609e1a0

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

eslint.config.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,25 @@ module.exports = [
8484
"@typescript-eslint/no-non-null-assertion": "off",
8585
"@typescript-eslint/no-unused-vars": ["error", {"varsIgnorePattern": "^_"}],
8686
"no-unused-vars": "off",
87-
"no-undef": 'off'
87+
"no-undef": 'off',
88+
"no-restricted-imports": ["error", {
89+
"patterns": [
90+
{
91+
"group": ["*/index", "*/index.ts", "*/index.tsx", "**/index", "**/index.ts", "**/index.tsx"],
92+
"message": "Import from specific files instead of index to reduce bundle size. Use the specific component file (e.g., '../../button/button.spec' instead of '../../button/index')."
93+
}
94+
]
95+
}]
96+
}
97+
},
98+
{
99+
name: "html-components-index-exception",
100+
files: [
101+
"packages/html/src/index.ts",
102+
"packages/html/src/*/index.ts"
103+
],
104+
rules: {
105+
"no-restricted-imports": "off"
88106
}
89107
}
90108
]

0 commit comments

Comments
 (0)