1 | # @fluidframework/eslint-config-fluid
|
2 |
|
3 | This package contains a shared ESLint config used by all the packages in the Fluid Framework repo.
|
4 |
|
5 | It 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 |
|
13 | If you want to change the shared lint config (that is, this package), you need to do the following:
|
14 |
|
15 | 1. Make the change in the config.
|
16 | 2. Publish a pre-release package.
|
17 | 3. Update the core packages to use the pre-release lint config.
|
18 |
|
19 | When 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 |
|
23 | One question that comes up often when we make changes to our lint config is, "what changed?" This applies even when we
|
24 | don't make any changes other than upgrading deps, because the dependency upgrade might include a new rule.
|
25 |
|
26 | ESLint provides a way to print the config that would apply to a file (`--print-config`), so we use this capability to
|
27 | print out the applied config as a JSON file. As we make changes to the config, we can print out the config again and get
|
28 | a diff to review as part of a PR -- just like we do with API reports for code changes.
|
29 |
|
30 | ## Scripts
|
31 |
|
32 |
|
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 |
|
50 |
|
51 | See [GitHub](https://github.com/microsoft/FluidFramework) for more details on the Fluid Framework and packages within.
|