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