Bluesky app fork with some witchin' additions 馃挮
witchsky.app
bluesky
fork
client
1const BANNED_IMPORT_PREFIXES = [
2 'alf/',
3 'components/',
4 'lib/',
5 'locale/',
6 'logger/',
7 'platform/',
8 'state/',
9 'storage/',
10 'view/',
11]
12
13/** @type {import('eslint').Rule.RuleModule} */
14module.exports = {
15 meta: {
16 type: 'suggestion',
17 docs: {
18 description: 'Enforce using prefixed imports for internal paths',
19 },
20 fixable: 'code',
21 schema: [],
22 },
23 create(context) {
24 return {
25 ImportDeclaration(node) {
26 const source = node.source
27 if (typeof source.value !== 'string') {
28 return
29 }
30 if (
31 BANNED_IMPORT_PREFIXES.some(banned => source.value.startsWith(banned))
32 ) {
33 context.report({
34 node: source,
35 message: `Use '#/${source.value}'`,
36 fix(fixer) {
37 return fixer.replaceText(source, `'#/${source.value}'`)
38 },
39 })
40 }
41 },
42 }
43 },
44}