Skip to content

Commit fa25e0c

Browse files
committed
feat(eslint): migrate from tseslint.config to eslint.defineConfig
- the `config(...)` utility function from tseslint was deprecated in favor of ESLint core's `defineConfig(...)`, see: https://typescript-eslint.io/packages/typescript-eslint/#config-deprecated - update documentation BREAKING CHANGE: The `boehringer.config(...)` utility function has been removed in favor of ESLint core’s `defineConfig(...)`. Replace `boehringer.config(...)` with `defineConfig(...)` from `eslint/config` ```diff import boehringer from '@boehringer-ingelheim/eslint-config'; + import { defineConfig } from 'eslint/config'; - export default boehringer.config( + export default defineConfig( boehringer.configs.strict, { rules: { 'no-empty-function': 'off', }, } ); ```
1 parent 2017fbd commit fa25e0c

File tree

13 files changed

+56
-48
lines changed

13 files changed

+56
-48
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v22
1+
v22.18

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Boehringer Ingelheim
3+
Copyright (c) 2025 Boehringer Ingelheim
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,22 @@ Create or update the `eslint.config.mjs` (`eslint.config.cjs` is also possible i
2525

2626
```js
2727
import boehringer from '@boehringer-ingelheim/eslint-config';
28+
import { defineConfig } from 'eslint/config';
2829

29-
export default boehringer.config(
30+
export default defineConfig(
3031
boehringer.configs.strict
3132
)
3233
```
3334

34-
#### `boehringer.config(...)`
35-
36-
This function is a re-export for the config-helper of typescript eslint (See [docs](https://github.com/typescript-eslint/typescript-eslint/blob/a383d5022b81eaf65ce7b0946491444c6eaa28e3/docs/packages/TypeScript_ESLint.mdx#config)).
37-
38-
##### Extend or Override configuration
35+
#### Extend or Override configuration
3936

4037
This is not recommended as the goal is to have similar code stylings in all projects, but if for some reason you need to add or change the configuration, it is possible in the following way:
4138

4239
```js
4340
import boehringer from '@boehringer-ingelheim/eslint-config';
41+
import { defineConfig } from 'eslint/config';
4442

45-
export default boehringer.config(
43+
export default defineConfig(
4644
boehringer.configs.strict,
4745
{
4846
rules: {
@@ -60,8 +58,9 @@ It is recommended to use this function to ensure that your `.gitignore` file is
6058

6159
```js
6260
import boehringer from '@boehringer-ingelheim/eslint-config';
61+
import { defineConfig } from 'eslint/config';
6362

64-
export default boehringer.config(
63+
export default defineConfig(
6564
boehringer.includeIgnoreFile(), // default value '.gitignore'
6665
boehringer.configs.strict,
6766
);
@@ -71,8 +70,9 @@ or in case you have a different paths to your `.gitignore` file(s):
7170

7271
```js
7372
import boehringer from '@boehringer-ingelheim/eslint-config';
73+
import { defineConfig } from 'eslint/config';
7474

75-
export default boehringer.config(
75+
export default defineConfig(
7676
boehringer.includeIgnoreFile('./backend/.gitignore'),
7777
boehringer.includeIgnoreFile('./frontend/.gitignore'),
7878
boehringer.configs.strict,
@@ -95,8 +95,9 @@ Opinionated Options that differ from the standard/recommended ESLint configurati
9595

9696
```js
9797
import boehringer from '@boehringer-ingelheim/eslint-config';
98+
import { defineConfig } from 'eslint/config';
9899

99-
export default boehringer.config(
100+
export default defineConfig(
100101
boehringer.configs.base
101102
)
102103
```
@@ -117,8 +118,9 @@ This configuration also sets up the TypeScript parser [`@typescript-eslint/parse
117118

118119
```js
119120
import boehringer from '@boehringer-ingelheim/eslint-config';
121+
import { defineConfig } from 'eslint/config';
120122

121-
export default boehringer.config(
123+
export default defineConfig(
122124
boehringer.configs.base,
123125
boehringer.configs.local
124126
);
@@ -130,8 +132,9 @@ This shared ESLint configuration configures or disables some rules for a better
130132

131133
```js
132134
import boehringer from '@boehringer-ingelheim/eslint-config';
135+
import { defineConfig } from 'eslint/config';
133136

134-
export default boehringer.config(
137+
export default defineConfig(
135138
boehringer.configs.strict
136139
);
137140
```
@@ -142,8 +145,9 @@ This shared ESLint configuration extends the [base configuration](#base) and add
142145

143146
```js
144147
import boehringer from '@boehringer-ingelheim/eslint-config';
148+
import { defineConfig } from 'eslint/config';
145149

146-
export default boehringer.config(
150+
export default defineConfig(
147151
boehringer.configs.strict,
148152
boehringer.configs.react
149153
);
@@ -163,8 +167,9 @@ Additionally in restricts the usage of enums using [`no-restricted-syntax`](http
163167

164168
```js
165169
import boehringer from '@boehringer-ingelheim/eslint-config';
170+
import { defineConfig } from 'eslint/config';
166171

167-
export default boehringer.config(
172+
export default defineConfig(
168173
boehringer.configs.strict,
169174
boehringer.configs.nextjs
170175
);
@@ -176,8 +181,9 @@ This shared ESLint configuration is specifically tailored for [Next.js](https://
176181

177182
```js
178183
import boehringer from '@boehringer-ingelheim/eslint-config';
184+
import { defineConfig } from 'eslint/config';
179185

180-
export default boehringer.config(
186+
export default defineConfig(
181187
boehringer.configs.strict,
182188
boehringer.configs.playwright
183189
);
@@ -187,12 +193,13 @@ or for specific files only:
187193

188194
```js
189195
import boehringer from '@boehringer-ingelheim/eslint-config';
196+
import { defineConfig } from 'eslint/config';
190197

191-
export default boehringer.config(
198+
export default defineConfig(
192199
boehringer.configs.strict,
193200
{
194201
files: ['src/**/*.test.{ts,tsx}'],
195-
...(await boehringer.configs.playwright)[0],
202+
...boehringer.configs.playwright[0],
196203
},
197204
);
198205
```
@@ -207,8 +214,9 @@ This shared ESLint configuration is designed to enforce best practices and recom
207214

208215
```js
209216
import boehringer from '@boehringer-ingelheim/eslint-config';
217+
import { defineConfig } from 'eslint/config';
210218

211-
export default boehringer.config(
219+
export default defineConfig(
212220
boehringer.configs.strict,
213221
// possibly other configs,
214222
boehringer.configs.experimentalNamingConvention
@@ -222,8 +230,9 @@ This shared ESLint configuration is designed to enforce some naming conventions.
222230
```js
223231
import boehringer from '@boehringer-ingelheim/eslint-config';
224232
import prettier from 'eslint-plugin-prettier/recommended';
233+
import { defineConfig } from 'eslint/config';
225234

226-
export default boehringer.config(
235+
export default defineConfig(
227236
boehringer.configs.strict,
228237
// Following needs eslint-plugin-prettier to be installed as described by https://github.com/prettier/eslint-plugin-prettier
229238
// Should be second to last
@@ -272,8 +281,9 @@ You can use the new [`allowDefaultProject`](https://typescript-eslint.io/package
272281

273282
```js
274283
import boehringer from '@boehringer-ingelheim/eslint-config';
284+
import { defineConfig } from 'eslint/config';
275285

276-
export default boehringer.config(
286+
export default defineConfig(
277287
// other configs,
278288
{
279289
languageOptions: {
@@ -347,7 +357,7 @@ Give a ⭐️ if this project helped you!
347357

348358
## License
349359

350-
Copyright © 2023 [Boehringer Ingelheim](https://github.com/boehringer-ingelheim).
360+
Copyright © 2025 [Boehringer Ingelheim](https://github.com/boehringer-ingelheim).
351361
This project is [MIT](https://github.com/boehringer-ingelheim/eslint-config/blob/master/LICENSE) licensed.
352362

353363
## Resources

configs/base.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const eslint = require('@eslint/js');
22
const importPlugin = require('eslint-plugin-import');
33
const perfectionist = require('eslint-plugin-perfectionist');
44
const sonarjs = require('eslint-plugin-sonarjs');
5+
const { defineConfig } = require('eslint/config');
56
const tseslint = require('typescript-eslint');
67

78
const {
@@ -10,7 +11,7 @@ const {
1011
SORT_INTERSECTION_TYPES_GROUPS,
1112
} = require('../lib/eslint-plugin-perfectionist.js');
1213

13-
module.exports = tseslint.config(
14+
module.exports = defineConfig(
1415
eslint.configs.recommended,
1516
tseslint.configs.recommendedTypeChecked,
1617
tseslint.configs.stylisticTypeChecked,

configs/experimental-naming-convention.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const tseslint = require('typescript-eslint');
1+
const { defineConfig } = require('eslint/config');
22

3-
module.exports = tseslint.config({
3+
module.exports = defineConfig({
44
rules: {
55
'@typescript-eslint/naming-convention': [
66
'error',

configs/local.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
const { defineConfig } = require('eslint/config');
12
const isCI = require('is-ci');
2-
const tseslint = require('typescript-eslint');
33

4-
module.exports = tseslint.config(
4+
module.exports = defineConfig(
55
isCI
66
? {}
77
: {

configs/nextjs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
const nextPlugin = require('@next/eslint-plugin-next');
2-
const tseslint = require('typescript-eslint');
2+
const { defineConfig } = require('eslint/config');
33

44
const react = require('./react.js');
55

6-
module.exports = tseslint.config(
6+
module.exports = defineConfig(
77
...react,
88
{
99
plugins: {

configs/playwright.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const playwright = require('eslint-plugin-playwright');
2-
const tseslint = require('typescript-eslint');
2+
const { defineConfig } = require('eslint/config');
33

4-
module.exports = tseslint.config({
4+
module.exports = defineConfig({
55
...playwright.configs['flat/recommended'],
66
rules: {
77
/**

configs/prettier-disable.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const prettier = require('eslint-config-prettier');
2-
const tseslint = require('typescript-eslint');
2+
const { defineConfig } = require('eslint/config');
33

4-
module.exports = tseslint.config({
4+
module.exports = defineConfig({
55
...prettier,
66
rules: {
77
...prettier.rules,

configs/react.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ const jsxA11y = require('eslint-plugin-jsx-a11y');
22
const react = require('eslint-plugin-react');
33
const reactHooks = require('eslint-plugin-react-hooks');
44
const reactRefresh = require('eslint-plugin-react-refresh');
5+
const { defineConfig } = require('eslint/config');
56
const globals = require('globals');
6-
const tseslint = require('typescript-eslint');
77

88
const { SORT_IMPORTS_GROUPS } = require('../lib/eslint-plugin-perfectionist.js');
99
const base = require('./base.js');
1010

11-
module.exports = tseslint.config(
11+
module.exports = defineConfig(
1212
...base,
1313
jsxA11y.flatConfigs.recommended,
1414
react.configs.flat.recommended,

0 commit comments

Comments
 (0)