@croct/eslint-plugin 0.7.1 → 0.8.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/configs/react.js CHANGED
@@ -1,131 +1,355 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.react = void 0;
4
- exports.react = {
5
- extends: [
6
- 'airbnb',
7
- 'plugin:react/recommended',
8
- 'plugin:testing-library/react',
9
- 'plugin:jest-dom/recommended',
10
- 'plugin:jsx-a11y/recommended',
11
- 'plugin:@croct/javascript',
6
+ exports.createReactConfig = createReactConfig;
7
+ const eslint_plugin_react_1 = __importDefault(require("eslint-plugin-react"));
8
+ const eslint_plugin_react_hooks_1 = __importDefault(require("eslint-plugin-react-hooks"));
9
+ const eslint_plugin_testing_library_1 = __importDefault(require("eslint-plugin-testing-library"));
10
+ const eslint_plugin_jest_dom_1 = __importDefault(require("eslint-plugin-jest-dom"));
11
+ // @ts-expect-error - no types available
12
+ const eslint_plugin_jsx_a11y_1 = __importDefault(require("eslint-plugin-jsx-a11y"));
13
+ // @ts-expect-error - no types available
14
+ const eslint_plugin_1 = __importDefault(require("@stylistic/eslint-plugin"));
15
+ const baseRules = {
16
+ // Custom rule
17
+ '@croct/jsx-attribute-spacing': 'error',
18
+ // React rules (from airbnb, with customizations)
19
+ 'react/display-name': 'off',
20
+ 'react/forbid-prop-types': ['error', {
21
+ forbid: ['any', 'array', 'object'],
22
+ checkContextTypes: true,
23
+ checkChildContextTypes: true,
24
+ }],
25
+ 'react/forbid-dom-props': ['off', { forbid: [] }],
26
+ 'react/jsx-boolean-value': ['error', 'never', { always: [] }],
27
+ 'react/jsx-closing-bracket-location': ['error', 'line-aligned'],
28
+ 'react/jsx-closing-tag-location': 'error',
29
+ 'react/jsx-curly-spacing': ['error', 'never', { allowMultiline: true }],
30
+ 'react/jsx-handler-names': ['off', {
31
+ eventHandlerPrefix: 'handle',
32
+ eventHandlerPropPrefix: 'on',
33
+ }],
34
+ 'react/jsx-indent-props': 'off',
35
+ 'react/jsx-key': 'off',
36
+ 'react/jsx-max-props-per-line': ['error', { maximum: 1, when: 'multiline' }],
37
+ 'react/jsx-no-bind': [
38
+ 'error',
39
+ {
40
+ allowArrowFunctions: true,
41
+ allowBind: false,
42
+ allowFunctions: true,
43
+ },
12
44
  ],
13
- plugins: [
14
- 'import',
15
- 'react',
16
- 'react-hooks',
17
- 'testing-library',
18
- 'jest-dom',
19
- '@croct',
45
+ 'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }],
46
+ 'react/jsx-no-literals': ['off', { noStrings: true }],
47
+ 'react/jsx-no-undef': 'error',
48
+ 'react/jsx-pascal-case': ['error', {
49
+ allowAllCaps: true,
50
+ ignore: [],
51
+ }],
52
+ 'react/sort-prop-types': ['off', {
53
+ ignoreCase: true,
54
+ callbacksLast: false,
55
+ requiredFirst: false,
56
+ sortShapeProp: true,
57
+ }],
58
+ 'react/jsx-sort-prop-types': 'off',
59
+ 'react/jsx-sort-props': [
60
+ 'error',
61
+ {
62
+ noSortAlphabetically: true,
63
+ multiline: 'last',
64
+ },
20
65
  ],
21
- rules: {
22
- '@croct/jsx-attribute-spacing': 'error',
23
- 'react/destructuring-assignment': 'off',
24
- 'react/jsx-wrap-multilines': 'error',
25
- 'react/display-name': 'off',
26
- 'react/jsx-sort-props': [
27
- 'error',
28
- {
29
- noSortAlphabetically: true,
30
- multiline: 'last',
31
- },
32
- ],
33
- 'react/jsx-newline': [
34
- 'error',
35
- {
36
- prevent: true,
37
- },
38
- ],
39
- 'react/jsx-no-bind': [
40
- 'error',
41
- {
42
- allowArrowFunctions: true,
43
- allowBind: false,
44
- allowFunctions: true,
45
- },
46
- ],
47
- 'react/no-unstable-nested-components': [
48
- 'error',
49
- {
50
- allowAsProps: true,
66
+ 'react/jsx-sort-default-props': ['off', {
67
+ ignoreCase: true,
68
+ }],
69
+ 'react/jsx-uses-react': 'off',
70
+ 'react/jsx-uses-vars': 'error',
71
+ 'react/no-danger': 'warn',
72
+ 'react/no-deprecated': ['error'],
73
+ 'react/no-did-mount-set-state': 'off',
74
+ 'react/no-did-update-set-state': 'error',
75
+ 'react/no-will-update-set-state': 'error',
76
+ 'react/no-direct-mutation-state': 'off',
77
+ 'react/no-is-mounted': 'error',
78
+ 'react/no-multi-comp': 'off',
79
+ 'react/no-set-state': 'off',
80
+ 'react/no-string-refs': 'error',
81
+ 'react/no-unknown-property': 'error',
82
+ 'react/prefer-es6-class': ['error', 'always'],
83
+ 'react/prefer-stateless-function': ['error', { ignorePureComponents: true }],
84
+ 'react/prop-types': 'off',
85
+ 'react/react-in-jsx-scope': 'off',
86
+ 'react/require-render-return': 'error',
87
+ 'react/self-closing-comp': 'error',
88
+ 'react/sort-comp': ['error', {
89
+ order: [
90
+ 'static-variables',
91
+ 'static-methods',
92
+ 'instance-variables',
93
+ 'lifecycle',
94
+ '/^handle.+$/',
95
+ '/^on.+$/',
96
+ 'getters',
97
+ 'setters',
98
+ '/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/',
99
+ 'instance-methods',
100
+ 'everything-else',
101
+ 'rendering',
102
+ ],
103
+ groups: {
104
+ lifecycle: [
105
+ 'displayName',
106
+ 'propTypes',
107
+ 'contextTypes',
108
+ 'childContextTypes',
109
+ 'mixins',
110
+ 'statics',
111
+ 'defaultProps',
112
+ 'constructor',
113
+ 'getDefaultProps',
114
+ 'getInitialState',
115
+ 'state',
116
+ 'getChildContext',
117
+ 'getDerivedStateFromProps',
118
+ 'componentWillMount',
119
+ 'UNSAFE_componentWillMount',
120
+ 'componentDidMount',
121
+ 'componentWillReceiveProps',
122
+ 'UNSAFE_componentWillReceiveProps',
123
+ 'shouldComponentUpdate',
124
+ 'componentWillUpdate',
125
+ 'UNSAFE_componentWillUpdate',
126
+ 'getSnapshotBeforeUpdate',
127
+ 'componentDidUpdate',
128
+ 'componentDidCatch',
129
+ 'componentWillUnmount',
130
+ ],
131
+ rendering: [
132
+ '/^render.+$/',
133
+ 'render',
134
+ ],
51
135
  },
52
- ],
53
- 'react/jsx-no-useless-fragment': [
54
- 'error',
136
+ }],
137
+ 'react/jsx-wrap-multilines': 'error',
138
+ 'react/jsx-first-prop-new-line': ['error', 'multiline-multiprop'],
139
+ 'react/jsx-equals-spacing': ['error', 'never'],
140
+ 'react/jsx-indent': ['error', 4],
141
+ 'react/jsx-no-target-blank': ['error', { enforceDynamicLinks: 'always' }],
142
+ 'react/jsx-filename-extension': [
143
+ 1,
144
+ {
145
+ extensions: ['.tsx'],
146
+ },
147
+ ],
148
+ 'react/jsx-no-comment-textnodes': 'error',
149
+ 'react/no-render-return-value': 'error',
150
+ 'react/require-optimization': ['off', { allowDecorators: [] }],
151
+ 'react/no-find-dom-node': 'error',
152
+ 'react/forbid-component-props': ['off', { forbid: [] }],
153
+ 'react/forbid-elements': ['off', { forbid: [] }],
154
+ 'react/no-danger-with-children': 'error',
155
+ 'react/no-unused-prop-types': ['error', {
156
+ customValidators: [],
157
+ skipShapeProps: true,
158
+ }],
159
+ 'react/style-prop-object': 'error',
160
+ 'react/no-unescaped-entities': 'error',
161
+ 'react/no-children-prop': 'error',
162
+ 'react/jsx-tag-spacing': ['error', {
163
+ closingSlash: 'never',
164
+ beforeSelfClosing: 'always',
165
+ afterOpening: 'never',
166
+ beforeClosing: 'never',
167
+ }],
168
+ 'react/jsx-space-before-closing': ['off', 'always'],
169
+ 'react/no-array-index-key': 'error',
170
+ 'react/require-default-props': 'off',
171
+ 'react/forbid-foreign-prop-types': ['warn', { allowInPropTypes: true }],
172
+ 'react/void-dom-elements-no-children': 'error',
173
+ 'react/default-props-match-prop-types': ['error', { allowRequiredDefaults: false }],
174
+ 'react/no-redundant-should-component-update': 'error',
175
+ 'react/no-unused-state': 'error',
176
+ 'react/boolean-prop-naming': ['off', {
177
+ propTypeNames: ['bool', 'mutuallyExclusiveTrueProps'],
178
+ rule: '^(is|has)[A-Z]([A-Za-z0-9]?)+',
179
+ message: '',
180
+ }],
181
+ 'react/no-typos': 'error',
182
+ 'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }],
183
+ 'react/jsx-one-expression-per-line': 'off',
184
+ 'react/destructuring-assignment': 'off',
185
+ 'react/no-access-state-in-setstate': 'error',
186
+ 'react/button-has-type': ['error', {
187
+ button: true,
188
+ submit: true,
189
+ reset: false,
190
+ }],
191
+ 'react/jsx-child-element-spacing': 'off',
192
+ 'react/no-this-in-sfc': 'error',
193
+ 'react/jsx-max-depth': 'off',
194
+ 'react/jsx-props-no-multi-spaces': 'error',
195
+ 'react/no-unsafe': 'off',
196
+ 'react/jsx-fragments': ['error', 'element'],
197
+ 'react/jsx-curly-newline': ['error', {
198
+ multiline: 'consistent',
199
+ singleline: 'consistent',
200
+ }],
201
+ 'react/state-in-constructor': ['error', 'always'],
202
+ 'react/static-property-placement': ['error', 'property assignment'],
203
+ 'react/jsx-props-no-spreading': 'off',
204
+ 'react/prefer-read-only-props': 'off',
205
+ 'react/jsx-no-script-url': ['error', [
55
206
  {
56
- allowExpressions: true,
207
+ name: 'Link',
208
+ props: ['to'],
57
209
  },
58
- ],
59
- 'react/function-component-definition': 'off',
60
- 'testing-library/no-container': 'off',
61
- 'testing-library/no-node-access': 'off',
62
- 'testing-library/await-async-utils': 'off',
63
- 'jsx-a11y/aria-role': [
64
- 'error',
65
- {
66
- ignoreNonDOM: true,
210
+ ]],
211
+ 'react/jsx-no-useless-fragment': [
212
+ 'error',
213
+ {
214
+ allowExpressions: true,
215
+ },
216
+ ],
217
+ 'react/no-adjacent-inline-elements': 'off',
218
+ 'react/function-component-definition': 'off',
219
+ 'react/jsx-newline': [
220
+ 'error',
221
+ {
222
+ prevent: true,
223
+ },
224
+ ],
225
+ 'react/jsx-no-constructed-context-values': 'error',
226
+ 'react/no-unstable-nested-components': [
227
+ 'error',
228
+ {
229
+ allowAsProps: true,
230
+ },
231
+ ],
232
+ 'react/no-namespace': 'error',
233
+ 'react/prefer-exact-props': 'error',
234
+ 'react/no-arrow-function-lifecycle': 'error',
235
+ 'react/no-invalid-html-attribute': 'error',
236
+ 'react/no-unused-class-component-methods': 'error',
237
+ // React Hooks rules
238
+ 'react-hooks/rules-of-hooks': 'error',
239
+ 'react-hooks/exhaustive-deps': 'warn',
240
+ // Testing Library rules (overrides)
241
+ 'testing-library/no-container': 'off',
242
+ 'testing-library/no-node-access': 'off',
243
+ 'testing-library/await-async-utils': 'off',
244
+ // JSX A11y rules (overrides)
245
+ 'jsx-a11y/aria-role': [
246
+ 'error',
247
+ {
248
+ ignoreNonDOM: true,
249
+ },
250
+ ],
251
+ // Underscore dangle override for Redux DevTools
252
+ 'no-underscore-dangle': ['error', {
253
+ allow: ['__REDUX_DEVTOOLS_EXTENSION_COMPOSE__'],
254
+ allowAfterThis: false,
255
+ allowAfterSuper: false,
256
+ enforceInMethodNames: true,
257
+ }],
258
+ // Class methods use this override for React lifecycle methods
259
+ 'class-methods-use-this': ['error', {
260
+ exceptMethods: [
261
+ 'render',
262
+ 'getInitialState',
263
+ 'getDefaultProps',
264
+ 'getChildContext',
265
+ 'componentWillMount',
266
+ 'UNSAFE_componentWillMount',
267
+ 'componentDidMount',
268
+ 'componentWillReceiveProps',
269
+ 'UNSAFE_componentWillReceiveProps',
270
+ 'shouldComponentUpdate',
271
+ 'componentWillUpdate',
272
+ 'UNSAFE_componentWillUpdate',
273
+ 'componentDidUpdate',
274
+ 'componentWillUnmount',
275
+ 'componentDidCatch',
276
+ 'getSnapshotBeforeUpdate',
277
+ ],
278
+ }],
279
+ // Import restrictions
280
+ 'no-restricted-imports': [
281
+ 'error',
282
+ {
283
+ name: 'react',
284
+ importNames: ['default'],
285
+ message: 'The React runtime is automatically imported, '
286
+ + 'you can simply omit the import declaration in this case.',
287
+ },
288
+ ],
289
+ // Import order for React (using import-x)
290
+ 'import-x/order': [
291
+ 'error',
292
+ {
293
+ groups: [
294
+ 'builtin',
295
+ 'external',
296
+ 'internal',
297
+ ],
298
+ pathGroups: [
299
+ {
300
+ pattern: 'react',
301
+ group: 'external',
302
+ position: 'before',
303
+ },
304
+ ],
305
+ pathGroupsExcludedImportTypes: ['react'],
306
+ 'newlines-between': 'never',
307
+ alphabetize: {
308
+ order: 'asc',
309
+ caseInsensitive: true,
67
310
  },
68
- ],
69
- 'react/jsx-uses-react': 'off',
70
- 'react/react-in-jsx-scope': 'off',
71
- 'react/jsx-one-expression-per-line': 'off',
72
- 'react/prop-types': 'off',
73
- 'react/require-default-props': 'off',
74
- 'react/jsx-fragments': [
75
- 'error',
76
- 'element',
77
- ],
78
- 'react-hooks/rules-of-hooks': 'error',
79
- 'react-hooks/exhaustive-deps': 'warn',
80
- 'react/jsx-filename-extension': [
81
- 1,
82
- {
83
- extensions: [
84
- '.tsx',
85
- ],
311
+ },
312
+ ],
313
+ };
314
+ // Factory function to create React config with the plugin reference
315
+ function createReactConfig(plugin, javascriptConfig) {
316
+ return [
317
+ ...javascriptConfig,
318
+ eslint_plugin_react_1.default.configs.flat.recommended,
319
+ eslint_plugin_testing_library_1.default.configs['flat/react'],
320
+ eslint_plugin_jest_dom_1.default.configs['flat/recommended'],
321
+ eslint_plugin_jsx_a11y_1.default.flatConfigs.recommended,
322
+ {
323
+ name: '@croct/react',
324
+ plugins: {
325
+ 'react-hooks': eslint_plugin_react_hooks_1.default,
326
+ '@stylistic': eslint_plugin_1.default,
327
+ '@croct': plugin,
86
328
  },
87
- ],
88
- 'react/jsx-indent': [
89
- 'error',
90
- 4,
91
- ],
92
- 'react/jsx-indent-props': 'off',
93
- 'react/jsx-props-no-spreading': 'off',
94
- 'no-restricted-imports': [
95
- 'error',
96
- {
97
- name: 'react',
98
- importNames: [
99
- 'default',
100
- ],
101
- message: 'The React runtime is automatically imported, '
102
- + 'you can simply omit the import declaration in this case.',
329
+ languageOptions: {
330
+ parserOptions: {
331
+ ecmaFeatures: {
332
+ jsx: true,
333
+ },
334
+ },
103
335
  },
104
- ],
105
- 'import/order': [
106
- 'error',
107
- {
108
- groups: [
109
- 'builtin',
110
- 'external',
111
- 'internal',
112
- ],
113
- pathGroups: [
114
- {
115
- pattern: 'react',
116
- group: 'external',
117
- position: 'before',
336
+ settings: {
337
+ 'import-x/resolver': {
338
+ node: {
339
+ extensions: ['.js', '.jsx', '.json'],
118
340
  },
119
- ],
120
- pathGroupsExcludedImportTypes: [
121
- 'react',
122
- ],
123
- 'newlines-between': 'never',
124
- alphabetize: {
125
- order: 'asc',
126
- caseInsensitive: true,
127
341
  },
342
+ react: {
343
+ pragma: 'React',
344
+ version: 'detect',
345
+ },
346
+ propWrapperFunctions: [
347
+ 'forbidExtraProps',
348
+ 'exact',
349
+ 'Object.freeze',
350
+ ],
128
351
  },
129
- ],
130
- },
131
- };
352
+ rules: baseRules,
353
+ },
354
+ ];
355
+ }
@@ -1,99 +1,112 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.typescript = void 0;
4
- exports.typescript = {
5
- extends: ['plugin:@croct/javascript'],
6
- plugins: [
7
- '@typescript-eslint',
8
- '@croct',
6
+ exports.createTypescriptConfig = createTypescriptConfig;
7
+ const typescript_eslint_1 = __importDefault(require("typescript-eslint"));
8
+ const parser_1 = __importDefault(require("@typescript-eslint/parser"));
9
+ const eslint_plugin_jest_1 = __importDefault(require("eslint-plugin-jest"));
10
+ // @ts-expect-error - no types available
11
+ const eslint_plugin_1 = __importDefault(require("@stylistic/eslint-plugin"));
12
+ const baseRules = {
13
+ 'import-x/export': 'off',
14
+ '@typescript-eslint/array-type': ['error', {
15
+ default: 'array-simple',
16
+ }],
17
+ '@typescript-eslint/prefer-as-const': 'error',
18
+ '@typescript-eslint/adjacent-overload-signatures': 'error',
19
+ '@stylistic/type-annotation-spacing': 'error',
20
+ '@stylistic/semi': ['error', 'always'],
21
+ '@typescript-eslint/strict-boolean-expressions': ['error', {
22
+ allowString: false,
23
+ allowNumber: false,
24
+ allowNullableObject: false,
25
+ }],
26
+ '@typescript-eslint/prefer-optional-chain': 'error',
27
+ 'no-shadow': 'off',
28
+ '@typescript-eslint/no-shadow': ['error', {
29
+ ignoreTypeValueShadow: true,
30
+ ignoreFunctionTypeParameterNameValueShadow: true,
31
+ }],
32
+ '@typescript-eslint/no-empty-interface': 'off',
33
+ '@typescript-eslint/explicit-member-accessibility': [
34
+ 'error',
9
35
  ],
10
- overrides: [
36
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
37
+ '@typescript-eslint/explicit-function-return-type': ['error'],
38
+ '@typescript-eslint/no-explicit-any': 'off',
39
+ 'no-use-before-define': 'off',
40
+ '@typescript-eslint/no-use-before-define': 'off',
41
+ 'no-unused-expressions': 'off',
42
+ '@typescript-eslint/no-unused-expressions': 'error',
43
+ '@stylistic/indent': ['error', 4, {
44
+ SwitchCase: 1,
45
+ }],
46
+ '@typescript-eslint/no-unused-vars': [
47
+ 'error',
11
48
  {
12
- files: ['**/*.ts', '**/*.tsx'],
13
- extends: ['plugin:@typescript-eslint/recommended'],
14
- parser: '@typescript-eslint/parser',
15
- rules: {
16
- 'import/export': 'off',
17
- '@typescript-eslint/array-type': ['error', {
18
- default: 'array-simple',
19
- }],
20
- '@typescript-eslint/prefer-as-const': 'error',
21
- '@typescript-eslint/adjacent-overload-signatures': 'error',
22
- '@typescript-eslint/type-annotation-spacing': 'error',
23
- '@typescript-eslint/semi': ['error', 'always'],
24
- '@typescript-eslint/strict-boolean-expressions': ['error', {
25
- allowString: false,
26
- allowNumber: false,
27
- allowNullableObject: false,
28
- }],
29
- '@typescript-eslint/prefer-optional-chain': 'error',
30
- 'no-shadow': 'off',
31
- '@typescript-eslint/no-shadow': ['error', {
32
- ignoreTypeValueShadow: true,
33
- ignoreFunctionTypeParameterNameValueShadow: true,
34
- }],
35
- '@typescript-eslint/no-empty-interface': 'off',
36
- '@typescript-eslint/explicit-member-accessibility': [
37
- 'error',
38
- ],
39
- '@typescript-eslint/explicit-module-boundary-types': 'off',
40
- '@typescript-eslint/explicit-function-return-type': ['error'],
41
- '@typescript-eslint/no-explicit-any': 'off',
42
- 'no-use-before-define': 'off',
43
- '@typescript-eslint/no-use-before-define': 'off',
44
- 'no-unused-expressions': 'off',
45
- '@typescript-eslint/no-unused-expressions': 'error',
46
- indent: ['error', 4, {
47
- SwitchCase: 1,
48
- }],
49
- '@typescript-eslint/no-unused-vars': [
50
- 'error',
51
- {
52
- args: 'after-used',
53
- ignoreRestSiblings: true,
49
+ args: 'after-used',
50
+ ignoreRestSiblings: true,
51
+ },
52
+ ],
53
+ 'no-unused-vars': 'off',
54
+ '@typescript-eslint/no-non-null-assertion': 'off',
55
+ '@stylistic/object-curly-spacing': 'error',
56
+ '@stylistic/member-delimiter-style': ['error', {
57
+ multiline: {
58
+ delimiter: 'comma',
59
+ requireLast: true,
60
+ },
61
+ singleline: {
62
+ delimiter: 'comma',
63
+ requireLast: false,
64
+ },
65
+ overrides: {
66
+ interface: {
67
+ singleline: {
68
+ delimiter: 'semi',
69
+ },
70
+ multiline: {
71
+ delimiter: 'semi',
54
72
  },
55
- ],
56
- 'no-unused-vars': 'off',
57
- '@typescript-eslint/no-non-null-assertion': 'off',
58
- 'object-curly-spacing': 'off',
59
- '@typescript-eslint/object-curly-spacing': 'error',
60
- '@typescript-eslint/member-delimiter-style': ['error', {
61
- multiline: {
62
- delimiter: 'comma',
63
- requireLast: true,
64
- },
65
- singleline: {
66
- delimiter: 'comma',
67
- requireLast: false,
68
- },
69
- overrides: {
70
- interface: {
71
- singleline: {
72
- delimiter: 'semi',
73
- },
74
- multiline: {
75
- delimiter: 'semi',
76
- },
77
- },
78
- },
79
- }],
80
- 'no-undef': 'off',
81
- '@typescript-eslint/no-namespace': 'off',
73
+ },
82
74
  },
75
+ }],
76
+ 'no-undef': 'off',
77
+ '@typescript-eslint/no-namespace': 'off',
78
+ };
79
+ // Factory function to create TypeScript config with the plugin reference
80
+ function createTypescriptConfig(plugin, javascriptConfig) {
81
+ return [
82
+ ...javascriptConfig,
83
+ ...typescript_eslint_1.default.configs.recommendedTypeChecked,
84
+ eslint_plugin_jest_1.default.configs['flat/recommended'],
85
+ {
86
+ name: '@croct/typescript',
87
+ files: ['**/*.ts', '**/*.tsx'],
88
+ plugins: {
89
+ '@stylistic': eslint_plugin_1.default,
90
+ '@croct': plugin,
91
+ },
92
+ languageOptions: {
93
+ parser: parser_1.default,
94
+ parserOptions: {
95
+ // Enable type-aware linting
96
+ projectService: true,
97
+ },
98
+ },
99
+ rules: baseRules,
83
100
  },
84
101
  {
102
+ name: '@croct/typescript/tests',
85
103
  files: [
86
104
  'src/**/*.test.ts',
87
105
  'test/**/*.ts',
88
106
  ],
89
- extends: ['plugin:jest/recommended'],
90
- plugins: ['jest'],
91
107
  rules: {
92
108
  'no-new-object': 'off',
93
109
  },
94
- env: {
95
- jest: true,
96
- },
97
110
  },
98
- ],
99
- };
111
+ ];
112
+ }