@boehringer-ingelheim/eslint-config 7.0.0-shared-configuration-nextjs.1 → 7.0.0-shared-configuration-nextjs.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -142,6 +142,7 @@ This shared ESLint configuration is specifically tailored for [React](https://re
142
142
  - [`eslint-plugin-jsx-a11y`](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y)
143
143
  - [`eslint-plugin-react`](https://github.com/jsx-eslint/eslint-plugin-react)
144
144
  - [`eslint-plugin-react-hooks`](https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks)
145
+ - [`eslint-plugin-react-refresh`](https://github.com/ArnaudBarre/eslint-plugin-react-refresh) (with rule severity `warn`)
145
146
 
146
147
  The configuration sets several custom rules, including [`@typescript-eslint/no-restricted-types`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-restricted-types.mdx) and [`@typescript-eslint/consistent-type-definitions`](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/consistent-type-definitions.mdx), as well as rules for organizing and formatting import statements.
147
148
  Additionally in restricts the usage of enums using [`no-restricted-syntax`](https://github.com/eslint/eslint/blob/main/docs/src/rules/no-restricted-syntax.md).
@@ -157,7 +158,9 @@ export default boehringer.config(
157
158
  );
158
159
  ```
159
160
 
160
- This shared ESLint configuration is specifically tailored for [Next.js](https://nextjs.org/) projects. It extends the [react configuration](#react) and includes the [`@next/eslint-plugin-next`](https://nextjs.org/docs/app/api-reference/config/eslint) plugin with the recommended and [`core-web-vital`](https://nextjs.org/docs/app/api-reference/config/eslint#with-core-web-vitals) rule set.
161
+ This shared ESLint configuration is specifically tailored for [Next.js](https://nextjs.org/) projects. It extends the [react configuration](#react) and includes the [`@next/eslint-plugin-next`](https://nextjs.org/docs/app/api-reference/config/eslint) plugin with the recommended and [`core-web-vital`](https://nextjs.org/docs/app/api-reference/config/eslint#with-core-web-vitals) rule set. The configuration also adapts the rule `react-refresh/only-export-components` to be compatible with Next.js.
162
+
163
+ It
161
164
 
162
165
  ### Playwright
163
166
 
package/configs/nextjs.js CHANGED
@@ -8,6 +8,32 @@ module.exports = tseslint.config(...react, {
8
8
  '@next/next': nextPlugin,
9
9
  },
10
10
  rules: {
11
+ // eslint-plugin-react-refresh: https://github.com/ArnaudBarre/eslint-plugin-react-refresh
12
+ 'react-refresh/only-export-components': [
13
+ 'warn',
14
+ {
15
+ /**
16
+ * Next.js allows exporting the following options in pages, layouts and route handlers
17
+ *
18
+ * @see https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config
19
+ */
20
+ allowExportNames: [
21
+ 'config',
22
+ 'dynamic',
23
+ 'dynamicParams',
24
+ 'fetchCache',
25
+ 'generateMetadata',
26
+ 'generateStaticParams',
27
+ 'generateViewport',
28
+ 'maxDuration',
29
+ 'metadata',
30
+ 'preferredRegion',
31
+ 'revalidate',
32
+ 'runtime',
33
+ 'viewport',
34
+ ],
35
+ },
36
+ ],
11
37
  ...nextPlugin.configs.recommended.rules,
12
38
  ...nextPlugin.configs['core-web-vitals'].rules,
13
39
  },
package/configs/react.js CHANGED
@@ -13,6 +13,7 @@ module.exports = tseslint.config(
13
13
  jsxA11y.flatConfigs.recommended,
14
14
  react.configs.flat.recommended,
15
15
  react.configs.flat['jsx-runtime'],
16
+ reactRefresh.configs.recommended,
16
17
  {
17
18
  languageOptions: {
18
19
  globals: {
@@ -25,9 +26,7 @@ module.exports = tseslint.config(
25
26
  },
26
27
  },
27
28
  plugins: {
28
- 'jsx-a11y': jsxA11y,
29
29
  'react-hooks': reactHooks,
30
- 'react-refresh': reactRefresh,
31
30
  },
32
31
  rules: {
33
32
  // @typescript-eslint: https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin/docs/rules
package/index.js CHANGED
@@ -2,6 +2,7 @@ const tseslint = require('typescript-eslint');
2
2
 
3
3
  const base = require('./configs/base.js');
4
4
  const local = require('./configs/local.js');
5
+ const nextjs = require('./configs/nextjs.js');
5
6
  const playwright = require('./configs/playwright.js');
6
7
  const prettierDisable = require('./configs/prettier-disable.js');
7
8
  const react = require('./configs/react.js');
@@ -12,6 +13,7 @@ module.exports = {
12
13
  configs: {
13
14
  base,
14
15
  local,
16
+ nextjs,
15
17
  playwright,
16
18
  prettierDisable,
17
19
  react,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boehringer-ingelheim/eslint-config",
3
- "version": "7.0.0-shared-configuration-nextjs.1",
3
+ "version": "7.0.0-shared-configuration-nextjs.3",
4
4
  "description": "Shared eslint configuration used at Boehringer Ingelheim for code styling",
5
5
  "keywords": [
6
6
  "boehringer",