@streamlinedfi/div 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +64 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.mjs +64 -0
- package/dist/index.mjs.map +1 -0
- package/dist/metafile-cjs.json +1 -0
- package/dist/metafile-esm.json +1 -0
- package/package.json +7 -1
- package/src/Div.js +0 -132
- package/src/Text.js +0 -57
- package/src/createUISystem.js +0 -58
- package/src/index.js +0 -7
- package/src/rules.js +0 -371
- package/src/utils.js +0 -107
- package/test-app/README.md +0 -16
- package/test-app/eslint.config.js +0 -29
- package/test-app/index.html +0 -13
- package/test-app/package-lock.json +0 -2958
- package/test-app/package.json +0 -28
- package/test-app/public/vite.svg +0 -1
- package/test-app/src/App.jsx +0 -58
- package/test-app/src/main.jsx +0 -10
- package/test-app/src/uiSystem.js +0 -15
- package/test-app/vite.config.js +0 -7
- package/tsup.config.js +0 -21
package/src/rules.js
DELETED
|
@@ -1,371 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-nested-ternary */
|
|
2
|
-
import { getPropValue, isPropPresent, pixelate, spacing } from './utils';
|
|
3
|
-
|
|
4
|
-
const { fromEntries } = Object;
|
|
5
|
-
|
|
6
|
-
export const cssWhiteList = fromEntries(
|
|
7
|
-
[
|
|
8
|
-
'display',
|
|
9
|
-
'align',
|
|
10
|
-
'vAlign',
|
|
11
|
-
'alignItems',
|
|
12
|
-
'alignContent',
|
|
13
|
-
'alignSelf',
|
|
14
|
-
'justifyContent',
|
|
15
|
-
'justifySelf',
|
|
16
|
-
'flexDirection',
|
|
17
|
-
'flexBasis',
|
|
18
|
-
'flexWrap',
|
|
19
|
-
'pointerEvents',
|
|
20
|
-
'cursor',
|
|
21
|
-
'position',
|
|
22
|
-
'opacity',
|
|
23
|
-
'backgroundColor',
|
|
24
|
-
'backgroundImage',
|
|
25
|
-
'backgroundSize',
|
|
26
|
-
'backgroundPosition',
|
|
27
|
-
'backgroundRepeat',
|
|
28
|
-
'transform',
|
|
29
|
-
'transformOrigin',
|
|
30
|
-
'textDecoration',
|
|
31
|
-
'textWrap',
|
|
32
|
-
'animation',
|
|
33
|
-
'fontWeight',
|
|
34
|
-
'gap',
|
|
35
|
-
'gridTemplateColumns',
|
|
36
|
-
'gridTemplateRows',
|
|
37
|
-
'wordBreak',
|
|
38
|
-
'whiteSpace',
|
|
39
|
-
'textOverflow',
|
|
40
|
-
'overflow',
|
|
41
|
-
'overflowX',
|
|
42
|
-
'overflowY',
|
|
43
|
-
'textAlign',
|
|
44
|
-
'transitionDelay',
|
|
45
|
-
'filter',
|
|
46
|
-
'listStyle',
|
|
47
|
-
'objectFit',
|
|
48
|
-
'objectPosition',
|
|
49
|
-
'willChange',
|
|
50
|
-
'boxSizing',
|
|
51
|
-
].map(prop => [prop, 1]),
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
// short hand rules for the div component
|
|
55
|
-
export const divRules = {
|
|
56
|
-
inline: 'display: inline',
|
|
57
|
-
block: 'display: block',
|
|
58
|
-
flex: `
|
|
59
|
-
display: flex;
|
|
60
|
-
width: 100%;
|
|
61
|
-
`,
|
|
62
|
-
autoFlex: `
|
|
63
|
-
display: flex;
|
|
64
|
-
width: auto;
|
|
65
|
-
`,
|
|
66
|
-
grid: `
|
|
67
|
-
display: grid;
|
|
68
|
-
`,
|
|
69
|
-
hide: 'display: none',
|
|
70
|
-
inlineBlock: 'display: inline-block',
|
|
71
|
-
inlineFlex: 'display: inline-flex',
|
|
72
|
-
'column|col': 'flex-direction: column;',
|
|
73
|
-
row: 'flex-direction: row;',
|
|
74
|
-
spaceBetween: 'justify-content: space-between;',
|
|
75
|
-
wrap: 'flex-wrap: wrap;',
|
|
76
|
-
innerCenter: (props, media) =>
|
|
77
|
-
isPropPresent(props, media, 'flex', 'inlineFlex')
|
|
78
|
-
? `
|
|
79
|
-
justify-content: center;
|
|
80
|
-
align-items: center;
|
|
81
|
-
`
|
|
82
|
-
: `
|
|
83
|
-
text-align: center;
|
|
84
|
-
${
|
|
85
|
-
isPropPresent(props, media, 'h', 'height')
|
|
86
|
-
? `line-height: ${getPropValue(props, media, 'h', 'height')};`
|
|
87
|
-
: ''
|
|
88
|
-
}
|
|
89
|
-
`,
|
|
90
|
-
innerLeft: (props, media) =>
|
|
91
|
-
isPropPresent(props, media, 'flex', 'inlineFlex')
|
|
92
|
-
? isPropPresent(props, media, 'column', 'col')
|
|
93
|
-
? 'align-items: flex-start;'
|
|
94
|
-
: 'justify-content: flex-start;'
|
|
95
|
-
: 'text-align: left;',
|
|
96
|
-
innerRight: (props, media) =>
|
|
97
|
-
isPropPresent(props, media, 'flex', 'inlineFlex')
|
|
98
|
-
? isPropPresent(props, media, 'column', 'col')
|
|
99
|
-
? 'align-items: flex-end;'
|
|
100
|
-
: 'justify-content: flex-end;'
|
|
101
|
-
: 'text-align: right;',
|
|
102
|
-
innerTop: (props, media) => {
|
|
103
|
-
return isPropPresent(props, media, 'flex', 'inlineFlex')
|
|
104
|
-
? isPropPresent(props, media, 'column', 'col')
|
|
105
|
-
? 'justify-content: flex-start;'
|
|
106
|
-
: 'align-items: flex-start;'
|
|
107
|
-
: '';
|
|
108
|
-
},
|
|
109
|
-
innerBottom: (props, media) =>
|
|
110
|
-
isPropPresent(props, media, 'flex', 'inlineFlex')
|
|
111
|
-
? isPropPresent(props, media, 'column', 'col')
|
|
112
|
-
? 'justify-content: flex-end;'
|
|
113
|
-
: 'align-items: flex-end;'
|
|
114
|
-
: '',
|
|
115
|
-
outerCenter: `
|
|
116
|
-
margin-left: auto;
|
|
117
|
-
margin-right: auto;
|
|
118
|
-
`,
|
|
119
|
-
grow: {
|
|
120
|
-
css: 'flex-grow',
|
|
121
|
-
format: Number,
|
|
122
|
-
},
|
|
123
|
-
shrink: {
|
|
124
|
-
css: 'flex-shrink',
|
|
125
|
-
},
|
|
126
|
-
'colReverse|columnReverse': {
|
|
127
|
-
css: 'flex-direction: column-reverse;',
|
|
128
|
-
},
|
|
129
|
-
reverse: {
|
|
130
|
-
css: 'flex-direction: row-reverse;',
|
|
131
|
-
},
|
|
132
|
-
|
|
133
|
-
// dimensions
|
|
134
|
-
'width|w': {
|
|
135
|
-
css: 'width',
|
|
136
|
-
format: pixelate,
|
|
137
|
-
},
|
|
138
|
-
'minWidth|minW': {
|
|
139
|
-
css: 'min-width',
|
|
140
|
-
format: pixelate,
|
|
141
|
-
},
|
|
142
|
-
'maxWidth|maxW': {
|
|
143
|
-
css: (props, media) => `
|
|
144
|
-
width: 100%;
|
|
145
|
-
max-width: ${pixelate(getPropValue(props, media, 'maxWidth', 'maxW'))};
|
|
146
|
-
`,
|
|
147
|
-
},
|
|
148
|
-
'height|h': {
|
|
149
|
-
css: 'height',
|
|
150
|
-
format: pixelate,
|
|
151
|
-
},
|
|
152
|
-
'minHeight|minH': {
|
|
153
|
-
css: 'min-height',
|
|
154
|
-
format: pixelate,
|
|
155
|
-
},
|
|
156
|
-
'maxHeight|maxH': {
|
|
157
|
-
css: (props, media) => `
|
|
158
|
-
height: 100%;
|
|
159
|
-
max-height: ${pixelate(getPropValue(props, media, 'maxHeight', 'maxH'))};
|
|
160
|
-
`,
|
|
161
|
-
},
|
|
162
|
-
'lineHeight|lineH|lh': {
|
|
163
|
-
css: 'line-height',
|
|
164
|
-
format: pixelate,
|
|
165
|
-
},
|
|
166
|
-
pointer: 'cursor: pointer;',
|
|
167
|
-
|
|
168
|
-
// position
|
|
169
|
-
relative: 'position: relative',
|
|
170
|
-
absolute: 'position: absolute',
|
|
171
|
-
fixed: 'position: fixed',
|
|
172
|
-
static: 'position: static',
|
|
173
|
-
cover: `
|
|
174
|
-
position: absolute;
|
|
175
|
-
top: 0;
|
|
176
|
-
left: 0;
|
|
177
|
-
width: 100%;
|
|
178
|
-
height: 100%;
|
|
179
|
-
`,
|
|
180
|
-
'zIndex|z': {
|
|
181
|
-
css: 'z-index',
|
|
182
|
-
withTheme: true,
|
|
183
|
-
},
|
|
184
|
-
top: {
|
|
185
|
-
css: 'top',
|
|
186
|
-
format: pixelate,
|
|
187
|
-
},
|
|
188
|
-
right: {
|
|
189
|
-
css: 'right',
|
|
190
|
-
format: pixelate,
|
|
191
|
-
},
|
|
192
|
-
bottom: {
|
|
193
|
-
css: 'bottom',
|
|
194
|
-
format: pixelate,
|
|
195
|
-
},
|
|
196
|
-
left: {
|
|
197
|
-
css: 'left',
|
|
198
|
-
format: pixelate,
|
|
199
|
-
},
|
|
200
|
-
|
|
201
|
-
'padding|p': {
|
|
202
|
-
css: 'padding',
|
|
203
|
-
format: spacing,
|
|
204
|
-
},
|
|
205
|
-
'paddingTop|pt': {
|
|
206
|
-
css: 'padding-top',
|
|
207
|
-
format: spacing,
|
|
208
|
-
},
|
|
209
|
-
'paddingRight|pr': {
|
|
210
|
-
css: 'padding-right',
|
|
211
|
-
format: spacing,
|
|
212
|
-
},
|
|
213
|
-
'paddingBottom|pb': {
|
|
214
|
-
css: 'padding-bottom',
|
|
215
|
-
format: spacing,
|
|
216
|
-
},
|
|
217
|
-
'paddingLeft|pl': {
|
|
218
|
-
css: 'padding-left',
|
|
219
|
-
format: spacing,
|
|
220
|
-
},
|
|
221
|
-
'paddingX|px': {
|
|
222
|
-
css: (props, media) => `
|
|
223
|
-
padding-left: ${spacing(getPropValue(props, media, 'paddingX', 'px'))};
|
|
224
|
-
padding-right: ${spacing(getPropValue(props, media, 'paddingX', 'px'))};
|
|
225
|
-
`,
|
|
226
|
-
},
|
|
227
|
-
'paddingY|py': {
|
|
228
|
-
css: (props, media) => `
|
|
229
|
-
padding-top: ${spacing(getPropValue(props, media, 'paddingY', 'py'))};
|
|
230
|
-
padding-bottom: ${spacing(getPropValue(props, media, 'paddingY', 'py'))};
|
|
231
|
-
`,
|
|
232
|
-
},
|
|
233
|
-
'margin|m': {
|
|
234
|
-
css: 'margin',
|
|
235
|
-
format: spacing,
|
|
236
|
-
},
|
|
237
|
-
'marginTop|mt': {
|
|
238
|
-
css: 'margin-top',
|
|
239
|
-
format: spacing,
|
|
240
|
-
},
|
|
241
|
-
'marginRight|mr': {
|
|
242
|
-
css: 'margin-right',
|
|
243
|
-
format: spacing,
|
|
244
|
-
},
|
|
245
|
-
'marginBottom|mb': {
|
|
246
|
-
css: 'margin-bottom',
|
|
247
|
-
format: spacing,
|
|
248
|
-
},
|
|
249
|
-
'marginLeft|ml': {
|
|
250
|
-
css: 'margin-left',
|
|
251
|
-
format: spacing,
|
|
252
|
-
},
|
|
253
|
-
'marginX|mx': {
|
|
254
|
-
css: (props, media) => `
|
|
255
|
-
margin-left: ${spacing(getPropValue(props, media, 'marginX', 'mx'))};
|
|
256
|
-
margin-right: ${spacing(getPropValue(props, media, 'marginX', 'mx'))};
|
|
257
|
-
`,
|
|
258
|
-
},
|
|
259
|
-
'marginY|my': {
|
|
260
|
-
css: (props, media) => `
|
|
261
|
-
margin-top: ${spacing(getPropValue(props, media, 'marginY', 'my'))};
|
|
262
|
-
margin-bottom: ${spacing(getPropValue(props, media, 'marginY', 'my'))};
|
|
263
|
-
`,
|
|
264
|
-
},
|
|
265
|
-
|
|
266
|
-
// style
|
|
267
|
-
'background|bg': {
|
|
268
|
-
css: 'background',
|
|
269
|
-
withTheme: true,
|
|
270
|
-
},
|
|
271
|
-
'borderRadius|radius': {
|
|
272
|
-
css: (props, media) => {
|
|
273
|
-
const radius = getPropValue(props, media, 'borderRadius', 'radius');
|
|
274
|
-
if (Array.isArray(radius)) {
|
|
275
|
-
return `
|
|
276
|
-
border-top-left-radius: ${pixelate(radius[0])};
|
|
277
|
-
border-top-right-radius: ${pixelate(radius[1])};
|
|
278
|
-
border-bottom-right-radius: ${pixelate(radius[2])};
|
|
279
|
-
border-bottom-left-radius: ${pixelate(radius[3])};
|
|
280
|
-
`;
|
|
281
|
-
}
|
|
282
|
-
return `border-radius: ${pixelate(radius)}`;
|
|
283
|
-
},
|
|
284
|
-
},
|
|
285
|
-
borderTopLeftRadius: {
|
|
286
|
-
css: 'border-top-left-radius',
|
|
287
|
-
format: pixelate,
|
|
288
|
-
},
|
|
289
|
-
borderTopRightRadius: {
|
|
290
|
-
css: 'border-top-right-radius',
|
|
291
|
-
format: pixelate,
|
|
292
|
-
},
|
|
293
|
-
borderBottomRightRadius: {
|
|
294
|
-
css: 'border-bottom-right-radius',
|
|
295
|
-
format: pixelate,
|
|
296
|
-
},
|
|
297
|
-
borderBottomLeftRadius: {
|
|
298
|
-
css: 'border-bottom-left-radius',
|
|
299
|
-
format: pixelate,
|
|
300
|
-
},
|
|
301
|
-
borderColor: {
|
|
302
|
-
css: 'border-color',
|
|
303
|
-
withTheme: true,
|
|
304
|
-
},
|
|
305
|
-
borderImage: {
|
|
306
|
-
css: 'border-image',
|
|
307
|
-
withTheme: true,
|
|
308
|
-
},
|
|
309
|
-
...[
|
|
310
|
-
['border', 'border'],
|
|
311
|
-
['borderTop', 'border-top'],
|
|
312
|
-
['borderRight', 'border-right'],
|
|
313
|
-
['borderBottom', 'border-bottom'],
|
|
314
|
-
['borderLeft', 'border-left'],
|
|
315
|
-
].reduce(
|
|
316
|
-
(rules, [jsKey, cssKey]) => ({
|
|
317
|
-
...rules,
|
|
318
|
-
[jsKey]: {
|
|
319
|
-
css: (props, media, extensions) => {
|
|
320
|
-
const propValue = getPropValue(
|
|
321
|
-
props,
|
|
322
|
-
media,
|
|
323
|
-
extensions?.length ? [jsKey, ...extensions].join('$') : jsKey,
|
|
324
|
-
);
|
|
325
|
-
|
|
326
|
-
// withTheme
|
|
327
|
-
const value =
|
|
328
|
-
typeof propValue === 'function'
|
|
329
|
-
? propValue(props.theme)
|
|
330
|
-
: propValue;
|
|
331
|
-
|
|
332
|
-
if (!/^\d/.test(value)) {
|
|
333
|
-
return `${cssKey}: 1px solid ${value}`;
|
|
334
|
-
}
|
|
335
|
-
return `${cssKey}: ${value}`;
|
|
336
|
-
},
|
|
337
|
-
},
|
|
338
|
-
}),
|
|
339
|
-
{},
|
|
340
|
-
),
|
|
341
|
-
transition: (props, media) => {
|
|
342
|
-
const value = getPropValue(props, media, 'transition');
|
|
343
|
-
return typeof value === 'string'
|
|
344
|
-
? `transition: ${value}`
|
|
345
|
-
: 'transition: all .2s';
|
|
346
|
-
},
|
|
347
|
-
'boxShadow|shadow': {
|
|
348
|
-
css: 'box-shadow',
|
|
349
|
-
withTheme: true,
|
|
350
|
-
},
|
|
351
|
-
textShadow: {
|
|
352
|
-
css: 'text-shadow',
|
|
353
|
-
withTheme: true,
|
|
354
|
-
},
|
|
355
|
-
color: {
|
|
356
|
-
css: 'color',
|
|
357
|
-
withTheme: true,
|
|
358
|
-
},
|
|
359
|
-
fill: {
|
|
360
|
-
css: 'fill',
|
|
361
|
-
withTheme: true,
|
|
362
|
-
},
|
|
363
|
-
fontSize: {
|
|
364
|
-
css: 'font-size',
|
|
365
|
-
format: pixelate,
|
|
366
|
-
},
|
|
367
|
-
outline: {
|
|
368
|
-
css: 'outline',
|
|
369
|
-
withTheme: true,
|
|
370
|
-
},
|
|
371
|
-
};
|
package/src/utils.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
const { entries } = Object;
|
|
2
|
-
|
|
3
|
-
export const upperFirst = str => str.charAt(0).toUpperCase() + str.slice(1);
|
|
4
|
-
|
|
5
|
-
export const kebabCase = (string = '') =>
|
|
6
|
-
string
|
|
7
|
-
.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)
|
|
8
|
-
?.map(x => x.toLowerCase())
|
|
9
|
-
?.join('-') ?? '';
|
|
10
|
-
|
|
11
|
-
export function spacing(val, theme) {
|
|
12
|
-
if (/(px|%)$/.test(val)) {
|
|
13
|
-
return val;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (typeof val === 'string') {
|
|
17
|
-
return val;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (val === 0) {
|
|
21
|
-
return val;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return theme.spacing(val);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function pixelate(val) {
|
|
28
|
-
if (typeof val === 'number') {
|
|
29
|
-
return `${val}px`;
|
|
30
|
-
}
|
|
31
|
-
return val;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function getPropValue(props, media, ...propKeys) {
|
|
35
|
-
let value;
|
|
36
|
-
for (let i = 0; i < propKeys.length; i++) {
|
|
37
|
-
const key = propKeys[i];
|
|
38
|
-
if (media) {
|
|
39
|
-
const mediaVal = props[`$${media}$${key}`];
|
|
40
|
-
if (mediaVal) {
|
|
41
|
-
value = mediaVal;
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
const val = props[`$${key}`];
|
|
46
|
-
if (val) {
|
|
47
|
-
value = val;
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return value;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export function isPropPresent(props, media, ...propKeys) {
|
|
56
|
-
return !!getPropValue(props, media, ...propKeys);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
let ruleIndex = null;
|
|
60
|
-
export function getRuleIndex(rules) {
|
|
61
|
-
if (ruleIndex) return ruleIndex;
|
|
62
|
-
|
|
63
|
-
const index = {};
|
|
64
|
-
entries(rules).forEach(([ruleProp, config]) => {
|
|
65
|
-
ruleProp.split('|').forEach(prop => {
|
|
66
|
-
index[prop] = config;
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
ruleIndex = index;
|
|
70
|
-
|
|
71
|
-
return index;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
let mediaPropRegex = null;
|
|
75
|
-
export function getMediaPropRegex(theme) {
|
|
76
|
-
if (mediaPropRegex) return mediaPropRegex;
|
|
77
|
-
|
|
78
|
-
mediaPropRegex = new RegExp(
|
|
79
|
-
`^\\$(${theme.Breakpoints.keys.join('|')})(\\$.*)`,
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
return mediaPropRegex;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export function colorMixin(color, theme) {
|
|
86
|
-
if (color) {
|
|
87
|
-
if ([100, 200, 300, 400, 500, 600, 700, 800, 900].includes(color)) {
|
|
88
|
-
return `color: ${theme[`fill${color}`]};`;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
if (typeof color === 'string') {
|
|
92
|
-
if (theme[color]) {
|
|
93
|
-
return `color: ${theme[color]};`;
|
|
94
|
-
}
|
|
95
|
-
return `color: ${color};`;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return '';
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export const sizeFormatter = value => {
|
|
103
|
-
if (typeof value === 'number') {
|
|
104
|
-
return `${value}px`;
|
|
105
|
-
}
|
|
106
|
-
return value;
|
|
107
|
-
};
|
package/test-app/README.md
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# React + Vite
|
|
2
|
-
|
|
3
|
-
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
-
|
|
5
|
-
Currently, two official plugins are available:
|
|
6
|
-
|
|
7
|
-
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
|
|
8
|
-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
-
|
|
10
|
-
## React Compiler
|
|
11
|
-
|
|
12
|
-
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
|
13
|
-
|
|
14
|
-
## Expanding the ESLint configuration
|
|
15
|
-
|
|
16
|
-
If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import js from '@eslint/js'
|
|
2
|
-
import globals from 'globals'
|
|
3
|
-
import reactHooks from 'eslint-plugin-react-hooks'
|
|
4
|
-
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
5
|
-
import { defineConfig, globalIgnores } from 'eslint/config'
|
|
6
|
-
|
|
7
|
-
export default defineConfig([
|
|
8
|
-
globalIgnores(['dist']),
|
|
9
|
-
{
|
|
10
|
-
files: ['**/*.{js,jsx}'],
|
|
11
|
-
extends: [
|
|
12
|
-
js.configs.recommended,
|
|
13
|
-
reactHooks.configs['recommended-latest'],
|
|
14
|
-
reactRefresh.configs.vite,
|
|
15
|
-
],
|
|
16
|
-
languageOptions: {
|
|
17
|
-
ecmaVersion: 2020,
|
|
18
|
-
globals: globals.browser,
|
|
19
|
-
parserOptions: {
|
|
20
|
-
ecmaVersion: 'latest',
|
|
21
|
-
ecmaFeatures: { jsx: true },
|
|
22
|
-
sourceType: 'module',
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
rules: {
|
|
26
|
-
'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
])
|
package/test-app/index.html
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>test-app</title>
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<div id="root"></div>
|
|
11
|
-
<script type="module" src="/src/main.jsx"></script>
|
|
12
|
-
</body>
|
|
13
|
-
</html>
|