|
1 | | -# React + TypeScript + 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/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh |
8 | | -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh |
9 | | - |
10 | | -## Expanding the ESLint configuration |
11 | | - |
12 | | -If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: |
13 | | - |
14 | | -- Configure the top-level `parserOptions` property like this: |
15 | | - |
16 | | -```js |
17 | | -export default tseslint.config({ |
18 | | - languageOptions: { |
19 | | - // other options... |
20 | | - parserOptions: { |
21 | | - project: ['./tsconfig.node.json', './tsconfig.app.json'], |
22 | | - tsconfigRootDir: import.meta.dirname, |
23 | | - }, |
24 | | - }, |
25 | | -}) |
26 | | -``` |
27 | | - |
28 | | -- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked` |
29 | | -- Optionally add `...tseslint.configs.stylisticTypeChecked` |
30 | | -- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config: |
31 | | - |
32 | | -```js |
33 | | -// eslint.config.js |
34 | | -import react from 'eslint-plugin-react' |
35 | | - |
36 | | -export default tseslint.config({ |
37 | | - // Set the react version |
38 | | - settings: { react: { version: '18.3' } }, |
39 | | - plugins: { |
40 | | - // Add the react plugin |
41 | | - react, |
42 | | - }, |
43 | | - rules: { |
44 | | - // other rules... |
45 | | - // Enable its recommended rules |
46 | | - ...react.configs.recommended.rules, |
47 | | - ...react.configs['jsx-runtime'].rules, |
48 | | - }, |
49 | | -}) |
| 1 | +# Ruby Enumeration Demo |
| 2 | + |
| 3 | +A visualization of eager and lazy enumeration in Ruby. |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +## About |
| 8 | + |
| 9 | +Rubyists love Ruby’s `Enumerable`: |
| 10 | + |
| 11 | +```ruby |
| 12 | +1.upto(5).map { |item| item * 2 }.take(3) |
| 13 | +# => [2, 4, 6] |
| 14 | +``` |
| 15 | + |
| 16 | +But Ruby’s `.lazy` enumerator can be confusing: |
| 17 | + |
| 18 | +```ruby |
| 19 | +1.upto(5).lazy.map { |item| item * 2 }.take(3).to_a |
| 20 | +# => [2, 4, 6] |
| 21 | +``` |
| 22 | + |
| 23 | +What’s going on here? |
| 24 | + |
| 25 | +This visualization may help illustrate the difference. |
| 26 | + |
| 27 | +## Development |
| 28 | + |
| 29 | +Make sure `node` and `npm` is installed. See `.node-version` for current version. |
| 30 | + |
| 31 | +Install dependencies: |
| 32 | + |
| 33 | +``` |
| 34 | +npm install |
| 35 | +``` |
| 36 | + |
| 37 | +Run the Vite dev server: |
| 38 | + |
| 39 | +``` |
| 40 | +npm run dev |
| 41 | +``` |
| 42 | + |
| 43 | +Build static assets |
| 44 | + |
| 45 | +``` |
| 46 | +npm run build |
50 | 47 | ``` |
0 commit comments