about summary refs log tree commit diff
path: root/.eslintrc.js
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2024-04-04 17:32:50 +0100
committerGitHub <noreply@github.com>2024-04-04 17:32:50 +0100
commit4cc57f4bfdf16fd627ad63bf20ff8193e7d0a12a (patch)
treecdb25d309e141296e8df680bc4a8fda2105912a1 /.eslintrc.js
parent8e393b16f502ca201393d1fd585c870fee8a4fe9 (diff)
downloadvoidsky-4cc57f4bfdf16fd627ad63bf20ff8193e7d0a12a.tar.zst
Lint against strings without wrapping <Text> (#3398)
* Add a rudimentary rule

* Get the rule passing

* Support special-casing text props

* More tests
Diffstat (limited to '.eslintrc.js')
-rw-r--r--.eslintrc.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/.eslintrc.js b/.eslintrc.js
index 6e8e01fe2..8ae91f346 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -1,3 +1,5 @@
+const bskyEslint = require('./eslint')
+
 module.exports = {
   root: true,
   extends: [
@@ -13,12 +15,43 @@ module.exports = {
     'react',
     'lingui',
     'simple-import-sort',
+    'bsky-internal',
   ],
   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.
+          'ButtonText',
+          'DateField.Label',
+          'Description',
+          'H1',
+          'H2',
+          'H3',
+          'H4',
+          'H5',
+          'H6',
+          'InlineLink',
+          'Label',
+          'P',
+          'Prompt.Title',
+          'Prompt.Description',
+          'Prompt.Cancel', // TODO: Not always safe.
+          'Prompt.Action', // TODO: Not always safe.
+          'TextField.Label',
+          'TextField.Suffix',
+          'Title',
+          'Toggle.Label',
+          'ToggleButton.Button', // TODO: Not always safe.
+        ],
+        impliedTextProps: ['FormContainer title'],
+      },
+    ],
     'simple-import-sort/imports': [
       'warn',
       {