lint-suite 1.0.6 → 1.0.7

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
@@ -1,121 +1,135 @@
1
- # Lint Suite
2
-
3
- A comprehensive collection of ESLint Flat configurations for modern web applications.
4
-
5
- ## Features
6
-
7
- - **TypeScript Linting**: Strict typing rules, consistent imports, and code organization
8
- - **Angular Support**: Component best practices and template accessibility rules
9
- - **RxJS Guidelines**: Observable patterns, Finnish notation, and operator safety
10
- - **Code Style**: Formatting rules, line limits, and structural consistency
11
- - **Accessibility**: ARIA validation, keyboard events, and semantic HTML
12
- - **Testing**: Jest configurations with appropriate relaxations for test files
13
- - **Additional Support**: JSON, Storybook, and more
14
-
15
- ## Installation
16
-
17
- ```bash
18
- npm install --save-dev lint-suite
19
- ```
20
-
21
- ## Usage
22
-
23
- Create a `.eslintrc.config.mjs` file in your project root:
24
-
25
- ```js
26
- import { base, javascript, typescript } from 'lint-suite';
27
-
28
- export default [
29
- ...base,
30
- ...javascript,
31
- ...typescript,
32
- // Rest of the required configurations
33
- ];
34
- ```
35
-
36
- You can selectively include configurations you need.
37
-
38
- ## Available Configurations
39
-
40
- - `base`: Core JavaScript rules and formatting
41
- - `typescript`: TypeScript-specific rules
42
- - `angular`: Angular component best practices
43
- - `angularTemplate`: HTML template rules with accessibility focus
44
- - `rxjs`: Observable patterns and operator safety
45
- - `jest`: Testing configurations
46
- - `json`: JSON file linting
47
- - `storybook`: Storybook support
48
-
49
- ## Customization
50
-
51
- You can override any rules by adding a `rules` section to your ESLint config:
52
-
53
- ```js
54
- import { typescript } from 'lint-suite';
55
-
56
- export default [
57
- ...typescript,
58
- {
59
- rules: {
60
- '@typescript-eslint/explicit-function-return-type': 'off',
61
- },
62
- },
63
- ];
64
- ```
65
-
66
- ## Available Rules (you can add more as you prefer)
67
-
68
- ### nx/eslint-plugin
69
-
70
- - `@nx/enforce-module-boundaries`: Enforces module boundary restrictions
71
- - `@nx/dependency-checks`: Validates dependencies in workspace projects
72
- - ...
73
-
74
- ### eslint-plugin-jest
75
-
76
- - `jest/no-disabled-tests`: Disallows disabled tests
77
- - `jest/expect-expect`: Ensures test cases contain at least one expect statement
78
- - `jest/valid-expect`: Validates expect() usage
79
- - ...
80
-
81
- ### eslint-plugin-json
82
-
83
- - `json/json`: Validates JSON syntax
84
- - `json/sort-package-json`: Enforces consistent ordering in package.json
85
- - ...
86
-
87
- ### @smarttools/eslint-plugin-rxjs
88
-
89
- - `@rxjs/finnish`: Enforces Finnish notation for observables
90
- - `@rxjs/no-ignored-subscription`: Prevents ignoring returned subscriptions
91
- - `@rxjs/no-unsafe-takeuntil`: Ensures proper usage of takeUntil operator
92
- - ...
93
-
94
- ### eslint-plugin-storybook
95
-
96
- - `storybook/no-redundant-story-name`: Prevents redundant story names
97
- - `storybook/csf-component`: Enforces Component Story Format standards
98
- - `storybook/hierarchy-separator`: Enforces story hierarchy separators
99
- - ...
100
-
101
- ### eslint-plugin-import
102
-
103
- - `import/no-unresolved`: Ensures imports point to valid modules
104
- - `import/order`: Enforces a consistent order of import statements
105
- - `import/no-duplicates`: Prevents duplicate imports
106
- - ...
107
-
108
- ### @stylistic/eslint-plugin
109
-
110
- - `@stylistic/max-len`: Enforces maximum line length
111
- - `@stylistic/indent`: Enforces consistent indentation
112
- - `@stylistic/quotes`: Enforces consistent quote style
113
- - ...
114
-
115
- ## Contributing
116
-
117
- See [CONTRIBUTING.md](./CONTRIBUTING.md) for contribution guidelines.
118
-
119
- ## License
120
-
121
- MIT
1
+ # Lint Suite
2
+
3
+ A comprehensive collection of ESLint Flat configurations for modern web applications.
4
+
5
+ ## Features
6
+
7
+ - **TypeScript Linting**: Strict typing rules, consistent imports, and code organization
8
+ - **Angular Support**: Component best practices and template accessibility rules
9
+ - **RxJS Guidelines**: Observable patterns, Finnish notation, and operator safety
10
+ - **Code Style**: Formatting rules, line limits, and structural consistency
11
+ - **Accessibility**: ARIA validation, keyboard events, and semantic HTML
12
+ - **Testing**: Jest configurations with appropriate relaxations for test files
13
+ - **Additional Support**: JSON, Storybook, and more
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install --save-dev lint-suite
19
+ ```
20
+
21
+ ## Dependencies
22
+
23
+ ```bash
24
+ npm install --save-dev eslint typescript-eslint eslint-config-prettier
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ Create a `.eslintrc.config.mjs` file in your project root:
30
+
31
+ ```js
32
+ import { base, javascript, typescript } from 'lint-suite';
33
+
34
+ export default [
35
+ ...base,
36
+ ...javascript,
37
+ ...typescript
38
+ // Rest of the required configurations
39
+ ];
40
+ ```
41
+
42
+ You can selectively include configurations you need.
43
+
44
+ ## Available Configurations
45
+
46
+ - `base`: Core JavaScript rules and formatting
47
+ - `typescript`: TypeScript-specific rules
48
+ - `angular`: Angular component best practices
49
+ - `angularTemplate`: HTML template rules with accessibility focus
50
+ - `rxjs`: Observable patterns and operator safety
51
+ - `jest`: Testing configurations
52
+ - `json`: JSON file linting
53
+ - `storybook`: Storybook support
54
+
55
+ ## Customization
56
+
57
+ You can override any rules by adding a `rules` section to your ESLint config:
58
+
59
+ ```js
60
+ import { typescript } from 'lint-suite';
61
+
62
+ export default [
63
+ ...typescript,
64
+ {
65
+ rules: {
66
+ '@typescript-eslint/explicit-function-return-type': 'off'
67
+ }
68
+ }
69
+ ];
70
+ ```
71
+
72
+ ## Available Rules (you can add more as you prefer)
73
+
74
+ ### nx/eslint-plugin
75
+
76
+ - `@nx/enforce-module-boundaries`: Enforces module boundary restrictions
77
+ - `@nx/dependency-checks`: Validates dependencies in workspace projects
78
+ - ...
79
+
80
+ ### eslint-plugin-jest
81
+
82
+ - `jest/no-disabled-tests`: Disallows disabled tests
83
+ - `jest/expect-expect`: Ensures test cases contain at least one expect statement
84
+ - `jest/valid-expect`: Validates expect() usage
85
+ - ...
86
+
87
+ ### eslint-plugin-json
88
+
89
+ - `json/json`: Validates JSON syntax
90
+ - `json/sort-package-json`: Enforces consistent ordering in package.json
91
+ - ...
92
+
93
+ ### @smarttools/eslint-plugin-rxjs
94
+
95
+ - `@rxjs/finnish`: Enforces Finnish notation for observables
96
+ - `@rxjs/no-ignored-subscription`: Prevents ignoring returned subscriptions
97
+ - `@rxjs/no-unsafe-takeuntil`: Ensures proper usage of takeUntil operator
98
+ - ...
99
+
100
+ ### eslint-plugin-storybook
101
+
102
+ - `storybook/no-redundant-story-name`: Prevents redundant story names
103
+ - `storybook/csf-component`: Enforces Component Story Format standards
104
+ - `storybook/hierarchy-separator`: Enforces story hierarchy separators
105
+ - ...
106
+
107
+ ### eslint-plugin-import
108
+
109
+ - `import/no-unresolved`: Ensures imports point to valid modules
110
+ - `import/order`: Enforces a consistent order of import statements
111
+ - `import/no-duplicates`: Prevents duplicate imports
112
+ - ...
113
+
114
+ ### @stylistic/eslint-plugin
115
+
116
+ - `@stylistic/max-len`: Enforces maximum line length
117
+ - `@stylistic/indent`: Enforces consistent indentation
118
+ - `@stylistic/quotes`: Enforces consistent quote style
119
+ - ...
120
+
121
+ ## Contributing
122
+
123
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for contribution guidelines.
124
+
125
+ ## License
126
+
127
+ MIT
128
+
129
+ ```
130
+
131
+ ```
132
+
133
+ ```
134
+
135
+ ```
package/index.cjs CHANGED
@@ -44,12 +44,14 @@ __export(src_exports, {
44
44
  module.exports = __toCommonJS(src_exports);
45
45
 
46
46
  // packages/lint-suite/src/lib/angular-template.ts
47
- var import_eslint_plugin = __toESM(require("@nx/eslint-plugin"), 1);
48
- var angularTemplate = [
49
- ...import_eslint_plugin.default.configs["flat/angular-template"],
47
+ var import_angular_eslint = require("angular-eslint");
48
+ var import_typescript_eslint = require("typescript-eslint");
49
+ var angularTemplate = (0, import_typescript_eslint.config)([
50
50
  {
51
51
  files: ["**/*.html"],
52
+ extends: [...import_angular_eslint.configs.templateAccessibility, ...import_angular_eslint.configs.templateRecommended],
52
53
  rules: {
54
+ "@angular-eslint/template/prefer-template-literal": "error",
53
55
  "@angular-eslint/template/no-any": "error",
54
56
  "@angular-eslint/template/no-duplicate-attributes": "error",
55
57
  "@angular-eslint/template/button-has-type": "error",
@@ -87,26 +89,40 @@ var angularTemplate = [
87
89
  ]
88
90
  }
89
91
  }
90
- ];
92
+ ]);
91
93
 
92
94
  // packages/lint-suite/src/lib/angular.ts
93
- var import_eslint_plugin2 = __toESM(require("@nx/eslint-plugin"), 1);
94
- var angular = [
95
- ...import_eslint_plugin2.default.configs["flat/angular"],
95
+ var import_globals = __toESM(require("globals"), 1);
96
+ var import_angular_eslint2 = require("angular-eslint");
97
+ var import_typescript_eslint2 = require("typescript-eslint");
98
+ var angular = (0, import_typescript_eslint2.config)([
96
99
  {
97
100
  files: ["**/*.ts"],
101
+ extends: [...import_angular_eslint2.configs.tsRecommended],
102
+ languageOptions: {
103
+ globals: {
104
+ ...import_globals.default.browser,
105
+ ...import_globals.default.es2025,
106
+ ...import_globals.default.node
107
+ }
108
+ },
109
+ processor: import_angular_eslint2.processInlineTemplates,
110
+ plugins: { "@angular-eslint": import_angular_eslint2.tsPlugin },
98
111
  rules: {
99
- "@angular-eslint/prefer-on-push-component-change-detection": "error"
112
+ "@angular-eslint/prefer-on-push-component-change-detection": "error",
113
+ "@angular-eslint/prefer-signals": "error",
114
+ "@angular-eslint/use-injectable-provided-in": "error"
100
115
  }
101
116
  }
102
- ];
117
+ ]);
103
118
 
104
119
  // packages/lint-suite/src/lib/base.ts
105
- var import_eslint_plugin3 = __toESM(require("@nx/eslint-plugin"), 1);
106
- var import_eslint_plugin4 = __toESM(require("@stylistic/eslint-plugin"), 1);
120
+ var import_eslint_plugin = require("@nx/eslint-plugin");
121
+ var import_eslint_plugin2 = __toESM(require("@stylistic/eslint-plugin"), 1);
107
122
  var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
108
- var base = [
109
- ...import_eslint_plugin3.default.configs["flat/base"],
123
+ var import_typescript_eslint3 = require("typescript-eslint");
124
+ var base = (0, import_typescript_eslint3.config)([
125
+ { extends: [...import_eslint_plugin.configs["flat/base"]] },
110
126
  {
111
127
  files: [
112
128
  "**/*.js",
@@ -118,7 +134,7 @@ var base = [
118
134
  "**/*.cts",
119
135
  "**/*.mts"
120
136
  ],
121
- ...import_eslint_plugin_import_x.default.flatConfigs.recommended
137
+ extends: [import_eslint_plugin_import_x.default.flatConfigs.recommended]
122
138
  },
123
139
  {
124
140
  files: [
@@ -131,7 +147,7 @@ var base = [
131
147
  "**/*.cts",
132
148
  "**/*.mts"
133
149
  ],
134
- ...import_eslint_plugin4.default.configs.recommended
150
+ extends: [import_eslint_plugin2.default.configs.recommended]
135
151
  },
136
152
  {
137
153
  files: [
@@ -150,7 +166,7 @@ var base = [
150
166
  "no-console": ["warn", { allow: ["warn", "error"] }],
151
167
  "no-debugger": "error",
152
168
  eqeqeq: ["error", "always", { null: "ignore" }],
153
- curly: ["error", "all"],
169
+ curly: ["error", "multi"],
154
170
  "prefer-const": ["error", { destructuring: "all" }],
155
171
  "no-var": "error",
156
172
  "object-shorthand": "error",
@@ -181,24 +197,6 @@ var base = [
181
197
  // Enforce consistency for getters/setters
182
198
  "class-methods-use-this": "error",
183
199
  "no-underscore-dangle": "error",
184
- "padding-line-between-statements": [
185
- "error",
186
- {
187
- blankLine: "always",
188
- prev: "export",
189
- next: ["export", "const"]
190
- },
191
- {
192
- blankLine: "always",
193
- prev: "*",
194
- next: "return"
195
- },
196
- {
197
- blankLine: "always",
198
- prev: "*",
199
- next: "if"
200
- }
201
- ],
202
200
  "max-len": [
203
201
  "error",
204
202
  {
@@ -215,6 +213,38 @@ var base = [
215
213
  }
216
214
  }
217
215
  ],
216
+ "@stylistic/padding-line-between-statements": [
217
+ "error",
218
+ {
219
+ blankLine: "always",
220
+ prev: "export",
221
+ next: ["export", "const"]
222
+ },
223
+ {
224
+ blankLine: "always",
225
+ prev: ["const", "let", "var"],
226
+ next: "*"
227
+ },
228
+ {
229
+ blankLine: "any",
230
+ prev: ["const", "let", "var"],
231
+ next: ["const", "let", "var"]
232
+ },
233
+ {
234
+ blankLine: "always",
235
+ prev: "*",
236
+ next: [
237
+ "for",
238
+ "if",
239
+ "return",
240
+ "throw",
241
+ "switch",
242
+ "try",
243
+ "class",
244
+ "function"
245
+ ]
246
+ }
247
+ ],
218
248
  "@stylistic/comma-dangle": [
219
249
  "error",
220
250
  {
@@ -300,36 +330,45 @@ var base = [
300
330
  "class-methods-use-this": "off"
301
331
  }
302
332
  }
303
- ];
333
+ ]);
304
334
 
305
335
  // packages/lint-suite/src/lib/javascript.ts
306
- var import_eslint_plugin5 = __toESM(require("@nx/eslint-plugin"), 1);
307
- var javascript = import_eslint_plugin5.default.configs["flat/javascript"];
336
+ var import_eslint_plugin3 = require("@nx/eslint-plugin");
337
+ var import_typescript_eslint4 = require("typescript-eslint");
338
+ var javascript = (0, import_typescript_eslint4.config)({
339
+ files: ["**/*.js", "**/*.jsx", "**/*.cjs", "**/*.mjs"],
340
+ extends: [...import_eslint_plugin3.configs["flat/javascript"]],
341
+ rules: {}
342
+ });
308
343
 
309
344
  // packages/lint-suite/src/lib/jest.ts
310
345
  var import_eslint_plugin_jest = __toESM(require("eslint-plugin-jest"), 1);
311
- var jest = [
346
+ var import_typescript_eslint5 = require("typescript-eslint");
347
+ var jest = (0, import_typescript_eslint5.config)([
312
348
  {
313
349
  files: ["**/*.spec.ts", "**/*.test.ts", "**/*.spec.js", "**/*.test.js"],
314
- ...import_eslint_plugin_jest.default.configs["flat/all"],
350
+ extends: [import_eslint_plugin_jest.default.configs["flat/all"]],
315
351
  rules: {
316
352
  "jest/no-done-callback": "off"
317
353
  }
318
354
  }
319
- ];
355
+ ]);
320
356
 
321
357
  // packages/lint-suite/src/lib/json.ts
322
358
  var import_eslint_plugin_json = __toESM(require("eslint-plugin-json"), 1);
323
- var json = [
359
+ var import_typescript_eslint6 = require("typescript-eslint");
360
+ var json = (0, import_typescript_eslint6.config)([
324
361
  {
325
362
  files: ["**/*.json"],
326
- ...import_eslint_plugin_json.default.configs.recommended
363
+ extends: [import_eslint_plugin_json.default.configs.recommended],
364
+ rules: {}
327
365
  }
328
- ];
366
+ ]);
329
367
 
330
368
  // packages/lint-suite/src/lib/rxjs.ts
331
369
  var import_eslint_plugin_rxjs = __toESM(require("@smarttools/eslint-plugin-rxjs"), 1);
332
- var rxjs = [
370
+ var import_typescript_eslint7 = require("typescript-eslint");
371
+ var rxjs = (0, import_typescript_eslint7.config)([
333
372
  {
334
373
  files: [
335
374
  "**/*.js",
@@ -346,7 +385,7 @@ var rxjs = [
346
385
  projectService: true
347
386
  }
348
387
  },
349
- ...import_eslint_plugin_rxjs.default.configs.recommended
388
+ extends: [import_eslint_plugin_rxjs.default.configs.recommended]
350
389
  },
351
390
  {
352
391
  files: [
@@ -394,26 +433,22 @@ var rxjs = [
394
433
  "rxjs/no-ignored-subscription": "off"
395
434
  }
396
435
  }
397
- ];
436
+ ]);
398
437
 
399
438
  // packages/lint-suite/src/lib/storybook.ts
400
439
  var import_eslint_plugin_storybook = __toESM(require("eslint-plugin-storybook"), 1);
401
- var storybook = [
402
- ...import_eslint_plugin_storybook.default.configs["flat/recommended"],
440
+ var import_typescript_eslint8 = require("typescript-eslint");
441
+ var storybook = (0, import_typescript_eslint8.config)([
403
442
  {
404
443
  ignores: ["!.storybook"],
405
444
  files: ["**/*.stories.ts"],
406
- rules: {
407
- "storybook/no-uninstalled-addons": [
408
- "error",
409
- { packageJsonLocation: "package.json" }
410
- ]
411
- }
445
+ extends: [import_eslint_plugin_storybook.default.configs["flat/recommended"]],
446
+ rules: {}
412
447
  }
413
- ];
448
+ ]);
414
449
 
415
450
  // packages/lint-suite/src/lib/typescript.ts
416
- var import_eslint_plugin6 = __toESM(require("@nx/eslint-plugin"), 1);
451
+ var import_eslint_plugin4 = require("@nx/eslint-plugin");
417
452
  var import_eslint_import_resolver_typescript = require("eslint-import-resolver-typescript");
418
453
  var import_eslint_plugin_import_x2 = __toESM(require("eslint-plugin-import-x"), 1);
419
454
 
@@ -555,15 +590,21 @@ var explicit_accessibility_default = createRule({
555
590
  });
556
591
 
557
592
  // packages/lint-suite/src/lib/typescript.ts
593
+ var import_typescript_eslint9 = require("typescript-eslint");
558
594
  var localTypescriptRules = {
559
595
  rules: {
560
596
  "explicit-accessibility": explicit_accessibility_default
561
597
  }
562
598
  };
563
- var typescript = [
599
+ var typescript = (0, import_typescript_eslint9.config)([
564
600
  // NOTE: Checks for 'prettier' and 'eslint-plugin-prettier'
565
- import_eslint_plugin_import_x2.default.flatConfigs.typescript,
566
- ...import_eslint_plugin6.default.configs["flat/typescript"],
601
+ {
602
+ files: ["**/*.ts", "**/*.tsx", "**/*.cts", "**/*.mts"],
603
+ extends: [
604
+ import_eslint_plugin_import_x2.default.flatConfigs.typescript,
605
+ ...import_eslint_plugin4.configs["flat/typescript"]
606
+ ]
607
+ },
567
608
  {
568
609
  files: ["**/*.ts", "**/*.tsx", "**/*.cts", "**/*.mts"],
569
610
  plugins: { local: localTypescriptRules },
@@ -586,6 +627,8 @@ var typescript = [
586
627
  // Consider enabling if maximum explicitness is desired, even if verbose:
587
628
  // C. Null/Undefined Safety (Requires strictNullChecks)
588
629
  "@typescript-eslint/no-non-null-assertion": "error",
630
+ "@typescript-eslint/prefer-nullish-coalescing": "error",
631
+ "@typescript-eslint/prefer-optional-chain": "error",
589
632
  // D. Promise Handling (Supplementing plugin:promise/recommended)
590
633
  "@typescript-eslint/no-floating-promises": [
591
634
  "error",
@@ -752,7 +795,7 @@ var typescript = [
752
795
  "@typescript-eslint/naming-convention": "off"
753
796
  }
754
797
  }
755
- ];
798
+ ]);
756
799
 
757
800
  // packages/lint-suite/src/index.ts
758
801
  var recommended = [