Skip to content

chore: migrate tslint to eslint #199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nrwl/nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"parserOptions": {
"project": ["/tsconfig.*?.json"]
},
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"],
"rules": {}
},
{
"files": ["*.ts"],
"rules": {
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/naming-convention": "error",
"@typescript-eslint/no-shadow": [
"error",
{
"hoist": "all"
}
],
"@typescript-eslint/no-unused-expressions": "error",
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/quotes": ["error", "single"],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/no-explicit-any": "off",
"arrow-body-style": "error",
"brace-style": ["error", "1tbs"],
"curly": "error",
"eol-last": "error",
"eqeqeq": ["error", "smart"],
"guard-for-in": "error",
"id-blacklist": "off",
"id-match": "off",
"import/no-deprecated": "warn",
"no-bitwise": "error",
"no-caller": "error",
"no-console": [
"error",
{
"allow": [
"log",
"warn",
"dir",
"timeLog",
"assert",
"clear",
"count",
"countReset",
"group",
"groupEnd",
"table",
"dirxml",
"error",
"groupCollapsed",
"Console",
"profile",
"profileEnd",
"timeStamp",
"context"
]
}
],
"no-empty": "off",
"no-eval": "error",
"no-new-wrappers": "error",
"no-throw-literal": "error",
"no-undef-init": "error",
"no-underscore-dangle": "off",
"radix": "error",
"spaced-comment": [
"error",
"always",
{
"markers": ["/"]
}
]
},
"plugins": ["eslint-plugin-import", "@angular-eslint/eslint-plugin", "@typescript-eslint"]
},
{
"files": ["*.html"],
"rules": {}
}
]
}
53 changes: 53 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# NPM Files
package-lock.json
migrations.json

CHANGELOG.md

#Ignore specific file types
*.svg
*.xml
*.png
*.jpg

# compiled output
/dist
/tmp
/out-tsc
# dependencies
/node_modules

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/cSpell.json
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
testem.log
/typings
deployment.yaml

# e2e
/*e2e/*.js
/*e2e/*.map

# System Files
.DS_Store
Thumbs.db
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ describe('Counter', () => {
});
```

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

## Installation

Expand Down
76 changes: 37 additions & 39 deletions angular.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "",
"cli": {
"analytics": false
},
"defaultProject": "example-app",
"projects": {
"example-app": {
"root": "",
"sourceRoot": "apps/example-app",
"projectType": "application",
"root": "apps/example-app",
"sourceRoot": "apps/example-app/src",
"prefix": "app",
"schematics": {},
"architect": {
Expand All @@ -15,12 +17,12 @@
"options": {
"aot": true,
"outputPath": "dist/apps/example-app",
"index": "apps/example-app/index.html",
"main": "apps/example-app/main.ts",
"polyfills": "apps/example-app/polyfills.ts",
"tsConfig": "apps/example-app/tsconfig.json",
"assets": ["apps/example-app/favicon.ico", "apps/example-app/assets"],
"styles": ["apps/example-app/styles.css"],
"index": "apps/example-app/src/index.html",
"main": "apps/example-app/src/main.ts",
"polyfills": "apps/example-app/src/polyfills.ts",
"tsConfig": "apps/example-app/tsconfig.app.json",
"assets": ["apps/example-app/src/favicon.ico", "apps/example-app/src/assets"],
"styles": ["apps/example-app/src/styles.css"],
"scripts": []
},
"configurations": {
Expand All @@ -33,8 +35,8 @@
],
"fileReplacements": [
{
"replace": "apps/example-app/environments/environment.ts",
"with": "apps/example-app/environments/environment.prod.ts"
"replace": "apps/example-app/src/environments/environment.ts",
"with": "apps/example-app/src/environments/environment.prod.ts"
}
],
"optimization": true,
Expand All @@ -46,7 +48,8 @@
"vendorChunk": false,
"buildOptimizer": true
}
}
},
"outputs": ["{options.outputPath}"]
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
Expand All @@ -66,19 +69,18 @@
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"builder": "@nrwl/linter:eslint",
"options": {
"tsConfig": ["apps/example-app/tsconfig.json", "apps/example-app/tsconfig.spec.json"],
"exclude": ["**/node_modules/**"]
"lintFilePatterns": ["apps/example-app/src/**/*.ts", "apps/example-app/src/**/*.html"]
}
},
"test": {
"builder": "@nrwl/jest:jest",
"options": {
"jestConfig": "apps/example-app/jest.config.js",
"tsConfig": "apps/example-app/tsconfig.spec.json",
"setupFile": "apps/example-app/test-setup.ts"
}
"setupFile": "apps/example-app/src/test-setup.ts"
},
"outputs": ["coverage/"]
}
}
},
Expand All @@ -102,10 +104,13 @@
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"builder": "@nrwl/linter:eslint",
"options": {
"tsConfig": ["projects/testing-library/tsconfig.lib.json", "projects/testing-library/tsconfig.spec.json"],
"exclude": ["**/node_modules/**"]
"lintFilePatterns": [
"projects/testing-library/src/**/*.ts",
"projects/testing-library/src/**/*.html",
"projects/testing-library/src/**/*.html"
]
}
},
"build": {
Expand All @@ -116,12 +121,6 @@
{
"command": "ng run testing-library:build-package"
},
{
"command": "tsc -p ./projects/testing-library/migrations/tsconfig.migrations.json"
},
{
"command": "cpy ./projects/testing-library/migrations/migration.json ./dist/@testing-library/angular/migrations"
},
{
"command": "cpy ./README.md ./dist/@testing-library/angular"
}
Expand All @@ -132,9 +131,9 @@
"builder": "@nrwl/jest:jest",
"options": {
"jestConfig": "projects/testing-library/jest.config.js",
"tsConfig": "projects/testing-library/tsconfig.spec.json",
"setupFile": "projects/testing-library/test-setup.ts"
}
},
"outputs": ["coverage/projects/testing-library"]
}
}
},
Expand All @@ -158,10 +157,13 @@
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"builder": "@nrwl/linter:eslint",
"options": {
"tsConfig": ["projects/jest-utils/tsconfig.lib.json", "projects/jest-utils/tsconfig.spec.json"],
"exclude": ["**/node_modules/**"]
"lintFilePatterns": [
"projects/jest-utils/src/**/*.ts",
"projects/jest-utils/src/**/*.html",
"projects/jest-utils/src/**/*.html"
]
}
},
"build": {
Expand All @@ -179,15 +181,11 @@
"builder": "@nrwl/jest:jest",
"options": {
"jestConfig": "projects/jest-utils/jest.config.js",
"tsConfig": "projects/jest-utils/tsconfig.spec.json",
"setupFile": "projects/jest-utils/test-setup.ts"
}
},
"outputs": ["coverage/projects/jest-utils"]
}
}
}
},
"defaultProject": "example-app",
"cli": {
"analytics": false
}
}
17 changes: 17 additions & 0 deletions apps/example-app/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support

# You can see what browsers were selected by your queries by running:
# npx browserslist

last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.
37 changes: 37 additions & 0 deletions apps/example-app/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"extends": ["plugin:@nrwl/nx/angular", "plugin:@angular-eslint/template/process-inline-templates"],
"parserOptions": {
"project": ["apps/example-app/tsconfig.*?.json"]
},
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
]
},
"plugins": ["@angular-eslint/eslint-plugin", "@typescript-eslint"]
},
{
"files": ["*.html"],
"extends": ["plugin:@nrwl/nx/angular-template"],
"rules": {}
}
]
}
1 change: 1 addition & 0 deletions apps/example-app/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ module.exports = {
color: 'blue',
},
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
};
Loading