Skip to content

Commit a9383fa

Browse files
authored
chore: migrate tslint to eslint (#199)
1 parent 0af6018 commit a9383fa

File tree

92 files changed

+554
-664
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+554
-664
lines changed

.eslintrc.json

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
{
2+
"root": true,
3+
"ignorePatterns": ["**/*"],
4+
"plugins": ["@nrwl/nx"],
5+
"overrides": [
6+
{
7+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
8+
"parserOptions": {
9+
"project": ["/tsconfig.*?.json"]
10+
},
11+
"rules": {
12+
"@nrwl/nx/enforce-module-boundaries": [
13+
"error",
14+
{
15+
"enforceBuildableLibDependency": true,
16+
"allow": [],
17+
"depConstraints": [
18+
{
19+
"sourceTag": "*",
20+
"onlyDependOnLibsWithTags": ["*"]
21+
}
22+
]
23+
}
24+
]
25+
}
26+
},
27+
{
28+
"files": ["*.ts", "*.tsx"],
29+
"extends": ["plugin:@nrwl/nx/typescript"],
30+
"rules": {}
31+
},
32+
{
33+
"files": ["*.js", "*.jsx"],
34+
"extends": ["plugin:@nrwl/nx/javascript"],
35+
"rules": {}
36+
},
37+
{
38+
"files": ["*.ts"],
39+
"rules": {
40+
"@typescript-eslint/consistent-type-definitions": "error",
41+
"@typescript-eslint/dot-notation": "off",
42+
"@typescript-eslint/naming-convention": "error",
43+
"@typescript-eslint/no-shadow": [
44+
"error",
45+
{
46+
"hoist": "all"
47+
}
48+
],
49+
"@typescript-eslint/no-unused-expressions": "error",
50+
"@typescript-eslint/prefer-function-type": "error",
51+
"@typescript-eslint/quotes": ["error", "single"],
52+
"@typescript-eslint/type-annotation-spacing": "error",
53+
"@typescript-eslint/no-explicit-any": "off",
54+
"arrow-body-style": "error",
55+
"brace-style": ["error", "1tbs"],
56+
"curly": "error",
57+
"eol-last": "error",
58+
"eqeqeq": ["error", "smart"],
59+
"guard-for-in": "error",
60+
"id-blacklist": "off",
61+
"id-match": "off",
62+
"import/no-deprecated": "warn",
63+
"no-bitwise": "error",
64+
"no-caller": "error",
65+
"no-console": [
66+
"error",
67+
{
68+
"allow": [
69+
"log",
70+
"warn",
71+
"dir",
72+
"timeLog",
73+
"assert",
74+
"clear",
75+
"count",
76+
"countReset",
77+
"group",
78+
"groupEnd",
79+
"table",
80+
"dirxml",
81+
"error",
82+
"groupCollapsed",
83+
"Console",
84+
"profile",
85+
"profileEnd",
86+
"timeStamp",
87+
"context"
88+
]
89+
}
90+
],
91+
"no-empty": "off",
92+
"no-eval": "error",
93+
"no-new-wrappers": "error",
94+
"no-throw-literal": "error",
95+
"no-undef-init": "error",
96+
"no-underscore-dangle": "off",
97+
"radix": "error",
98+
"spaced-comment": [
99+
"error",
100+
"always",
101+
{
102+
"markers": ["/"]
103+
}
104+
]
105+
},
106+
"plugins": ["eslint-plugin-import", "@angular-eslint/eslint-plugin", "@typescript-eslint"]
107+
},
108+
{
109+
"files": ["*.html"],
110+
"rules": {}
111+
}
112+
]
113+
}

.prettierignore

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# NPM Files
2+
package-lock.json
3+
migrations.json
4+
5+
CHANGELOG.md
6+
7+
#Ignore specific file types
8+
*.svg
9+
*.xml
10+
*.png
11+
*.jpg
12+
13+
# compiled output
14+
/dist
15+
/tmp
16+
/out-tsc
17+
# dependencies
18+
/node_modules
19+
20+
# IDEs and editors
21+
/.idea
22+
.project
23+
.classpath
24+
.c9/
25+
*.launch
26+
.settings/
27+
*.sublime-workspace
28+
29+
# IDE - VSCode
30+
.vscode/*
31+
!.vscode/cSpell.json
32+
!.vscode/settings.json
33+
!.vscode/tasks.json
34+
!.vscode/launch.json
35+
!.vscode/extensions.json
36+
37+
# misc
38+
/.sass-cache
39+
/connect.lock
40+
/coverage
41+
/libpeerconnection.log
42+
npm-debug.log
43+
testem.log
44+
/typings
45+
deployment.yaml
46+
47+
# e2e
48+
/*e2e/*.js
49+
/*e2e/*.map
50+
51+
# System Files
52+
.DS_Store
53+
Thumbs.db

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ describe('Counter', () => {
139139
});
140140
```
141141

142-
[See more examples](https://github.com/testing-library/angular-testing-library/tree/master/apps/example-app/app/examples)
142+
[See more examples](https://github.com/testing-library/angular-testing-library/tree/master/apps/example-app/src/app/examples)
143143

144144
## Installation
145145

angular.json

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
{
2-
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
32
"version": 1,
4-
"newProjectRoot": "",
3+
"cli": {
4+
"analytics": false
5+
},
6+
"defaultProject": "example-app",
57
"projects": {
68
"example-app": {
7-
"root": "",
8-
"sourceRoot": "apps/example-app",
99
"projectType": "application",
10+
"root": "apps/example-app",
11+
"sourceRoot": "apps/example-app/src",
1012
"prefix": "app",
1113
"schematics": {},
1214
"architect": {
@@ -15,12 +17,12 @@
1517
"options": {
1618
"aot": true,
1719
"outputPath": "dist/apps/example-app",
18-
"index": "apps/example-app/index.html",
19-
"main": "apps/example-app/main.ts",
20-
"polyfills": "apps/example-app/polyfills.ts",
21-
"tsConfig": "apps/example-app/tsconfig.json",
22-
"assets": ["apps/example-app/favicon.ico", "apps/example-app/assets"],
23-
"styles": ["apps/example-app/styles.css"],
20+
"index": "apps/example-app/src/index.html",
21+
"main": "apps/example-app/src/main.ts",
22+
"polyfills": "apps/example-app/src/polyfills.ts",
23+
"tsConfig": "apps/example-app/tsconfig.app.json",
24+
"assets": ["apps/example-app/src/favicon.ico", "apps/example-app/src/assets"],
25+
"styles": ["apps/example-app/src/styles.css"],
2426
"scripts": []
2527
},
2628
"configurations": {
@@ -33,8 +35,8 @@
3335
],
3436
"fileReplacements": [
3537
{
36-
"replace": "apps/example-app/environments/environment.ts",
37-
"with": "apps/example-app/environments/environment.prod.ts"
38+
"replace": "apps/example-app/src/environments/environment.ts",
39+
"with": "apps/example-app/src/environments/environment.prod.ts"
3840
}
3941
],
4042
"optimization": true,
@@ -46,7 +48,8 @@
4648
"vendorChunk": false,
4749
"buildOptimizer": true
4850
}
49-
}
51+
},
52+
"outputs": ["{options.outputPath}"]
5053
},
5154
"serve": {
5255
"builder": "@angular-devkit/build-angular:dev-server",
@@ -66,19 +69,18 @@
6669
}
6770
},
6871
"lint": {
69-
"builder": "@angular-devkit/build-angular:tslint",
72+
"builder": "@nrwl/linter:eslint",
7073
"options": {
71-
"tsConfig": ["apps/example-app/tsconfig.json", "apps/example-app/tsconfig.spec.json"],
72-
"exclude": ["**/node_modules/**"]
74+
"lintFilePatterns": ["apps/example-app/src/**/*.ts", "apps/example-app/src/**/*.html"]
7375
}
7476
},
7577
"test": {
7678
"builder": "@nrwl/jest:jest",
7779
"options": {
7880
"jestConfig": "apps/example-app/jest.config.js",
79-
"tsConfig": "apps/example-app/tsconfig.spec.json",
80-
"setupFile": "apps/example-app/test-setup.ts"
81-
}
81+
"setupFile": "apps/example-app/src/test-setup.ts"
82+
},
83+
"outputs": ["coverage/"]
8284
}
8385
}
8486
},
@@ -102,10 +104,13 @@
102104
}
103105
},
104106
"lint": {
105-
"builder": "@angular-devkit/build-angular:tslint",
107+
"builder": "@nrwl/linter:eslint",
106108
"options": {
107-
"tsConfig": ["projects/testing-library/tsconfig.lib.json", "projects/testing-library/tsconfig.spec.json"],
108-
"exclude": ["**/node_modules/**"]
109+
"lintFilePatterns": [
110+
"projects/testing-library/src/**/*.ts",
111+
"projects/testing-library/src/**/*.html",
112+
"projects/testing-library/src/**/*.html"
113+
]
109114
}
110115
},
111116
"build": {
@@ -116,12 +121,6 @@
116121
{
117122
"command": "ng run testing-library:build-package"
118123
},
119-
{
120-
"command": "tsc -p ./projects/testing-library/migrations/tsconfig.migrations.json"
121-
},
122-
{
123-
"command": "cpy ./projects/testing-library/migrations/migration.json ./dist/@testing-library/angular/migrations"
124-
},
125124
{
126125
"command": "cpy ./README.md ./dist/@testing-library/angular"
127126
}
@@ -132,9 +131,9 @@
132131
"builder": "@nrwl/jest:jest",
133132
"options": {
134133
"jestConfig": "projects/testing-library/jest.config.js",
135-
"tsConfig": "projects/testing-library/tsconfig.spec.json",
136134
"setupFile": "projects/testing-library/test-setup.ts"
137-
}
135+
},
136+
"outputs": ["coverage/projects/testing-library"]
138137
}
139138
}
140139
},
@@ -158,10 +157,13 @@
158157
}
159158
},
160159
"lint": {
161-
"builder": "@angular-devkit/build-angular:tslint",
160+
"builder": "@nrwl/linter:eslint",
162161
"options": {
163-
"tsConfig": ["projects/jest-utils/tsconfig.lib.json", "projects/jest-utils/tsconfig.spec.json"],
164-
"exclude": ["**/node_modules/**"]
162+
"lintFilePatterns": [
163+
"projects/jest-utils/src/**/*.ts",
164+
"projects/jest-utils/src/**/*.html",
165+
"projects/jest-utils/src/**/*.html"
166+
]
165167
}
166168
},
167169
"build": {
@@ -179,15 +181,11 @@
179181
"builder": "@nrwl/jest:jest",
180182
"options": {
181183
"jestConfig": "projects/jest-utils/jest.config.js",
182-
"tsConfig": "projects/jest-utils/tsconfig.spec.json",
183184
"setupFile": "projects/jest-utils/test-setup.ts"
184-
}
185+
},
186+
"outputs": ["coverage/projects/jest-utils"]
185187
}
186188
}
187189
}
188-
},
189-
"defaultProject": "example-app",
190-
"cli": {
191-
"analytics": false
192190
}
193191
}

apps/example-app/.browserslistrc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2+
# For additional information regarding the format and rule options, please see:
3+
# https://github.com/browserslist/browserslist#queries
4+
5+
# For the full list of supported browsers by the Angular framework, please see:
6+
# https://angular.io/guide/browser-support
7+
8+
# You can see what browsers were selected by your queries by running:
9+
# npx browserslist
10+
11+
last 1 Chrome version
12+
last 1 Firefox version
13+
last 2 Edge major versions
14+
last 2 Safari major versions
15+
last 2 iOS major versions
16+
Firefox ESR
17+
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.

apps/example-app/.eslintrc.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"extends": ["../../.eslintrc.json"],
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts"],
7+
"extends": ["plugin:@nrwl/nx/angular", "plugin:@angular-eslint/template/process-inline-templates"],
8+
"parserOptions": {
9+
"project": ["apps/example-app/tsconfig.*?.json"]
10+
},
11+
"rules": {
12+
"@angular-eslint/directive-selector": [
13+
"error",
14+
{
15+
"type": "attribute",
16+
"prefix": "app",
17+
"style": "camelCase"
18+
}
19+
],
20+
"@angular-eslint/component-selector": [
21+
"error",
22+
{
23+
"type": "element",
24+
"prefix": "app",
25+
"style": "kebab-case"
26+
}
27+
]
28+
},
29+
"plugins": ["@angular-eslint/eslint-plugin", "@typescript-eslint"]
30+
},
31+
{
32+
"files": ["*.html"],
33+
"extends": ["plugin:@nrwl/nx/angular-template"],
34+
"rules": {}
35+
}
36+
]
37+
}

apps/example-app/jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ module.exports = {
55
color: 'blue',
66
},
77
preset: '../../jest.preset.js',
8+
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
89
};

0 commit comments

Comments
 (0)