forked from
jollywhoppers.com/witchsky.app
Bluesky app fork with some witchin' additions 馃挮
1const BANNED_IMPORT_PREFIXES = [
2 'alf/',
3 'components/',
4 'lib/',
5 'locale/',
6 'logger/',
7 'platform/',
8 'state/',
9 'storage/',
10 'view/',
11]
12
13module.exports = {
14 meta: {
15 type: 'suggestion',
16 fixable: 'code',
17 },
18 create(context) {
19 return {
20 ImportDeclaration(node) {
21 const source = node.source
22 if (typeof source.value !== 'string') {
23 return
24 }
25 if (
26 BANNED_IMPORT_PREFIXES.some(banned => source.value.startsWith(banned))
27 ) {
28 context.report({
29 node: source,
30 message: `Use '#/${source.value}'`,
31 fix(fixer) {
32 return fixer.replaceText(source, `'#/${source.value}'`)
33 },
34 })
35 }
36 },
37 }
38 },
39}