Skip to content

Commit 820b0d3

Browse files
Test an Angular workspace in the Angular smoke test.
1 parent 9003e00 commit 820b0d3

30 files changed

+18817
-171
lines changed

package-lock.json

Lines changed: 265 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/angular/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.
2+
/.angular
3+
/dist

tests/angular/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Angular Smoke Test
22

3-
## Overview
3+
This package is a smoke test for using the Angular rules in an Angular workspace. See [CONTRIBUTING.md](../../CONTRIBUTING.md#smoke-tests) for more information on smoke tests.
44

5-
This package is a smoke test for using the Angular rules in a project. See [CONTRIBUTING.md](../../CONTRIBUTING.md#smoke-tests) for more information.
5+
## Testing
6+
7+
- The `npm test` script runs the linter to test that the lint configuration functions correctly with `ng lint` and `eslint`.
8+
- The `npm run ng-test` script runs `ng test` to test that the workspace is configured properly.

tests/angular/angular.json

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"angular-test": {
7+
"projectType": "application",
8+
"root": "",
9+
"sourceRoot": "src",
10+
"prefix": "app",
11+
"architect": {
12+
"build": {
13+
"builder": "@angular-devkit/build-angular:application",
14+
"options": {
15+
"outputPath": "dist/angular-test",
16+
"index": "src/index.html",
17+
"browser": "src/main.ts",
18+
"polyfills": [
19+
"zone.js",
20+
"@angular/localize/init"
21+
],
22+
"tsConfig": "tsconfig.app.json"
23+
},
24+
"configurations": {
25+
"production": {
26+
"outputHashing": "all"
27+
},
28+
"development": {
29+
"optimization": false,
30+
"extractLicenses": false,
31+
"sourceMap": true
32+
}
33+
},
34+
"defaultConfiguration": "production"
35+
},
36+
"serve": {
37+
"builder": "@angular-devkit/build-angular:dev-server",
38+
"configurations": {
39+
"production": {
40+
"buildTarget": "angular-test:build:production"
41+
},
42+
"development": {
43+
"buildTarget": "angular-test:build:development"
44+
}
45+
},
46+
"defaultConfiguration": "development"
47+
},
48+
"extract-i18n": {
49+
"builder": "@angular-devkit/build-angular:extract-i18n"
50+
},
51+
"test": {
52+
"builder": "@angular-devkit/build-angular:karma",
53+
"options": {
54+
"polyfills": [
55+
"zone.js",
56+
"zone.js/testing",
57+
"@angular/localize/init"
58+
],
59+
"tsConfig": "tsconfig.spec.json"
60+
}
61+
},
62+
"lint": {
63+
"builder": "@angular-eslint/builder:lint",
64+
"options": {
65+
"lintFilePatterns": [
66+
"src/**/*.ts",
67+
"src/**/*.js",
68+
"src/**/*.mjs",
69+
"src/**/*.html"
70+
]
71+
}
72+
}
73+
}
74+
},
75+
"angular-library": {
76+
"projectType": "library",
77+
"root": "projects/angular-library",
78+
"sourceRoot": "projects/angular-library/src",
79+
"prefix": "angular-lib",
80+
"architect": {
81+
"build": {
82+
"builder": "@angular-devkit/build-angular:ng-packagr",
83+
"options": {
84+
"project": "projects/angular-library/ng-package.json"
85+
},
86+
"configurations": {
87+
"production": {
88+
"tsConfig": "projects/angular-library/tsconfig.lib.prod.json"
89+
},
90+
"development": {
91+
"tsConfig": "projects/angular-library/tsconfig.lib.json"
92+
}
93+
},
94+
"defaultConfiguration": "production"
95+
},
96+
"test": {
97+
"builder": "@angular-devkit/build-angular:karma",
98+
"options": {
99+
"tsConfig": "projects/angular-library/tsconfig.spec.json",
100+
"polyfills": [
101+
"zone.js",
102+
"zone.js/testing",
103+
"@angular/localize/init"
104+
]
105+
}
106+
},
107+
"lint": {
108+
"builder": "@angular-eslint/builder:lint",
109+
"options": {
110+
"lintFilePatterns": [
111+
"projects/angular-library/**/*.ts",
112+
"projects/angular-library/**/*.js",
113+
"projects/angular-library/**/*.mjs",
114+
"projects/angular-library/**/*.html"
115+
],
116+
"eslintConfig": "projects/angular-library/eslint.config.mjs"
117+
}
118+
}
119+
}
120+
}
121+
},
122+
"cli": {
123+
"analytics": false,
124+
"schematicCollections": [
125+
"angular-eslint"
126+
]
127+
}
128+
}

tests/angular/custom-ignore-attributes/index.html

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/angular/custom-ignore-attributes/index.spec.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

tests/angular/custom-ignore-attributes/index.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

tests/angular/eslint.config.js

Lines changed: 0 additions & 37 deletions
This file was deleted.

tests/angular/eslint.config.mjs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { defineConfig, globalIgnores } from 'eslint/config';
2+
import { angularTypescriptConfig, angularTemplateConfig, ignoreAttributes } from '@ni/eslint-config-angular';
3+
import { javascriptConfig, importNodeEsmConfig } from '@ni/eslint-config-javascript';
4+
5+
export default defineConfig([
6+
globalIgnores(['projects']),
7+
{
8+
files: ['**/*.js', '**/*.mjs'],
9+
extends: [javascriptConfig, importNodeEsmConfig]
10+
}, {
11+
files: ['**/*.ts'],
12+
extends: angularTypescriptConfig,
13+
languageOptions: {
14+
parserOptions: {
15+
project: ['tsconfig.app.json', 'tsconfig.spec.json', 'tsconfig.json']
16+
}
17+
},
18+
rules: {
19+
'@angular-eslint/component-selector': [
20+
'error', { prefix: 'app', style: 'kebab-case', type: 'element' }
21+
]
22+
}
23+
}, {
24+
files: ['**/*.spec.ts'],
25+
rules: {
26+
'@typescript-eslint/no-unsafe-call': 'off',
27+
'@typescript-eslint/no-unsafe-member-access': 'off'
28+
}
29+
}, {
30+
files: ['**/*.html'],
31+
extends: angularTemplateConfig,
32+
rules: {
33+
'@angular-eslint/template/i18n': [
34+
'error',
35+
{ checkId: false, ignoreAttributes: [...ignoreAttributes.all, 'custom-field'] }
36+
]
37+
}
38+
}]);

tests/angular/index.spec.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)