sort relative imports and move unprefixed ones

zio/stable
Samuel Newman 2024-03-13 15:49:24 +00:00
parent 70c76a76a0
commit 4d2efd84e4
1 changed files with 18 additions and 5 deletions

View File

@ -28,15 +28,28 @@ module.exports = {
// Packages. // Packages.
// Things that start with a letter (or digit or underscore), or `@` followed by a letter. // Things that start with a letter (or digit or underscore), or `@` followed by a letter.
// React/React Native priortized, followed by expo // 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$)', '^(expo(.*)$)|^(expo$)',
'^@?\\w', '^(?!(?:alf|components|lib|locale|logger|platform|screens|state|view)(?:$|\\/))@?\\w',
'^',
], ],
// Relative imports. // 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
['^'],
], ],
}, },
], ],