about summary refs log tree commit diff
path: root/.eslintrc.js
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2024-03-13 15:49:24 +0000
committerSamuel Newman <mozzius@protonmail.com>2024-03-13 15:49:24 +0000
commit4d2efd84e437e0c93a66b678093012b5c064c725 (patch)
tree7344d8ad5614eed74c655fd6b44c9726109ca455 /.eslintrc.js
parent70c76a76a0d0285c28fa456c3af7741ad7a727cb (diff)
downloadvoidsky-4d2efd84e437e0c93a66b678093012b5c064c725.tar.zst
sort relative imports and move unprefixed ones
Diffstat (limited to '.eslintrc.js')
-rw-r--r--.eslintrc.js23
1 files changed, 18 insertions, 5 deletions
diff --git a/.eslintrc.js b/.eslintrc.js
index c1592b76a..a74bd79ea 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -28,15 +28,28 @@ module.exports = {
           // Packages.
           // Things that start with a letter (or digit or underscore), or `@` followed by a letter.
           // React/React Native priortized, followed by expo
+          // Followed by all packages excluding unprefixed relative ones
           [
-            '^(react/(.*)$)|^(react$)|^(react-native(.*)$)',
+            '^(react\\/(.*)$)|^(react$)|^(react-native(.*)$)',
             '^(expo(.*)$)|^(expo$)',
-            '^@?\\w',
-            '^',
+            '^(?!(?:alf|components|lib|locale|logger|platform|screens|state|view)(?:$|\\/))@?\\w',
           ],
           // Relative imports.
-          // Anything that starts with a dot or a #
-          ['^#', '^\\.'],
+          // Anything that starts with a dot
+          // due to unprefixed relative imports being used, we whitelist
+          // the relative paths we use
+          // (?:$|\\/) matches end of string or /
+          [
+            '^(?:#\\/)?(?:lib|state|logger|platform|locale)(?:$|\\/)',
+            '^(?:#\\/)?view(?:$|\\/)',
+            '^(?:#\\/)?screens(?:$|\\/)',
+            '^(?:#\\/)?alf(?:$|\\/)',
+            '^(?:#\\/)?components(?:$|\\/)',
+            '^#\\/',
+            '^\\.',
+          ],
+          // anything else - hopefully we don't have any of these
+          ['^'],
         ],
       },
     ],