Skip to content

Commit

Permalink
Lint against strings without wrapping <Text> (#3398)
Browse files Browse the repository at this point in the history
* Add a rudimentary rule

* Get the rule passing

* Support special-casing text props

* More tests
  • Loading branch information
gaearon authored Apr 4, 2024
1 parent 8e393b1 commit 4cc57f4
Show file tree
Hide file tree
Showing 6 changed files with 579 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const bskyEslint = require('./eslint')

module.exports = {
root: true,
extends: [
Expand All @@ -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',
{
Expand Down
Loading

0 comments on commit 4cc57f4

Please sign in to comment.