|
1 |
| -Introduction |
2 |
| -= |
3 |
| -ESLint configuration for micro-services built using Node.js and TypeScript. |
| 1 | +# eslint-config-oncehub |
| 2 | + |
| 3 | +[](https://github.com/scheduleonce/eslint-config-oncehub/actions) [](https://github.com/prettier/prettier) |
| 4 | + |
| 5 | +> ESLint configuration for services built with Node.js and TypeScript. |
4 | 6 |
|
5 | 7 | The configuration extends `@typescript-eslint/recommended`, `eslint-plugin-sonarjs`, `prettier` ESLint configurations.
|
6 | 8 |
|
| 9 | +It is compatible with ESlint >= v9 configuration format (flat config). |
| 10 | + |
7 | 11 | ## Installation
|
8 |
| -Using **NPM** |
9 |
| -```sh |
10 |
| -npm i --save-dev @oncehub/eslint-config |
11 |
| -``` |
12 | 12 |
|
13 |
| -Using **Yarn** |
| 13 | +To install this module, run the following command: |
| 14 | + |
14 | 15 | ```sh
|
15 |
| -yarn add --dev @oncehub/eslint-config |
| 16 | +$ npm install --save-dev @oncehub/eslint-config |
16 | 17 | ```
|
17 | 18 |
|
| 19 | +Note that it requires ESlint v9 and above. |
| 20 | + |
18 | 21 | ## Usage
|
| 22 | + |
19 | 23 | In your `.eslintrc` file, put `@oncehub/eslint-config` under `extends` array as shown below.
|
| 24 | + |
20 | 25 | ```js
|
21 | 26 | module.exports = {
|
22 |
| - 'extends': [ |
23 |
| - '@oncehub/eslint-config' |
24 |
| - ] |
| 27 | + extends: ["@oncehub/eslint-config"], |
25 | 28 | };
|
26 |
| -``` |
| 29 | +``` |
| 30 | + |
| 31 | +## Development |
| 32 | + |
| 33 | +### Tests |
| 34 | + |
| 35 | +Run tests via `npm test`. |
| 36 | +The tests are comparing the eslint configuration against a previously saved snapshot of the rules so if you are adding or removing any rule, make sure to update the tests. |
| 37 | + |
| 38 | +As a byproduct, the tests are also checking that the configuration is valid and all is okay with it. |
| 39 | +You can also further debug the config via: |
| 40 | + |
| 41 | +```sh |
| 42 | +$ npx eslint --debug -c index.js index.js |
| 43 | +``` |
| 44 | + |
| 45 | +To generate a new rules snapshot file: |
| 46 | + |
| 47 | +```sh |
| 48 | +$ npx eslint --print-config index.js -c index.js > output.json |
| 49 | +``` |
| 50 | + |
| 51 | +Copy the rules from the output file into `test/rules-snapshot.js` |
| 52 | + |
| 53 | +### Deployment |
| 54 | + |
| 55 | +Package is automatically published to npm when [creating a new release](.github/workflows/npm-publish.yml) on Github. Check out the release section in the repo. Read more about releases [here](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository). |
| 56 | + |
| 57 | +## License |
| 58 | + |
| 59 | +This module is licensed under the MIT License. See the LICENSE file for details. |
0 commit comments