@boehringer-ingelheim/eslint-config 5.0.3 → 6.0.0-flat-config.1

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
@@ -135,6 +135,26 @@ This shared ESLint configuration is designed to enforce best practices and recom
135
135
  - [`playwright/prefer-to-have-length`](https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/prefer-to-have-length.md): enforces the use of `.toHaveLength()` instead of `.toEqual(n)` when testing the length of an object.
136
136
  - [`playwright/require-top-level-describe`](https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/require-top-level-describe.md): requires tests to be organized into top-level `describe()` blocks.
137
137
 
138
+ ### `@boehringer-ingelheim/eslint-config/prettier-disable`
139
+
140
+ ```js
141
+ module.exports = {
142
+ extends: [
143
+ '@boehringer-ingelheim/eslint-config/base/strict',
144
+ // Following needs eslint-plugin-prettier to be installed as described by https://github.com/prettier/eslint-plugin-prettier
145
+ // Should be second to last
146
+ 'plugin:prettier/recommended',
147
+ // Should be last
148
+ '@boehringer-ingelheim/eslint-config/prettier-disable'
149
+ ],
150
+ };
151
+ ```
152
+
153
+ This shared ESLint configuration is wrapper around [`eslint-config-disable`](https://github.com/prettier/eslint-config-prettier), which is used to turn off all rules that are unnecessary or might conflict with Prettier. This wrapper reenables a few rules that can be used with our shared configurations as we are using specific options of those rules which are compatible with Prettier (see [Special Rules](https://github.com/prettier/eslint-config-prettier#special-rules)). Following rules are reenabled:
154
+
155
+ - [`curly`](https://github.com/eslint/eslint/blob/main/docs/src/rules/curly.md) with the (default) option "all": Enforce consistent brace style for all control statements
156
+ - [`no-confusing-arrow`](https://github.com/eslint/eslint/blob/main/docs/src/rules/no-confusing-arrow.md) with allowParens `false` and onlyOneSimpleParam `true`: Disallow arrow functions where they could be confused with comparisons.
157
+
138
158
  ## Local Development
139
159
 
140
160
  ### Install Dependencies
package/base/index.js CHANGED
@@ -1,10 +1,15 @@
1
- const { SORT_CLASSES_GROUPS, SORT_IMPORTS_GROUPS } = require('../lib/eslint-plugin-perfectionist');
1
+ const {
2
+ SORT_CLASSES_GROUPS,
3
+ SORT_IMPORTS_GROUPS,
4
+ SORT_INTERSECTION_TYPES_GROUPS,
5
+ } = require('../lib/eslint-plugin-perfectionist');
2
6
 
3
7
  /**
4
8
  * Workaround to allow ESLint to resolve plugins that were installed
5
9
  * by an external config, see https://github.com/eslint/eslint/issues/3458.
6
10
  */
7
11
  require('@rushstack/eslint-patch/modern-module-resolution');
12
+ const eslintPluginPerfectionist = require('eslint-plugin-perfectionist');
8
13
 
9
14
  /** @type {import('eslint').ESLint.ConfigData & { parserOptions: import('eslint').ESLint.ConfigData['parserOptions'] & import('@typescript-eslint/parser').ParserOptions } } */
10
15
  module.exports = {
@@ -17,7 +22,7 @@ module.exports = {
17
22
  'plugin:@typescript-eslint/stylistic-type-checked',
18
23
  'plugin:import/recommended',
19
24
  'plugin:import/typescript',
20
- 'plugin:perfectionist/recommended-natural',
25
+ 'plugin:perfectionist/recommended-natural-legacy',
21
26
  'plugin:sonarjs/recommended-legacy',
22
27
  ],
23
28
  overrides: [
@@ -61,11 +66,11 @@ module.exports = {
61
66
  '@typescript-eslint/sort-type-constituents': 'off', // disabled due to conflict with eslint-plugin-perfectionist
62
67
 
63
68
  // eslint: https://github.com/eslint/eslint/tree/main/lib/rules
69
+ '@typescript-eslint/dot-notation': ['error', { allowPattern: '^[a-z]+(_[a-z]+)+$' }],
64
70
  'arrow-body-style': ['error', 'as-needed'],
65
71
  camelcase: 'warn',
66
72
  curly: 'error',
67
73
  'default-case': 'error',
68
- 'dot-notation': ['error', { allowPattern: '^[a-z]+(_[a-z]+)+$' }],
69
74
  eqeqeq: 'error',
70
75
  'logical-assignment-operators': ['error', 'never'],
71
76
  'no-console': ['warn', { allow: ['warn', 'error'] }],
@@ -104,31 +109,44 @@ module.exports = {
104
109
  'import/no-named-as-default-member': 'off',
105
110
 
106
111
  // eslint-plugin-perfectionist: https://github.com/azat-io/eslint-plugin-perfectionist
107
- 'perfectionist/sort-array-includes': ['error', { 'ignore-case': true, type: 'natural' }],
108
- 'perfectionist/sort-astro-attributes': ['error', { 'ignore-case': true, type: 'natural' }],
109
- 'perfectionist/sort-classes': ['error', { groups: SORT_CLASSES_GROUPS, 'ignore-case': true, type: 'natural' }],
110
- 'perfectionist/sort-enums': ['error', { 'ignore-case': true, type: 'natural' }],
111
- 'perfectionist/sort-exports': ['error', { 'ignore-case': true, type: 'natural' }],
112
+ 'perfectionist/sort-classes': [
113
+ 'error',
114
+ {
115
+ ...eslintPluginPerfectionist.configs['recommended-natural-legacy'].rules['perfectionist/sort-classes'][1],
116
+ groups: SORT_CLASSES_GROUPS,
117
+ },
118
+ ],
112
119
  'perfectionist/sort-imports': [
113
120
  'error',
114
121
  {
122
+ ...eslintPluginPerfectionist.configs['recommended-natural-legacy'].rules['perfectionist/sort-imports'][1],
115
123
  groups: SORT_IMPORTS_GROUPS,
116
- 'ignore-case': true,
117
- 'newlines-between': 'ignore',
118
- type: 'natural',
124
+ newlinesBetween: 'ignore',
125
+ },
126
+ ],
127
+ 'perfectionist/sort-intersection-types': [
128
+ 'error',
129
+ {
130
+ ...eslintPluginPerfectionist.configs['recommended-natural-legacy'].rules[
131
+ 'perfectionist/sort-intersection-types'
132
+ ][1],
133
+ groups: SORT_INTERSECTION_TYPES_GROUPS,
134
+ },
135
+ ],
136
+ 'perfectionist/sort-named-imports': [
137
+ 'error',
138
+ {
139
+ ...eslintPluginPerfectionist.configs['recommended-natural-legacy'].rules['perfectionist/sort-named-imports'][1],
140
+ ignoreAlias: true,
141
+ },
142
+ ],
143
+ 'perfectionist/sort-objects': [
144
+ 'error',
145
+ {
146
+ ...eslintPluginPerfectionist.configs['recommended-natural-legacy'].rules['perfectionist/sort-objects'][1],
147
+ partitionByComment: true,
119
148
  },
120
149
  ],
121
- 'perfectionist/sort-interfaces': ['error', { 'ignore-case': true, type: 'natural' }],
122
- 'perfectionist/sort-intersection-types': ['error', { 'ignore-case': true, type: 'natural' }],
123
- 'perfectionist/sort-jsx-props': ['error', { 'ignore-case': true, type: 'natural' }],
124
- 'perfectionist/sort-maps': ['error', { 'ignore-case': true, type: 'natural' }],
125
- 'perfectionist/sort-named-exports': ['error', { 'ignore-case': true, type: 'natural' }],
126
- 'perfectionist/sort-named-imports': ['error', { 'ignore-alias': true, 'ignore-case': true, type: 'natural' }],
127
- 'perfectionist/sort-object-types': ['error', { 'ignore-case': true, type: 'natural' }],
128
- 'perfectionist/sort-objects': ['error', { 'ignore-case': true, 'partition-by-comment': true, type: 'natural' }],
129
- 'perfectionist/sort-svelte-attributes': ['error', { 'ignore-case': true, type: 'natural' }],
130
- 'perfectionist/sort-union-types': ['error', { 'ignore-case': true, type: 'natural' }],
131
- 'perfectionist/sort-vue-attributes': ['error', { 'ignore-case': true, type: 'natural' }],
132
150
  },
133
151
  settings: {
134
152
  'import/resolver': {
@@ -9,7 +9,8 @@ const SORT_IMPORTS_GROUPS = [
9
9
  ['external', 'external-type'],
10
10
  ['internal', 'internal-type'],
11
11
  ['parent', 'parent-type', 'sibling', 'sibling-type', 'index', 'index-type'],
12
- ['style', 'side-effect'],
12
+ 'style',
13
+ ['side-effect-style', 'side-effect'],
13
14
  'object',
14
15
  'unknown',
15
16
  ];
@@ -35,7 +36,28 @@ const SORT_CLASSES_GROUPS = [
35
36
  'unknown',
36
37
  ];
37
38
 
39
+ /**
40
+ * This array can be used to configure the perfectionist/sort-intersection-types rule.
41
+ * The following group names are available for configuration: https://perfectionist.dev/rules/sort-intersection-types#groups
42
+ */
43
+ const SORT_INTERSECTION_TYPES_GROUPS = [
44
+ 'conditional',
45
+ 'function',
46
+ 'import',
47
+ 'intersection',
48
+ 'union',
49
+ 'named',
50
+ 'keyword',
51
+ 'literal',
52
+ 'operator',
53
+ 'tuple',
54
+ 'object',
55
+ 'nullish',
56
+ 'unknown',
57
+ ];
58
+
38
59
  module.exports = {
39
60
  SORT_CLASSES_GROUPS,
40
61
  SORT_IMPORTS_GROUPS,
62
+ SORT_INTERSECTION_TYPES_GROUPS,
41
63
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boehringer-ingelheim/eslint-config",
3
- "version": "5.0.3",
3
+ "version": "6.0.0-flat-config.1",
4
4
  "description": "Shared eslint configuration used at Boehringer Ingelheim for code styling",
5
5
  "keywords": [
6
6
  "boehringer",
@@ -27,34 +27,35 @@
27
27
  "repair": "npx --no rimraf .git/hooks node_modules package-lock.json && npm install"
28
28
  },
29
29
  "peerDependencies": {
30
- "eslint": "^8.56.0"
30
+ "eslint": "^8.57.1"
31
31
  },
32
32
  "dependencies": {
33
- "@rushstack/eslint-patch": "^1.10.3",
34
- "@typescript-eslint/eslint-plugin": "^7.14.1",
35
- "@typescript-eslint/parser": "^7.14.1",
36
- "eslint-import-resolver-typescript": "^3.6.1",
37
- "eslint-plugin-import": "^2.29.1",
38
- "eslint-plugin-jsx-a11y": "^6.9.0",
39
- "eslint-plugin-perfectionist": "^2.11.0",
40
- "eslint-plugin-playwright": "^1.6.2",
41
- "eslint-plugin-react": "^7.34.3",
42
- "eslint-plugin-react-hooks": "^4.6.2",
43
- "eslint-plugin-react-refresh": "^0.4.7",
44
- "eslint-plugin-sonarjs": "^1.0.3",
33
+ "@rushstack/eslint-patch": "^1.10.4",
34
+ "@typescript-eslint/eslint-plugin": "^8.18.0",
35
+ "@typescript-eslint/parser": "^8.18.0",
36
+ "eslint-config-prettier": "^9.1.0",
37
+ "eslint-import-resolver-typescript": "^3.7.0",
38
+ "eslint-plugin-import": "^2.31.0",
39
+ "eslint-plugin-jsx-a11y": "^6.10.2",
40
+ "eslint-plugin-perfectionist": "^4.3.0",
41
+ "eslint-plugin-playwright": "^2.1.0",
42
+ "eslint-plugin-react": "^7.37.2",
43
+ "eslint-plugin-react-hooks": "^5.1.0",
44
+ "eslint-plugin-react-refresh": "^0.4.16",
45
+ "eslint-plugin-sonarjs": "^3.0.1",
45
46
  "eslint-plugin-typescript-enum": "^2.1.0",
46
- "is-ci": "^3.0.1"
47
+ "is-ci": "^4.1.0"
47
48
  },
48
49
  "devDependencies": {
49
50
  "@boehringer-ingelheim/prettier-config": "2.0.0",
50
- "@commitlint/cli": "19.3.0",
51
- "@commitlint/config-conventional": "19.2.2",
52
- "@commitlint/types": "19.0.3",
51
+ "@commitlint/cli": "19.6.0",
52
+ "@commitlint/config-conventional": "19.6.0",
53
+ "@commitlint/types": "19.5.0",
53
54
  "@semantic-release/changelog": "6.0.3",
54
55
  "@semantic-release/git": "10.0.1",
55
- "dotenv-cli": "7.4.2",
56
- "husky": "9.0.11",
57
- "prettier": "3.3.2",
58
- "semantic-release": "24.0.0"
56
+ "dotenv-cli": "7.4.4",
57
+ "husky": "9.1.7",
58
+ "prettier": "3.4.2",
59
+ "semantic-release": "24.2.0"
59
60
  }
60
61
  }
package/react/index.js CHANGED
@@ -28,7 +28,7 @@ module.exports = {
28
28
  plugins: ['jsx-a11y', 'react', 'react-hooks', 'react-refresh', 'typescript-enum'],
29
29
  rules: {
30
30
  // @typescript-eslint: https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin/docs/rules
31
- '@typescript-eslint/ban-types': [
31
+ '@typescript-eslint/no-restricted-types': [
32
32
  'error',
33
33
  {
34
34
  types: {
@@ -58,7 +58,7 @@ module.exports = {
58
58
  'perfectionist/sort-imports': [
59
59
  'error',
60
60
  {
61
- 'custom-groups': {
61
+ customGroups: {
62
62
  type: {
63
63
  react: ['react'],
64
64
  },
@@ -67,20 +67,20 @@ module.exports = {
67
67
  },
68
68
  },
69
69
  groups: ['react', ...SORT_IMPORTS_GROUPS],
70
- 'ignore-case': true,
71
- 'newlines-between': 'ignore',
70
+ ignoreCase: true,
71
+ newlinesBetween: 'ignore',
72
72
  type: 'natural',
73
73
  },
74
74
  ],
75
75
  'perfectionist/sort-jsx-props': [
76
76
  'error',
77
77
  {
78
- 'custom-groups': {
78
+ customGroups: {
79
79
  callback: 'on*',
80
80
  reservedProps: ['children', 'dangerouslySetInnerHTML', 'key', 'ref'], // Reserved props from: https://github.com/jsx-eslint/eslint-plugin-react/blob/master/lib/rules/jsx-sort-props.js#L40C12-L40C12
81
81
  },
82
82
  groups: ['reservedProps', 'unknown', 'callback'],
83
- 'ignore-case': true,
83
+ ignoreCase: true,
84
84
  type: 'natural',
85
85
  },
86
86
  ],