From 70c76a76a0d0285c28fa456c3af7741ad7a727cb Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Wed, 13 Mar 2024 14:50:25 +0000 Subject: add custom import order --- .eslintrc.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to '.eslintrc.js') diff --git a/.eslintrc.js b/.eslintrc.js index b26bee1ba..c1592b76a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -17,7 +17,29 @@ module.exports = { rules: { 'react/no-unescaped-entities': 0, 'react-native/no-inline-styles': 0, - 'simple-import-sort/imports': 'error', + 'simple-import-sort/imports': [ + 'error', + { + groups: [ + // Side effect imports. + ['^\\u0000'], + // Node.js builtins prefixed with `node:`. + ['^node:'], + // Packages. + // Things that start with a letter (or digit or underscore), or `@` followed by a letter. + // React/React Native priortized, followed by expo + [ + '^(react/(.*)$)|^(react$)|^(react-native(.*)$)', + '^(expo(.*)$)|^(expo$)', + '^@?\\w', + '^', + ], + // Relative imports. + // Anything that starts with a dot or a # + ['^#', '^\\.'], + ], + }, + ], 'simple-import-sort/exports': 'error', }, ignorePatterns: [ -- cgit 1.4.1