|
| 1 | +# Linting |
| 2 | + |
| 3 | +This project contains linting templates for Quartz projects. Currently, it |
| 4 | +contains: |
| 5 | + |
| 6 | +- `@quartz/eslint-config-base`: Base ESLint config for JavaScript projects |
| 7 | +- `@quartz/eslint-config-react`: ESLint config for React projects |
| 8 | +- `.editorconfig`: EditorConfig for all projects |
| 9 | + |
| 10 | +## Usage |
| 11 | + |
| 12 | +### Installing in your Non-React project |
| 13 | + |
| 14 | +In your shiny-new project (or the project you're retrofitting): |
| 15 | + |
| 16 | +``` |
| 17 | +npm install --save-dev \ |
| 18 | + @quartz/eslint-config-base \ |
| 19 | + @typescript-eslint/eslint-plugin \ |
| 20 | + eslint \ |
| 21 | + eslint-plugin-es \ |
| 22 | + eslint-plugin-import \ |
| 23 | + eslint-plugin-jest \ |
| 24 | + jest |
| 25 | +``` |
| 26 | + |
| 27 | +And then use it in your ESLint config, e.g. in `.eslintrc`: |
| 28 | + |
| 29 | +``` |
| 30 | +{ |
| 31 | + "extends": [ |
| 32 | + "@quartz/eslint-config-base" |
| 33 | + ] |
| 34 | +} |
| 35 | +``` |
| 36 | + |
| 37 | +### Installing in your React project |
| 38 | + |
| 39 | +Yay! More dependencies! |
| 40 | + |
| 41 | +``` |
| 42 | +npm install --save-dev \ |
| 43 | + @quartz/eslint-config-react \ |
| 44 | + eslint-plugin-jsx-a11y \ |
| 45 | + eslint-plugin-react \ |
| 46 | + eslint-plugin-react-hooks |
| 47 | +``` |
| 48 | + |
| 49 | +And then add this to your ESLint config, like so: |
| 50 | + |
| 51 | +``` |
| 52 | +{ |
| 53 | + "extends": [ |
| 54 | + "@quartz/eslint-config-base", |
| 55 | + "@quartz/eslint-config-react" |
| 56 | + ] |
| 57 | +} |
| 58 | +``` |
| 59 | + |
| 60 | +## Maintenance |
| 61 | + |
| 62 | +Versions of these libraries are published to NPM. |
| 63 | + |
| 64 | +### Testing changes before publishing |
| 65 | + |
| 66 | +To test changes locally, clone this Git repo and then install the project(s) |
| 67 | +locally in your project -- e.g., in your `qz-react` directory: |
| 68 | + |
| 69 | +``` |
| 70 | +npm install --save-dev /path/to/lint/eslint-react |
| 71 | +``` |
| 72 | + |
| 73 | +See how that affects your project code. Talk it over with the team. And then: |
| 74 | + |
| 75 | +1. Publish a new version of `@quartz/eslint-config-react` |
| 76 | +2. In your project, install the newly-published version (so the project doesn't |
| 77 | + expect stuff in the local filesystem). |
| 78 | + |
| 79 | +### Publishing NPM modules |
| 80 | + |
| 81 | +1. Make sure you have an [NPM account](https://npmjs.com) and it has been added |
| 82 | + to the `@quartz` organization. |
| 83 | +2. Log in to NPM: `npm login` |
| 84 | +3. Update the package version: |
| 85 | + ``` |
| 86 | + cd /path/to/my-package |
| 87 | + npm version [patch|minor|major] |
| 88 | + ``` |
| 89 | +4. Commit the version change. |
| 90 | +5. Make sure everything is correct! There is no undo! |
| 91 | +6. Publish the new version: `npm publish` |
| 92 | +7. Update the dependency in projects that use the package, e.g.: |
| 93 | + ``` |
| 94 | + cd /path/to/my-project-that-uses-my-package |
| 95 | + npm update --save-dev my-package@1.0.1 |
| 96 | + ``` |
0 commit comments