@aivenio/eslint-config-aiven
v10.0.0
Published
ESLint configuration, following the styleguide of aiven.io
Maintainers
Keywords
Readme
eslint-config-aiven
Our internal ESLint and prettier configuration. We want to autoformat code like prettier does, but also do more static checks that eslint does. To do both, we use eslint-plugin-prettier and eslint acts as the frontend to check and autofix style and other issues.
The configuration is split into:
@aivenio/eslint-config-aiven- Recommended base configuration for TypeScript.
@aivenio/eslint-config-aiven/react- Base + React additions.
@aivenio/eslint-config-aiven/typescript-type-checked- Base + TS rules that require typed linting
Usage
Install recommended base
npm install @aivenio/eslint-config-aivenCreate an
eslint.config.jsfile in your repository root and select which configuration to use:
import baseConfig from '@aivenio/eslint-config-aiven';
import { defineConfig } from 'eslint/config';
export default defineConfig(baseConfig, { /* further configuration */ });
// Or choose one of the variants:
// import reactConfig from '@aivenio/eslint-config-aiven/react';
// import typeCheckedConfig from '@aivenio/eslint-config-aiven/typescript-type-checked';
// export default defineConfig(reactConfig, typeCheckedConfig, { /* further configuration */ });When using eslint-config-aiven/react, install the required peer dependencies: eslint-plugin-react, eslint-plugin-react-hooks and eslint-plugin-jsx-a11y.
- Setup npm scripts in package.json
"eslint:fix": "eslint --fix \"src/**/*.{ts,tsx}\"",
"eslint:check": "eslint \"src/**/*.{ts,tsx}\"",- Remember to setup a CI task to lint source code. See .github/workflows/test.yml for a GH action example.
Install for React
Follow all steps in "Install recommended base" first
Install additional peer dependencies
npm i --save-dev eslint-plugin-jsx-a11y
npm i --save-dev eslint-plugin-react- Change the
eslint.config.jsin your repository to have the following contents:
import reactConfig from '@aivenio/eslint-config-aiven/react';
import { defineConfig } from 'eslint/config';
export default defineConfig(reactConfig, { /* further configuration */ });Development
How to create a new release
Locally:
Run
npm run release -- --bump <bump>(all the dashes are needed) where bump is one ofmajor,minororpatch.This command will automatically checkout a release branch, commit the version bump, and open your browser to submit a PR.
Review the PR created, and merge it to main. GH actions will handle the rest.
