Skip to content

Commit f987bb1

Browse files
authored
Merge pull request #115 from deini/unescaped-entities
feat(config): FE-00 unescaped entities denylist
2 parents e22f1cd + e82c9d4 commit f987bb1

File tree

2 files changed

+111
-6
lines changed

2 files changed

+111
-6
lines changed

packages/eslint-config/configs/react.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ module.exports = {
2929
'react/jsx-sort-props': 'warn',
3030
'react/no-redundant-should-component-update': 'error',
3131
'react/no-this-in-sfc': 'error',
32+
'react/no-unescaped-entities': [
33+
'error',
34+
{
35+
forbid: [
36+
{ alternatives: ['>'], char: '>' },
37+
{ alternatives: ['}'], char: '}' },
38+
],
39+
},
40+
],
3241
'react/no-unsafe': 'error',
3342
'react/no-unused-state': 'error',
3443
'react/prefer-es6-class': 'error',

packages/eslint-config/test/__snapshots__/eslint.spec.js.snap

Lines changed: 102 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,7 +1840,23 @@ Object {
18401840
"error",
18411841
],
18421842
"react/no-unescaped-entities": Array [
1843-
2,
1843+
"error",
1844+
Object {
1845+
"forbid": Array [
1846+
Object {
1847+
"alternatives": Array [
1848+
">",
1849+
],
1850+
"char": ">",
1851+
},
1852+
Object {
1853+
"alternatives": Array [
1854+
"}",
1855+
],
1856+
"char": "}",
1857+
},
1858+
],
1859+
},
18441860
],
18451861
"react/no-unknown-property": Array [
18461862
2,
@@ -3788,7 +3804,23 @@ Object {
37883804
"error",
37893805
],
37903806
"react/no-unescaped-entities": Array [
3791-
2,
3807+
"error",
3808+
Object {
3809+
"forbid": Array [
3810+
Object {
3811+
"alternatives": Array [
3812+
">",
3813+
],
3814+
"char": ">",
3815+
},
3816+
Object {
3817+
"alternatives": Array [
3818+
"}",
3819+
],
3820+
"char": "}",
3821+
},
3822+
],
3823+
},
37923824
],
37933825
"react/no-unknown-property": Array [
37943826
2,
@@ -5598,7 +5630,23 @@ Object {
55985630
"error",
55995631
],
56005632
"react/no-unescaped-entities": Array [
5601-
2,
5633+
"error",
5634+
Object {
5635+
"forbid": Array [
5636+
Object {
5637+
"alternatives": Array [
5638+
">",
5639+
],
5640+
"char": ">",
5641+
},
5642+
Object {
5643+
"alternatives": Array [
5644+
"}",
5645+
],
5646+
"char": "}",
5647+
},
5648+
],
5649+
},
56025650
],
56035651
"react/no-unknown-property": Array [
56045652
2,
@@ -7407,7 +7455,23 @@ Object {
74077455
"error",
74087456
],
74097457
"react/no-unescaped-entities": Array [
7410-
2,
7458+
"error",
7459+
Object {
7460+
"forbid": Array [
7461+
Object {
7462+
"alternatives": Array [
7463+
">",
7464+
],
7465+
"char": ">",
7466+
},
7467+
Object {
7468+
"alternatives": Array [
7469+
"}",
7470+
],
7471+
"char": "}",
7472+
},
7473+
],
7474+
},
74117475
],
74127476
"react/no-unknown-property": Array [
74137477
2,
@@ -9560,7 +9624,23 @@ Object {
95609624
"error",
95619625
],
95629626
"react/no-unescaped-entities": Array [
9563-
2,
9627+
"error",
9628+
Object {
9629+
"forbid": Array [
9630+
Object {
9631+
"alternatives": Array [
9632+
">",
9633+
],
9634+
"char": ">",
9635+
},
9636+
Object {
9637+
"alternatives": Array [
9638+
"}",
9639+
],
9640+
"char": "}",
9641+
},
9642+
],
9643+
},
95649644
],
95659645
"react/no-unknown-property": Array [
95669646
2,
@@ -11740,7 +11820,23 @@ Object {
1174011820
"error",
1174111821
],
1174211822
"react/no-unescaped-entities": Array [
11743-
2,
11823+
"error",
11824+
Object {
11825+
"forbid": Array [
11826+
Object {
11827+
"alternatives": Array [
11828+
">",
11829+
],
11830+
"char": ">",
11831+
},
11832+
Object {
11833+
"alternatives": Array [
11834+
"}",
11835+
],
11836+
"char": "}",
11837+
},
11838+
],
11839+
},
1174411840
],
1174511841
"react/no-unknown-property": Array [
1174611842
2,

0 commit comments

Comments
 (0)