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