diff options
Diffstat (limited to '.eslintrc.js')
-rw-r--r-- | .eslintrc.js | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/.eslintrc.js b/.eslintrc.js index 18802cdf1..6e8e01fe2 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -7,10 +7,54 @@ module.exports = { 'prettier', ], parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint', 'detox', 'react', 'lingui'], + plugins: [ + '@typescript-eslint', + 'detox', + 'react', + 'lingui', + 'simple-import-sort', + ], rules: { + // Temporary until https://github.com/facebook/react-native/pull/43756 gets into a release. + 'prettier/prettier': 0, 'react/no-unescaped-entities': 0, 'react-native/no-inline-styles': 0, + 'simple-import-sort/imports': [ + 'warn', + { + 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 + // Followed by all packages excluding unprefixed relative ones + [ + '^(react\\/(.*)$)|^(react$)|^(react-native(.*)$)', + '^(expo(.*)$)|^(expo$)', + '^(?!(?:alf|components|lib|locale|logger|platform|screens|state|view)(?:$|\\/))@?\\w', + ], + // Relative imports. + // Ideally, anything that starts with a dot or # + // 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 + ['^'], + ], + }, + ], + 'simple-import-sort/exports': 'warn', }, ignorePatterns: [ '**/__mocks__/*.ts', @@ -31,4 +75,8 @@ module.exports = { settings: { componentWrapperFunctions: ['observer'], }, + parserOptions: { + sourceType: 'module', + ecmaVersion: 'latest', + }, } |