|
| 1 | +# Default build configuration by Grafana |
| 2 | + |
| 3 | +**This is an auto-generated directory and is not intended to be changed! ⚠️** |
| 4 | + |
| 5 | +The `.config/` directory holds basic configuration for the different tools |
| 6 | +that are used to develop, test and build the project. In order to make it updates easier we ask you to |
| 7 | +not edit files in this folder to extend configuration. |
| 8 | + |
| 9 | +## How to extend the basic configs? |
| 10 | + |
| 11 | +Bear in mind that you are doing it at your own risk, and that extending any of the basic configuration can lead |
| 12 | +to issues around working with the project. |
| 13 | + |
| 14 | +### Extending the ESLint config |
| 15 | + |
| 16 | +Edit the `.eslintrc` file in the project root in order to extend the ESLint configuration. |
| 17 | + |
| 18 | +**Example:** |
| 19 | + |
| 20 | +```json |
| 21 | +{ |
| 22 | + "extends": "./.config/.eslintrc", |
| 23 | + "rules": { |
| 24 | + "react/prop-types": "off" |
| 25 | + } |
| 26 | +} |
| 27 | +``` |
| 28 | + |
| 29 | +--- |
| 30 | + |
| 31 | +### Extending the Prettier config |
| 32 | + |
| 33 | +Edit the `.prettierrc.js` file in the project root in order to extend the Prettier configuration. |
| 34 | + |
| 35 | +**Example:** |
| 36 | + |
| 37 | +```javascript |
| 38 | +module.exports = { |
| 39 | + // Prettier configuration provided by Grafana scaffolding |
| 40 | + ...require('./.config/.prettierrc.js'), |
| 41 | + |
| 42 | + semi: false, |
| 43 | +}; |
| 44 | +``` |
| 45 | + |
| 46 | +--- |
| 47 | + |
| 48 | +### Extending the Jest config |
| 49 | + |
| 50 | +There are two configuration in the project root that belong to Jest: `jest-setup.js` and `jest.config.js`. |
| 51 | + |
| 52 | +**`jest-setup.js`:** A file that is run before each test file in the suite is executed. We are using it to |
| 53 | +set up the Jest DOM for the testing library and to apply some polyfills. ([link to Jest docs](https://jestjs.io/docs/configuration#setupfilesafterenv-array)) |
| 54 | + |
| 55 | +**`jest.config.js`:** The main Jest configuration file that is extending our basic Grafana-tailored setup. ([link to Jest docs](https://jestjs.io/docs/configuration)) |
| 56 | + |
| 57 | +--- |
| 58 | + |
| 59 | +### Extending the TypeScript config |
| 60 | + |
| 61 | +Edit the `tsconfig.json` file in the project root in order to extend the TypeScript configuration. |
| 62 | + |
| 63 | +**Example:** |
| 64 | + |
| 65 | +```json |
| 66 | +{ |
| 67 | + "extends": "./.config/tsconfig.json", |
| 68 | + "compilerOptions": { |
| 69 | + "preserveConstEnums": true |
| 70 | + } |
| 71 | +} |
| 72 | +``` |
0 commit comments