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