@innovixx/eslint-config 4.0.0-alpha.7 → 4.0.0

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
@@ -6,6 +6,7 @@ An opinionated, extensible ESLint flat configuration library with configurations
6
6
 
7
7
  - ESLint flat configuration.
8
8
  - Internally scoped JavaScript, TypeScript, React, and Jest configurations.
9
+ - Type declarations for the root and public configuration modules.
9
10
  - TypeScript linting and type-aware rules.
10
11
  - Modern React 19 configuration using the automatic JSX runtime.
11
12
  - React correctness checks from `@eslint-react/eslint-plugin`.
@@ -20,7 +21,7 @@ The React configuration no longer depends on `eslint-plugin-react`.
20
21
 
21
22
  ## Compatibility
22
23
 
23
- The current package declares ESLint `^10.14.0` and TypeScript `6.0.3`.
24
+ The current package declares ESLint `^10.14.0`, TypeScript `6.0.3`, and GraphQL `^16` as peer dependencies.
24
25
 
25
26
  Known compatibility considerations:
26
27
 
@@ -49,7 +50,15 @@ pnpm add -D @innovixx/eslint-config@alpha eslint@^10.14.0 typescript@6.0.3
49
50
 
50
51
  This assumes prereleases are published under the `alpha` distribution tag. Alternatively, specify an exact published prerelease version.
51
52
 
52
- Ensure compatible peer dependencies are installed. The package currently declares GraphQL ^16 as a required peer dependency, even for consumers that do not load the GraphQL configuration. Depending on package-manager settings, missing peers may be installed automatically or reported as unmet dependencies.
53
+ Ensure compatible peer dependencies are installed. The package currently declares GraphQL `^16` as a required peer dependency, even for consumers that do not load the GraphQL configuration. Depending on package-manager settings, missing peers may be installed automatically or reported as unmet dependencies.
54
+
55
+ For a project without GraphQL installed:
56
+
57
+ ```sh
58
+ pnpm add -D graphql@^16
59
+ ```
60
+
61
+ If an app uses GraphQL at runtime, keep it in the app's runtime dependencies instead. Do not install a conflicting GraphQL version merely to satisfy the lint configuration.
53
62
 
54
63
  The configuration supplies its ESLint plugins and parsers, so apps do not need to register them individually.
55
64
 
@@ -70,6 +79,8 @@ The shared base configuration already scopes itself to JavaScript and TypeScript
70
79
  To narrow its scope:
71
80
 
72
81
  ```js
82
+ import baseConfig from '@innovixx/eslint-config/config/configs/base/index.mjs';
83
+
73
84
  export default [
74
85
  {
75
86
  ...baseConfig,
@@ -96,6 +107,16 @@ React rules are scoped to JSX and TSX files. Extend that scope if the app needs
96
107
 
97
108
  Jest's default scope covers `.test` files. Override it if the app uses `.spec` files or other test naming conventions.
98
109
 
110
+ ### Type declarations
111
+
112
+ The root configuration and public configuration modules include adjacent `index.d.mts` declaration files.
113
+
114
+ Keep importing the `.mjs` modules as shown above. TypeScript resolves their declarations automatically with compatible module resolution, such as `node16`, `nodenext`, or `bundler`.
115
+
116
+ Individual configurations are typed as `Linter.Config`; the root and GraphQL configuration arrays are typed as `Linter.Config[]`.
117
+
118
+ No separate `@types/innovixx__eslint-config` package or consumer-side ambient module declarations are needed. These declarations describe configuration exports; they do not change runtime linting behavior or how ESLint loads TypeScript configuration files.
119
+
99
120
  ### Combined configuration
100
121
 
101
122
  ```js
@@ -122,7 +143,7 @@ export default [
122
143
  ];
123
144
  ```
124
145
 
125
- Load only the configurations the app needs. The `project: null` override disables project-based parser analysis for those configuration files; omit it if they are included in the app's TypeScript project.
146
+ Load only the configurations the app needs. The `project: null` override disables project-based parser analysis for those configuration files; omit it if they are included in the app's TypeScript project. Rules requiring type information need corresponding overrides if enabled for those files.
126
147
 
127
148
  The [root configuration module](./config/index.mjs) exports a separate configuration array with additional overrides. It does not automatically include the modular GraphQL configuration and is not identical to the [repository ESLint configuration](./eslint.config.mjs).
128
149
 
@@ -136,9 +157,9 @@ The shared GraphQL configuration registers the parser and plugin, then selects s
136
157
 
137
158
  | Path | Behavior |
138
159
  | --- | --- |
139
- | `src/endpoints/**/*.graphql` | Schema recommended rules |
140
- | `src/graphql/typeDefs/**/*.graphql` | Schema recommended rules |
141
- | Other `src/graphql/**/*.graphql` files | Operations recommended rules |
160
+ | `src/endpoints/**/*.graphql` | Schema recommended rules with shared overrides |
161
+ | `src/graphql/typeDefs/**` | Globally ignored generated typeDefs |
162
+ | Other `src/graphql/**/*.graphql` files | Operations recommended rules with shared overrides |
142
163
  | `**/schema.graphql` | Globally ignored by ESLint |
143
164
  | `**/generated/**` | Globally ignored by ESLint |
144
165
 
@@ -162,7 +183,14 @@ src/
162
183
  schema.graphql
163
184
  ```
164
185
 
165
- The operations configuration explicitly excludes `src/graphql/typeDefs/**`. Without this exclusion, schema files would also receive operations rules and could fail while loading rules that require operation documents.
186
+ In this layout:
187
+
188
+ - Endpoint GraphQL files contain source schema definitions.
189
+ - Files under `src/graphql/typeDefs` are generated and are not linted.
190
+ - Query files contain operations validated against the configured schema.
191
+ - Generated schemas are reference inputs, not lint targets.
192
+
193
+ Generated typeDefs are globally excluded from linting, not just from operations rules. They can still be loaded as schema inputs through GraphQL Config.
166
194
 
167
195
  The generated-directory ignore applies to all file types, including generated TypeScript, not only GraphQL.
168
196
 
@@ -170,39 +198,55 @@ These are root-relative conventions. Projects using different layouts must adapt
170
198
 
171
199
  ### Included rules
172
200
 
173
- Schema files use:
201
+ Schema files start with:
174
202
 
175
203
  ```text
176
204
  flat/schema-recommended
177
205
  ```
178
206
 
179
- Operations use:
207
+ Operations start with:
180
208
 
181
209
  ```text
182
210
  flat/operations-recommended
183
211
  ```
184
212
 
185
- Shared overrides include:
213
+ Both receive shared overrides.
186
214
 
187
- - `eol-last`: warning for schema and operations files.
188
- - `no-anonymous-operations`: warning for operations.
189
- - `known-type-names`: error for operations.
190
- - `no-duplicate-fields`: warning for operations.
191
- - Operation names: PascalCase.
192
- - Forbidden operation prefixes: `Query`, `Mutation`, `Subscription`, `Get`.
193
- - Forbidden operation suffixes: `Query`, `Mutation`, `Subscription`.
215
+ #### Schema overrides
194
216
 
195
- The explicit operations naming configuration replaces the recommended preset's naming options; it does not retain every naming check from that preset.
217
+ - `strict-id-in-types`: disabled.
218
+ - `require-description`: disabled.
219
+ - `no-unreachable-types`: warning.
220
+ - `naming-convention`: warning, requiring PascalCase object type names only.
221
+ - `eol-last`: warning.
222
+
223
+ The explicit schema naming options replace the preset's broader naming policies. Uppercase enum values and camelCase input fields are therefore not enforced by this configuration.
224
+
225
+ Other recommended schema checks remain enabled.
226
+
227
+ Unreachable-type warnings may identify unused definitions or an incomplete schema reference. Check the loaded schema before dismissing them.
228
+
229
+ #### Operations overrides
196
230
 
197
- Recommended schema rules introduce additional policies, including descriptions, naming conventions, and ID checks. For example, lowercase enum values can violate the recommended uppercase enum convention.
231
+ - `no-anonymous-operations`: warning.
232
+ - `known-type-names`: error.
233
+ - `no-duplicate-fields`: warning.
234
+ - `naming-convention`: warning.
235
+ - `eol-last`: warning.
198
236
 
199
- Review these policies before enabling them across existing schemas. Override deliberate API conventions rather than changing public API names solely to satisfy lint.
237
+ Operation naming requires:
238
+
239
+ - PascalCase operation names.
240
+ - No prefixes of `Query`, `Mutation`, `Subscription`, or `Get`.
241
+ - No suffixes of `Query`, `Mutation`, or `Subscription`.
242
+
243
+ The explicit operations naming configuration replaces the recommended preset's naming options; it does not retain every naming check from that preset.
200
244
 
201
245
  ### Schema discovery
202
246
 
203
247
  Each app owns its GraphQL Config. The shared ESLint configuration does not hard-code schema locations.
204
248
 
205
- Generated schemas may be ignored by ESLint while still being loaded as schema references.
249
+ Generated schemas and typeDefs may be ignored by ESLint while still being loaded as schema references.
206
250
 
207
251
  #### Schema-only server
208
252
 
@@ -233,6 +277,7 @@ const config: IGraphQLConfig = {
233
277
  'src/graphql/**/*.graphql',
234
278
  '!src/graphql/generated/**',
235
279
  '!src/graphql/typeDefs/**',
280
+ '!src/graphql/**/schema.graphql',
236
281
  ],
237
282
  };
238
283
 
@@ -243,7 +288,13 @@ Operations rules can require both the schema and loaded operation documents.
243
288
 
244
289
  ESLint ignores do not automatically apply to GraphQL Config's document discovery. Exclude generated files and schema definitions from `documents` explicitly.
245
290
 
246
- If an app directly imports plugin types, declare the plugin as an app development dependency rather than relying on access to a transitive dependency. Alternatively, use an untyped GraphQL Config file.
291
+ If an app directly imports plugin types, declare the plugin as an app development dependency rather than relying on access to a transitive dependency:
292
+
293
+ ```sh
294
+ pnpm add -D @graphql-eslint/eslint-plugin@^4.4.2
295
+ ```
296
+
297
+ Alternatively, use an untyped GraphQL Config file. The shared ESLint configuration's declarations do not re-export the plugin's `IGraphQLConfig` type.
247
298
 
248
299
  #### Server calling another API
249
300
 
@@ -286,6 +337,8 @@ Adjust these paths to the app's layout. Keep project file groups non-overlapping
286
337
 
287
338
  Each API's operations must be validated against that API's schema, not automatically against the server's own schema.
288
339
 
340
+ Including generated typeDefs in GraphQL Config's project selection does not override ESLint's global ignore.
341
+
289
342
  ### Code generation and linting
290
343
 
291
344
  Generate the schema reference before running schema-dependent lint rules. Keep generated schemas current with their APIs.
@@ -591,6 +644,7 @@ Before publishing changes to custom rules, verify both accepted and rejected exa
591
644
  - Case-insensitive duplicate attributes.
592
645
  - Escaped versus literal JSX text.
593
646
  - Explicit versus shorthand fragments.
647
+ - Fragment fixes with and without `React` in scope.
594
648
  - Literal string refs versus object/callback refs.
595
649
  - Component props access versus unrelated functions.
596
650
  - Lexical `this` versus nested function/class contexts.
@@ -598,6 +652,27 @@ Before publishing changes to custom rules, verify both accepted and rejected exa
598
652
 
599
653
  Configuration resolution alone does not establish behavioral correctness.
600
654
 
655
+ ### Declaration packaging
656
+
657
+ Before publishing:
658
+
659
+ ```sh
660
+ npm pack --dry-run
661
+ ```
662
+
663
+ Confirm that the package includes:
664
+
665
+ ```text
666
+ config/index.d.mts
667
+ config/configs/base/index.d.mts
668
+ config/configs/react/index.d.mts
669
+ config/configs/typescript/index.d.mts
670
+ config/configs/jest/index.d.mts
671
+ config/configs/graphql/index.d.mts
672
+ ```
673
+
674
+ Verify the published package in a consuming project to confirm that both root and deep configuration imports resolve without missing-declaration diagnostics.
675
+
601
676
  ### GraphQL validation
602
677
 
603
678
  The repository applies the shared GraphQL configuration relative to `demo`, allowing its normal `src/...` patterns to match `demo/src/...`.
@@ -626,12 +701,14 @@ query Test {
626
701
 
627
702
  With the demo schema loaded, this should produce an `@graphql-eslint/fields-on-correct-type` error. Restore the valid selection afterward.
628
703
 
629
- For schema fixtures, verify that:
704
+ For endpoint schema fixtures, verify that:
630
705
 
631
- - Schema recommended rules are enabled.
706
+ - Schema recommended rules are enabled with the documented overrides.
707
+ - `strict-id-in-types` and `require-description` are disabled.
708
+ - `no-unreachable-types` reports warnings.
632
709
  - Operations-only rules such as `require-selections` and `executable-definitions` are absent or disabled.
633
710
  - Shared types and directives resolve against the complete schema.
634
- - Generated schemas are excluded from lint targets but remain available as schema references.
711
+ - Generated schemas and generated typeDefs are excluded from lint targets but remain available as schema inputs.
635
712
 
636
713
  `--print-config` calculates configuration for a supplied path; it does not prove that the file exists, that its schema loads, or that validation succeeds.
637
714
 
@@ -648,10 +725,12 @@ This migration changes enforcement and dependency requirements:
648
725
  - Some replacement rules intentionally have narrower or different coverage.
649
726
  - GraphQL schema and operations configurations are available through one array export.
650
727
  - Recommended GraphQL presets enable more rules than the previous consumer-defined rule list.
728
+ - Schema overrides disable strict ID and description requirements, relax naming checks, and report unreachable definitions as warnings.
651
729
  - Directory conventions determine whether GraphQL files receive schema or operations rules.
652
- - Generated directories and files named `schema.graphql` are globally ignored when the GraphQL configuration is loaded.
730
+ - Generated directories, files named `schema.graphql`, and `src/graphql/typeDefs/**` are globally ignored when the GraphQL configuration is loaded.
653
731
  - Apps remain responsible for GraphQL schema/document discovery and generating required schema references.
654
732
  - Shared JavaScript, React, TypeScript, and Jest modules now contain their own file scopes.
733
+ - The root and public configuration modules include `.d.mts` type declarations. Consumer imports remain unchanged.
655
734
 
656
735
  Consumers should review these as potentially breaking changes rather than a dependency-only upgrade.
657
736
 
@@ -6,6 +6,7 @@ export const graphqlConfig = [
6
6
  ignores: [
7
7
  '**/schema.graphql',
8
8
  '**/generated/**',
9
+ 'src/graphql/typeDefs/**',
9
10
  ],
10
11
  },
11
12
  {
@@ -27,10 +28,7 @@ export const graphqlConfig = [
27
28
  },
28
29
  },
29
30
  {
30
- files: [
31
- 'src/endpoints/**/*.graphql',
32
- 'src/graphql/typeDefs/**/*.graphql',
33
- ],
31
+ files: ['src/endpoints/**/*.graphql'],
34
32
 
35
33
  rules: {
36
34
  ...graphqlPlugin.configs['flat/schema-recommended'].rules,
@@ -49,7 +47,6 @@ export const graphqlConfig = [
49
47
  },
50
48
  {
51
49
  files: ['src/graphql/**/*.graphql'],
52
- ignores: ['src/graphql/typeDefs/**'],
53
50
 
54
51
  rules: {
55
52
  ...graphqlPlugin.configs['flat/operations-recommended'].rules,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@innovixx/eslint-config",
3
- "version": "4.0.0-alpha.7",
3
+ "version": "4.0.0",
4
4
  "main": "config/index.mjs",
5
5
  "repository": "git@github.com:innovixx/eslint-config.git",
6
6
  "description": "Opinionated ESLint config for JavaScript developers",