1 const {getGlobals} = require('eslint-plugin-mdx/lib/helpers')
2
3 module.exports = {
4 root: true,
5 ignorePatterns: ['.cache/', 'public/'],
6 extends: [
7 '@npmcli',
8 'react-app',
9 // 'react-app/jest',
10 'eslint:recommended',
11 'plugin:react/recommended',
12 'plugin:github/react',
13 'plugin:primer-react/recommended',
14 'plugin:react-hooks/recommended',
15 'prettier',
16 ],
17 rules: {
18 'max-len': 'off',
19 'react/prop-types': 'off',
20 'primer-react/no-system-props': ['error', {includeUtilityComponents: true}],
21 },
22 settings: {
23 'import/resolver': {
24 typescript: {},
25 },
26 },
27 overrides: [
28 {
29 files: ['*.js'],
30 extends: ['plugin:import/recommended'],
31 },
32 {
33 files: ['src/shared.js'],
34 rules: {
35 'react/no-unescaped-entities': 'off',
36 },
37 },
38 {
39 files: ['*.mdx'],
40 plugins: ['mdx', 'prettier'],
41 extends: ['plugin:mdx/recommended'],
42 parserOptions: {
43 sourceType: 'module',
44 },
45 globals: getGlobals(['Index', 'Note', 'Prompt', 'Screenshot', 'Link', 'YouTube']),
46 settings: {
47 'import/resolver': 'webpack',
48 },
49 rules: {
50 'no-irregular-whitespace': 'off',
51 'react/no-unescaped-entities': 'off',
52 },
53 },
54 {
55 files: ['*.mdx', 'src/shared.js', 'src/**/*.js'],
56 rules: {
57 'react/forbid-elements': [
58 'error',
59 {
60 // See https://github.com/npm/documentation/pull/791
61 // https://gist.githubusercontent.com/cecchi/99772a8483914b112400/raw/bcaecc4ba809caec518158bb46f9dead456ae5da/html-tags.json
62 forbid: [
63 'abbr',
64 'acronym',
65 'address',
66 'applet',
67 'area',
68 'article',
69 'audio',
70 'b',
71 'base',
72 'basefont',
73 'bdi',
74 'bdo',
75 'big',
76 'blink',
77 'br',
78 'button',
79 'canvas',
80 'caption',
81 'center',
82 'cite',
83 'code',
84 'col',
85 'colgroup',
86 'content',
87 'data',
88 'datalist',
89 'dd',
90 'del',
91 'details',
92 'dfn',
93 'dialog',
94 'dir',
95 'div',
96 'dl',
97 'dt',
98 'element',
99 'em',
100 'embed',
101 'fieldset',
102 'figcaption',
103 'figure',
104 'footer',
105 'form',
106 'frame',
107 'frameset',
108 'h1',
109 'h2',
110 'h3',
111 'h4',
112 'h5',
113 'h6',
114 'head',
115 'header',
116 'hgroup',
117 'hr',
118 // used in head
119 // 'html',
120 'i',
121 'input',
122 'ins',
123 'isindex',
124 'kbd',
125 'keygen',
126 'label',
127 'legend',
128 // ok because there is no mdx replacement and styles are provided via parent ul/ol
129 // 'li',
130 'listing',
131 'main',
132 'map',
133 'mark',
134 'menu',
135 'menuitem',
136 'meter',
137 'nav',
138 'noembed',
139 'noscript',
140 'object',
141 'ol',
142 'optgroup',
143 'option',
144 'output',
145 'p',
146 'param',
147 'plaintext',
148 'pre',
149 'progress',
150 'q',
151 'rp',
152 'rt',
153 'rtc',
154 'ruby',
155 's',
156 'samp',
157 'script',
158 'section',
159 'select',
160 'shadow',
161 'small',
162 'source',
163 'spacer',
164 'span',
165 'strike',
166 // ok since there is no mdx replacement
167 // 'strong'
168 'style',
169 'sub',
170 'summary',
171 'sup',
172 'table',
173 'tbody',
174 'td',
175 'template',
176 'tfoot',
177 'th',
178 'thead',
179 'time',
180 // used in head
181 // 'title',
182 'tr',
183 'track',
184 'tt',
185 'u',
186 'ul',
187 'var',
188 'video',
189 'wbr',
190 'xmp',
191 ],
192 },
193 ],
194 },
195 },
196 ],
197 }