From 4d2efd84e437e0c93a66b678093012b5c064c725 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Wed, 13 Mar 2024 15:49:24 +0000 Subject: [PATCH] sort relative imports and move unprefixed ones --- .eslintrc.js | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index c1592b76..a74bd79e 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 + ['^'], ], }, ],