lint-suite 1.3.2 → 1.3.8

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Art
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Art
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,167 +1,167 @@
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, v8 type-safety replacements, consistent imports, and code organization
8
- - **Angular Support**: Component best practices (including Signals), Angular 21+ template rules, and modern control flow
9
- - **RxJS Guidelines**: Observable patterns, Finnish notation, subject encapsulation, 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, Vitest, and Playwright configurations with best-practice rules
13
- - **Prettier**: Automatic disabling of formatting rules that conflict with Prettier
14
- - **Architecture**: Module boundary enforcement with `eslint-plugin-boundaries`
15
- - **Additional Support**: JSON (with comment support for tsconfig), Storybook CSF enforcement
16
-
17
- ## Installation
18
-
19
- ```bash
20
- pnpm add -D lint-suite
21
- ```
22
-
23
- ## Dependencies
24
-
25
- ```bash
26
- pnpm add -D eslint typescript-eslint eslint-config-prettier
27
- ```
28
-
29
- ## Usage
30
-
31
- Create an `eslint.config.mjs` file in your project root:
32
-
33
- ```js
34
- import { recommended } from 'lint-suite';
35
-
36
- export default [...recommended];
37
- ```
38
-
39
- Or selectively include configurations:
40
-
41
- ```js
42
- import { base, javascript, typescript, prettier } from 'lint-suite';
43
-
44
- export default [
45
- ...base,
46
- ...javascript,
47
- ...typescript,
48
- ...prettier // Must be last to disable conflicting formatting rules
49
- ];
50
- ```
51
-
52
- ## Available Configurations
53
-
54
- | Configuration | Description |
55
- | ------------------- | -------------------------------------------------------- |
56
- | `base` | Core JavaScript rules, formatting, and complexity limits |
57
- | `javascript` | JavaScript-specific rules via `@nx/eslint-plugin` |
58
- | `typescript` | TypeScript strict typing, imports, and naming conventions |
59
- | `angular` | Angular component best practices with Signal support |
60
- | `angularTemplate` | HTML template rules with accessibility and performance |
61
- | `rxjs` | Observable patterns, operator safety, and subscriptions |
62
- | `jest` | Jest testing best practices and matchers |
63
- | `vitest` | Vitest testing rules and matcher improvements |
64
- | `playwright` | Playwright e2e locator and matcher best practices |
65
- | `json` | JSON linting with comment support for tsconfig/vscode |
66
- | `storybook` | Storybook CSF enforcement |
67
- | `boundaries` | Module boundary rules (feature, data-access, ui, etc.) |
68
- | `prettier` | Disables rules that conflict with Prettier (use last) |
69
- | **`recommended`** | **All of the above combined in the correct order** |
70
-
71
- ## Customization
72
-
73
- You can override any rules by adding a `rules` section to your ESLint config:
74
-
75
- ```js
76
- import { typescript, prettier } from 'lint-suite';
77
-
78
- export default [
79
- ...typescript,
80
- {
81
- rules: {
82
- '@typescript-eslint/explicit-function-return-type': 'off'
83
- }
84
- },
85
- ...prettier
86
- ];
87
- ```
88
-
89
- ## Available Rules (you can add more as you prefer)
90
-
91
- ### nx/eslint-plugin
92
-
93
- - `@nx/enforce-module-boundaries`: Enforces module boundary restrictions
94
- - `@nx/dependency-checks`: Validates dependencies in workspace projects
95
- - ...
96
-
97
- ### eslint-plugin-jest
98
-
99
- - `jest/consistent-test-it`: Enforces consistent test function usage (`it`)
100
- - `jest/prefer-comparison-matcher`: Enforces comparison matchers
101
- - `jest/prefer-hooks-on-top`: Ensures hooks are at the top of describe blocks
102
- - `jest/no-conditional-in-test`: Warns against conditionals in tests
103
- - ...
104
-
105
- ### @vitest/eslint-plugin
106
-
107
- - `vitest/max-nested-describe`: Limits describe nesting depth
108
- - `vitest/prefer-to-be`: Enforces `toBe` matcher usage
109
- - `vitest/no-conditional-in-test`: Disallows conditionals in tests
110
- - ...
111
-
112
- ### eslint-plugin-playwright
113
-
114
- - `playwright/prefer-locator`: Enforces modern locator API
115
- - `playwright/prefer-native-locators`: Prefers native locator methods
116
- - `playwright/prefer-to-be`: Enforces `toBe` matcher usage
117
- - ...
118
-
119
- ### eslint-plugin-json
120
-
121
- - `json/json`: Validates JSON syntax
122
- - `json/sort-package-json`: Enforces consistent ordering in package.json
123
- - ...
124
-
125
- ### @smarttools/eslint-plugin-rxjs
126
-
127
- - `@rxjs/finnish`: Enforces Finnish notation for observables
128
- - `@rxjs/no-exposed-subjects`: Enforces subject encapsulation
129
- - `@rxjs/no-cyclic-action`: Prevents infinite loops in NgRx effects
130
- - `@rxjs/no-unsafe-takeuntil`: Ensures proper usage of takeUntil operator
131
- - ...
132
-
133
- ### eslint-plugin-storybook
134
-
135
- - `storybook/csf-component`: Enforces component property in stories
136
- - `storybook/no-stories-of`: Prevents deprecated `storiesOf` API
137
- - ...
138
-
139
- ### eslint-plugin-import-x
140
-
141
- - `import-x/no-cycle`: Detects circular dependencies
142
- - `import-x/no-self-import`: Prevents modules importing themselves
143
- - `import-x/order`: Enforces a consistent order of import statements
144
- - `import-x/consistent-type-specifier-style`: Consistent type import style
145
- - ...
146
-
147
- ### @stylistic/eslint-plugin
148
-
149
- - `@stylistic/max-len`: Enforces maximum line length
150
- - `@stylistic/indent`: Enforces consistent indentation
151
- - `@stylistic/quotes`: Enforces consistent quote style
152
- - ...
153
-
154
- ### eslint-config-prettier
155
-
156
- - Automatically disables all ESLint rules that conflict with Prettier
157
- - Must be the last configuration in the array
158
-
159
- ## Contributing
160
-
161
- See [CONTRIBUTING.md](./CONTRIBUTING.md) for contribution guidelines.
162
- See [CHANGELOG.md](./CHANGELOG.md) for version history.
163
- See [RELEASE_NOTES.md](./RELEASE_NOTES.md) for detailed release notes.
164
-
165
- ## License
166
-
167
- 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, v8 type-safety replacements, consistent imports, and code organization
8
+ - **Angular Support**: Component best practices (including Signals), Angular 21+ template rules, and modern control flow
9
+ - **RxJS Guidelines**: Observable patterns, Finnish notation, subject encapsulation, 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, Vitest, and Playwright configurations with best-practice rules
13
+ - **Prettier**: Automatic disabling of formatting rules that conflict with Prettier
14
+ - **Architecture**: Module boundary enforcement with `eslint-plugin-boundaries`
15
+ - **Additional Support**: JSON (with comment support for tsconfig), Storybook CSF enforcement
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ pnpm add -D lint-suite
21
+ ```
22
+
23
+ ## Dependencies
24
+
25
+ ```bash
26
+ pnpm add -D eslint typescript-eslint eslint-config-prettier
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ Create an `eslint.config.mjs` file in your project root:
32
+
33
+ ```js
34
+ import { recommended } from 'lint-suite';
35
+
36
+ export default [...recommended];
37
+ ```
38
+
39
+ Or selectively include configurations:
40
+
41
+ ```js
42
+ import { base, javascript, typescript, prettier } from 'lint-suite';
43
+
44
+ export default [
45
+ ...base,
46
+ ...javascript,
47
+ ...typescript,
48
+ ...prettier // Must be last to disable conflicting formatting rules
49
+ ];
50
+ ```
51
+
52
+ ## Available Configurations
53
+
54
+ | Configuration | Description |
55
+ | ------------------- | -------------------------------------------------------- |
56
+ | `base` | Core JavaScript rules, formatting, and complexity limits |
57
+ | `javascript` | JavaScript-specific rules via `@nx/eslint-plugin` |
58
+ | `typescript` | TypeScript strict typing, imports, and naming conventions |
59
+ | `angular` | Angular component best practices with Signal support |
60
+ | `angularTemplate` | HTML template rules with accessibility and performance |
61
+ | `rxjs` | Observable patterns, operator safety, and subscriptions |
62
+ | `jest` | Jest testing best practices and matchers |
63
+ | `vitest` | Vitest testing rules and matcher improvements |
64
+ | `playwright` | Playwright e2e locator and matcher best practices |
65
+ | `json` | JSON linting with comment support for tsconfig/vscode |
66
+ | `storybook` | Storybook CSF enforcement |
67
+ | `boundaries` | Module boundary rules (feature, data-access, ui, etc.) |
68
+ | `prettier` | Disables rules that conflict with Prettier (use last) |
69
+ | **`recommended`** | **All of the above combined in the correct order** |
70
+
71
+ ## Customization
72
+
73
+ You can override any rules by adding a `rules` section to your ESLint config:
74
+
75
+ ```js
76
+ import { typescript, prettier } from 'lint-suite';
77
+
78
+ export default [
79
+ ...typescript,
80
+ {
81
+ rules: {
82
+ '@typescript-eslint/explicit-function-return-type': 'off'
83
+ }
84
+ },
85
+ ...prettier
86
+ ];
87
+ ```
88
+
89
+ ## Available Rules (you can add more as you prefer)
90
+
91
+ ### nx/eslint-plugin
92
+
93
+ - `@nx/enforce-module-boundaries`: Enforces module boundary restrictions
94
+ - `@nx/dependency-checks`: Validates dependencies in workspace projects
95
+ - ...
96
+
97
+ ### eslint-plugin-jest
98
+
99
+ - `jest/consistent-test-it`: Enforces consistent test function usage (`it`)
100
+ - `jest/prefer-comparison-matcher`: Enforces comparison matchers
101
+ - `jest/prefer-hooks-on-top`: Ensures hooks are at the top of describe blocks
102
+ - `jest/no-conditional-in-test`: Warns against conditionals in tests
103
+ - ...
104
+
105
+ ### @vitest/eslint-plugin
106
+
107
+ - `vitest/max-nested-describe`: Limits describe nesting depth
108
+ - `vitest/prefer-to-be`: Enforces `toBe` matcher usage
109
+ - `vitest/no-conditional-in-test`: Disallows conditionals in tests
110
+ - ...
111
+
112
+ ### eslint-plugin-playwright
113
+
114
+ - `playwright/prefer-locator`: Enforces modern locator API
115
+ - `playwright/prefer-native-locators`: Prefers native locator methods
116
+ - `playwright/prefer-to-be`: Enforces `toBe` matcher usage
117
+ - ...
118
+
119
+ ### eslint-plugin-json
120
+
121
+ - `json/json`: Validates JSON syntax
122
+ - `json/sort-package-json`: Enforces consistent ordering in package.json
123
+ - ...
124
+
125
+ ### @smarttools/eslint-plugin-rxjs
126
+
127
+ - `@rxjs/finnish`: Enforces Finnish notation for observables
128
+ - `@rxjs/no-exposed-subjects`: Enforces subject encapsulation
129
+ - `@rxjs/no-cyclic-action`: Prevents infinite loops in NgRx effects
130
+ - `@rxjs/no-unsafe-takeuntil`: Ensures proper usage of takeUntil operator
131
+ - ...
132
+
133
+ ### eslint-plugin-storybook
134
+
135
+ - `storybook/csf-component`: Enforces component property in stories
136
+ - `storybook/no-stories-of`: Prevents deprecated `storiesOf` API
137
+ - ...
138
+
139
+ ### eslint-plugin-import-x
140
+
141
+ - `import-x/no-cycle`: Detects circular dependencies
142
+ - `import-x/no-self-import`: Prevents modules importing themselves
143
+ - `import-x/order`: Enforces a consistent order of import statements
144
+ - `import-x/consistent-type-specifier-style`: Consistent type import style
145
+ - ...
146
+
147
+ ### @stylistic/eslint-plugin
148
+
149
+ - `@stylistic/max-len`: Enforces maximum line length
150
+ - `@stylistic/indent`: Enforces consistent indentation
151
+ - `@stylistic/quotes`: Enforces consistent quote style
152
+ - ...
153
+
154
+ ### eslint-config-prettier
155
+
156
+ - Automatically disables all ESLint rules that conflict with Prettier
157
+ - Must be the last configuration in the array
158
+
159
+ ## Contributing
160
+
161
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for contribution guidelines.
162
+ See [CHANGELOG.md](./CHANGELOG.md) for version history.
163
+ See [RELEASE_NOTES.md](./RELEASE_NOTES.md) for detailed release notes.
164
+
165
+ ## License
166
+
167
+ MIT
package/index.cjs CHANGED
@@ -91,6 +91,10 @@ var angularTemplate = (0, import_config.defineConfig)([
91
91
  // v21.2.0: Prefer [class] over ngClass
92
92
  "@angular-eslint/template/prefer-static-string-properties": "error",
93
93
  // Reduce change detection
94
+ "@angular-eslint/template/no-non-null-assertion": "error",
95
+ // Forbid `!` assertions in templates
96
+ "@angular-eslint/template/no-inline-styles": "error",
97
+ // Forbid inline style="..." attributes
94
98
  "@angular-eslint/template/conditional-complexity": [
95
99
  "warn",
96
100
  { maxComplexity: 5 }
@@ -151,8 +155,26 @@ var angular = (0, import_config2.defineConfig)([
151
155
  // Prevent accidental reassignment
152
156
  "@angular-eslint/prefer-output-emitter-ref": "warn",
153
157
  // Modern output() function over @Output()
154
- "@angular-eslint/sort-lifecycle-methods": "warn"
158
+ "@angular-eslint/sort-lifecycle-methods": "warn",
155
159
  // Consistent lifecycle method ordering
160
+ "@angular-eslint/computed-must-return": "error",
161
+ // Catch silent computed() bugs missing a return
162
+ "@angular-eslint/no-conflicting-lifecycle": "error",
163
+ // Block incompatible hook combinations (OnChanges + DoCheck)
164
+ "@angular-eslint/no-duplicates-in-metadata-arrays": "error",
165
+ // Catch duplicate imports/providers in @Component/@NgModule
166
+ "@angular-eslint/no-lifecycle-call": "error",
167
+ // Forbid manual this.ngOnInit() calls
168
+ "@angular-eslint/require-lifecycle-on-prototype": "error",
169
+ // Lifecycle hooks must be methods, not arrow-fn fields
170
+ "@angular-eslint/relative-url-prefix": "error",
171
+ // Require ./ in templateUrl/styleUrl for portability
172
+ "@angular-eslint/use-component-selector": "error",
173
+ // All components must declare a selector
174
+ "@angular-eslint/no-developer-preview": "error",
175
+ // Block APIs marked @developerPreview (no breaking-change policy)
176
+ "@angular-eslint/no-experimental": "error"
177
+ // Block APIs marked @experimental
156
178
  }
157
179
  }
158
180
  ]);
@@ -631,12 +653,12 @@ var explicit_accessibility_default = createRule({
631
653
  }
632
654
  }
633
655
  context.report({
634
- node: reportNode,
656
+ node: reportNode ?? node,
635
657
  messageId: "missingAccessibility",
636
658
  data: { name },
637
659
  fix(fixer) {
638
- let tokenToInsertBefore = null;
639
660
  let insertText = `${defaultAccessibility} `;
661
+ let tokenToInsertBefore;
640
662
  if (node.decorators.length > 0) {
641
663
  const lastDecorator = node.decorators[node.decorators.length - 1];
642
664
  tokenToInsertBefore = sourceCode.getTokenAfter(lastDecorator);
@@ -775,7 +797,10 @@ var typescript = (0, import_config10.defineConfig)([
775
797
  // Prevent confusing void usage
776
798
  "@typescript-eslint/no-dynamic-delete": "error",
777
799
  // Use Map instead of delete obj[key]
778
- "@typescript-eslint/no-extraneous-class": ["error", { allowWithDecorator: true }],
800
+ "@typescript-eslint/no-extraneous-class": [
801
+ "error",
802
+ { allowWithDecorator: true }
803
+ ],
779
804
  // Allow Angular classes
780
805
  "@typescript-eslint/no-invalid-void-type": "error",
781
806
  // Restrict void to return types
@@ -911,8 +936,7 @@ var typescript = (0, import_config10.defineConfig)([
911
936
  settings: {
912
937
  "import-x/resolver-next": [
913
938
  (0, import_eslint_import_resolver_typescript.createTypeScriptImportResolver)({
914
- alwaysTryTypes: true,
915
- project: "tsconfig.base.json"
939
+ alwaysTryTypes: true
916
940
  })
917
941
  ]
918
942
  }