UNPKG

3.6 kBMarkdownView Raw
1# @fluidframework/eslint-config-fluid
2
3This package contains a shared ESLint config used by all the packages in the Fluid Framework repo.
4
5It exports the following shared ESLint configs:
6
7- `minimal`: (default) The minimal config for Fluid Framework packages.
8- `recommended`: The recommended config for Fluid Framework packages.
9- `strict`: The strictest config; intended for packages with public facing APIs.
10
11## Changing the lint config
12
13If you want to change the shared lint config (that is, this package), you need to do the following:
14
151. Make the change in the config.
162. Publish a pre-release package.
173. Update the core packages to use the pre-release lint config.
18
19When updating the lint config (step 1), run `npm run print-config` and commit any resulting changes.
20
21### Tracking lint config changes over time
22
23One question that comes up often when we make changes to our lint config is, "what changed?" This applies even when we
24don't make any changes other than upgrading deps, because the dependency upgrade might include a new rule.
25
26ESLint provides a way to print the config that would apply to a file (`--print-config`), so we use this capability to
27print out the applied config as a JSON file. As we make changes to the config, we can print out the config again and get
28a diff to review as part of a PR -- just like we do with API reports for code changes.
29
30## Scripts
31
32<!-- AUTO-GENERATED-CONTENT:START (SCRIPTS) -->
33
34| Script | Description |
35| -------------------------- | ------------------------------------------------------------------------------------------------------------- |
36| `cleanup-printed-configs` | Clean up the printed configs. Removes the `parser` property and sorts the JSON. |
37| `format` | `npm run prettier:fix` |
38| `lint` | `npm run prettier` |
39| `lint:fix` | `npm run prettier:fix` |
40| `prettier` | `prettier --check .` |
41| `prettier:fix` | `prettier --write .` |
42| `print-config` | Print all the eslint configs. |
43| `print-config:default` | Print the eslint config for regular TypeScript files (`eslint --config index.js --print-config src/file.ts`). |
44| `print-config:minimal` | `eslint --config ./minimal.js --print-config ./src/file.ts > ./printed-configs/minimal.json` |
45| `print-config:recommended` | `eslint --config ./recommended.js --print-config ./src/file.ts > ./printed-configs/recommended.json` |
46| `print-config:strict` | `eslint --config ./strict.js --print-config ./src/file.ts > ./printed-configs/strict.json` |
47| `print-config:test` | Print the eslint config for test files (`eslint --config index.js --print-config src/test/file.ts`). |
48
49<!-- AUTO-GENERATED-CONTENT:END -->
50
51See [GitHub](https://github.com/microsoft/FluidFramework) for more details on the Fluid Framework and packages within.