bsky-app/.eslintrc.js

100 lines
2.6 KiB
JavaScript
Raw Normal View History

2022-06-08 00:50:05 +02:00
module.exports = {
root: true,
2023-05-24 23:59:42 +02:00
extends: [
'@react-native-community',
'plugin:react/recommended',
2023-05-24 23:59:42 +02:00
'plugin:react-native-a11y/ios',
'prettier',
],
2022-06-08 00:50:05 +02:00
parser: '@typescript-eslint/parser',
2024-03-12 22:57:56 +01:00
plugins: [
'@typescript-eslint',
'detox',
'react',
'lingui',
'simple-import-sort',
'bsky-internal',
2024-03-12 22:57:56 +01:00
],
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,
'bsky-internal/avoid-unwrapped-text': [
'error',
{
impliedTextComponents: [
'Button', // TODO: Not always safe.
'H1',
'H2',
'H3',
'H4',
'H5',
'H6',
'P',
],
impliedTextProps: [],
},
],
2024-03-13 15:50:25 +01:00
'simple-import-sort/imports': [
2024-03-19 17:13:15 +01:00
'warn',
2024-03-13 15:50:25 +01:00
{
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
2024-03-13 15:50:25 +01:00
[
'^(react\\/(.*)$)|^(react$)|^(react-native(.*)$)',
2024-03-13 15:50:25 +01:00
'^(expo(.*)$)|^(expo$)',
'^(?!(?:alf|components|lib|locale|logger|platform|screens|state|view)(?:$|\\/))@?\\w',
2024-03-13 15:50:25 +01:00
],
// Relative imports.
2024-03-13 16:51:55 +01:00
// 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
['^'],
2024-03-13 15:50:25 +01:00
],
},
],
2024-03-19 17:13:15 +01:00
'simple-import-sort/exports': 'warn',
},
ignorePatterns: [
'**/__mocks__/*.ts',
'src/platform/polyfills.ts',
2023-07-14 02:39:43 +02:00
'src/third-party',
'ios',
'android',
'coverage',
'*.lock',
'.husky',
'patches',
'bskyweb',
'*.html',
'bskyweb',
'src/locale/locales/_build/',
'src/locale/locales/**/*.js',
],
settings: {
componentWrapperFunctions: ['observer'],
},
2024-03-12 22:57:56 +01:00
parserOptions: {
sourceType: 'module',
ecmaVersion: 'latest',
},
2022-06-09 20:03:25 +02:00
}