eslint-config-angular-strict 2.1.3 → 2.1.4

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/index.js CHANGED
@@ -8,6 +8,15 @@ import tsParser from '@typescript-eslint/parser';
8
8
  import { configs, rules } from 'eslint-config-airbnb-extended';
9
9
 
10
10
  export default [
11
+ // Global plugins configuration for all files
12
+ {
13
+ plugins: {
14
+ 'import-x': importX,
15
+ '@stylistic': stylistic,
16
+ '@typescript-eslint': tsEslint,
17
+ },
18
+ },
19
+
11
20
  // Airbnb strict rules
12
21
  ...configs.base.all,
13
22
  rules.base.strict,
@@ -21,9 +30,6 @@ export default [
21
30
  },
22
31
  plugins: {
23
32
  '@angular-eslint': angular,
24
- '@stylistic': stylistic,
25
- '@typescript-eslint': tsEslint,
26
- 'import-x': importX,
27
33
  },
28
34
  rules: {
29
35
  // Angular ESLint rules
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-angular-strict",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
4
4
  "description": "Modern ESLint configuration with strict rules for Angular development.",
5
5
  "keywords": [
6
6
  "angular",
@@ -31,6 +31,9 @@
31
31
  "exports": {
32
32
  ".": "./index.js"
33
33
  },
34
+ "scripts": {
35
+ "test": "cd tests && yarn install && eslint . --format=stylish"
36
+ },
34
37
  "dependencies": {
35
38
  "@angular-eslint/builder": "20.3.0",
36
39
  "@angular-eslint/eslint-plugin": "20.3.0",
@@ -0,0 +1,3 @@
1
+ import angularStrict from '../index.js';
2
+
3
+ export default [...angularStrict];
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "eslint-config-angular-strict-tests",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "dependencies": {
7
+ "@angular/core": "^20.3.2"
8
+ }
9
+ }
@@ -0,0 +1,38 @@
1
+ <!-- Angular template with intentional violations to test ESLint rules -->
2
+ <div class="sample-container">
3
+ <h2>Sample Test Component</h2>
4
+
5
+ <!-- Missing trackBy function in ngFor -->
6
+ <ul>
7
+ <li *ngFor="let item of _items">
8
+ {{ item }}
9
+ </li>
10
+ </ul>
11
+
12
+ <!-- Attributes not in alphabetical order -->
13
+ <input
14
+ type="text"
15
+ placeholder="Enter name"
16
+ id="name-field"
17
+ class="form-control"
18
+ [(ngModel)]="name">
19
+
20
+ <!-- Missing label for accessibility -->
21
+ <input type="checkbox" id="option1" name="options" value="1">
22
+ Option 1
23
+
24
+ <!-- Positive tabindex (accessibility violation) -->
25
+ <button tabindex="2" (click)="processItems()">Process</button>
26
+
27
+ <!-- Non-self-closing tags -->
28
+ <br>
29
+ <hr>
30
+
31
+ <!-- Using any type in template -->
32
+ <div>{{ config.anyProperty }}</div>
33
+
34
+ <!-- Missing key events for mouse events -->
35
+ <div (click)="loadData()" class="clickable">
36
+ Click to load data
37
+ </div>
38
+ </div>
@@ -0,0 +1,34 @@
1
+ import { Component, OnInit, Input } from '@angular/core';
2
+
3
+ // Test component with intentional violations to validate ESLint rules
4
+
5
+ @Component({
6
+ selector: 'app-sample',
7
+ templateUrl: './sample.component.html',
8
+ styleUrls: ['./sample.component.css'] // Should trigger consistent-component-styles
9
+ })
10
+ export class SampleComponent implements OnInit {
11
+ @Input() config: any; // Should trigger no-explicit-any warning
12
+ private _items!: string[]; // Non-null assertion
13
+ public name = 'sample';
14
+
15
+ constructor() {} // Empty constructor should trigger warning
16
+
17
+ ngOnInit(): void {
18
+ this.loadData();
19
+ }
20
+
21
+ loadData() {
22
+ this._items = this.config?.items || [];
23
+ }
24
+
25
+ // Method should be after getter based on member-ordering
26
+ processItems() {
27
+ return this._items.map(item => item.toUpperCase()); // Missing arrow function parens
28
+ }
29
+
30
+ // Getter should be before methods
31
+ get itemCount(): number {
32
+ return this._items?.length || 0;
33
+ }
34
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "compilerOptions": {
3
+ "declaration": false,
4
+ "esModuleInterop": true,
5
+ "experimentalDecorators": true,
6
+ "forceConsistentCasingInFileNames": true,
7
+ "importHelpers": true,
8
+ "incremental": true,
9
+ "lib": ["es2022", "dom"],
10
+ "module": "es2022",
11
+ "moduleResolution": "bundler",
12
+ "noImplicitAny": true,
13
+ "noImplicitOverride": true,
14
+ "noUnusedLocals": true,
15
+ "outDir": "./dist/out-tsc",
16
+ "sourceMap": true,
17
+ "strict": true,
18
+ "target": "es2022"
19
+ },
20
+ "angularCompilerOptions": {
21
+ "strictInjectionParameters": true,
22
+ "strictStandalone": true,
23
+ "strictTemplates": true
24
+ }
25
+ }