-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeny-import-from-ionic-module.ts
More file actions
32 lines (30 loc) · 892 Bytes
/
deny-import-from-ionic-module.ts
File metadata and controls
32 lines (30 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { TSESLint } from '@typescript-eslint/utils';
const rule: TSESLint.RuleModule<'denyImportFromIonicModule', []> = {
defaultOptions: [],
meta: {
docs: {
description: 'This plugin prevents accidental imports from @ionic/angular instead of @ionic/angular/standalone.',
url: '',
},
fixable: 'code',
messages: {
denyImportFromIonicModule: 'You must import from @ionic/angular/standalone instead of @ionic/angular.',
},
schema: [],
type: 'problem',
},
create: (context) => ({
ImportDeclaration(node) {
if (node.source.value === '@ionic/angular') {
context.report({
node: node.source,
messageId: 'denyImportFromIonicModule',
fix: (fixer) => {
return fixer.replaceText(node.source, "'@ionic/angular/standalone'");
},
});
}
},
}),
};
export = rule;