Skip to content

Commit

Permalink
feat: add eslint rules for new import styles
Browse files Browse the repository at this point in the history
  • Loading branch information
kubabutkiewicz committed Dec 12, 2024
1 parent 6b32ced commit 9eba690
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion .eslintrc.changed.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,35 @@ module.exports = {
},
rules: {
'deprecation/deprecation': 'error',
'no-restricted-syntax': [
'error',
{
selector: "ImportNamespaceSpecifier[parent.source.value=/^@libs/]",
message: 'Namespace imports are not allowed. Use named imports instead. Example: import { method } from "@libs/module"'
},
{
selector: "ImportNamespaceSpecifier[parent.source.value=/^@userActions/]",
message: 'Namespace imports from @userActions are not allowed. Use named imports instead. Example: import { action } from "@useractions/module"'
}
]
},
};
overrides: [
{
files: ['**/libs/**/*.{ts,tsx,js,jsx}'],
rules: {
'no-restricted-syntax': [
'error',
{
selector: "ImportNamespaceSpecifier[parent.source.value=/^\\.\\./]",
message: 'Namespace imports are not allowed. Use named imports instead. Example: import { method } from "../libs/module"'
},
{
selector: "ImportNamespaceSpecifier[parent.source.value=/^\\./]",
message: 'Namespace imports are not allowed. Use named imports instead. Example: import { method } from "./libs/module"'
},

]
}
}
]
};

0 comments on commit 9eba690

Please sign in to comment.