Skip to content

ESLint configuration for Node.js + TypeScript micro services

License

Notifications You must be signed in to change notification settings

scheduleonce/eslint-config-oncehub

Repository files navigation

eslint-config-oncehub

Build status styled with prettier

ESLint configuration for services built with Node.js and TypeScript.

The configuration exports and extends @typescript-eslint/recommended, eslint-plugin-sonarjs, prettier ESLint configurations.

It is compatible with ESlint >= v9 configuration format (flat config).

Installation

To install this module, run the following command:

$ npm install --save-dev @oncehub/eslint-config

Note that it requires ESlint v9 and above.

Usage

Import the package inside of an eslint.config.js file and add it into the exported array, like this:

// eslint.config.js
import oncehub from "@oncehub/eslint-config";

export default [...oncehub];

Development

Tests

Run tests via npm test. 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.

As a byproduct, the tests are also checking that the configuration is valid and all is okay with it. You can also further debug the config via:

$ npx eslint --debug -c index.js index.js

To generate a new rules snapshot file:

$ npx eslint --print-config index.js -c index.js > output.json

Copy the rules from the output file into test/rules-snapshot.js

Deployment

Package is automatically published to npm when creating a new release on Github. Check out the release section in the repo. Read more about releases here.

License

This module is licensed under the MIT License. See the LICENSE file for details.