Skip to content
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

Angular 13 and all JS deps #186

Merged
merged 3 commits into from
Mar 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
70 changes: 70 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"root": true,
"overrides": [
{
"files": ["*.ts"],
"parserOptions": {
"project": ["tsconfig.json"],
"createDefaultProgram": true
},
"extends": [
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
],
"@typescript-eslint/ban-types": "error",
"@typescript-eslint/explicit-function-return-type": [
"error",
{
"allowExpressions": true
}
],
"@typescript-eslint/explicit-member-accessibility": "error",
"@typescript-eslint/explicit-module-boundary-types": [
"error",
{
"allowArgumentsExplicitlyTypedAsAny": true
}
],
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/prefer-for-of": "error",
"no-restricted-globals": [
"error",
"atob",
"bota",
"document",
"event",
"history",
"length",
"localStorage",
"location",
"name",
"navigator",
"sessionStorage",
"window"
]
}
},
{
"files": ["*.html"],
"extends": ["plugin:@angular-eslint/template/recommended"],
"rules": {}
}
]
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ speed-measure-plugin*.json
.history/*

# misc
/.angular/cache
/.sass-cache
/connect.lock
/coverage
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/.angular
/dist
26 changes: 12 additions & 14 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,9 @@
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"builder": "@angular-eslint/builder:lint",
"options": {
"tsConfig": ["tsconfig.app.json", "tsconfig.spec.json", "e2e/tsconfig.json"],
"exclude": ["**/node_modules/**"]
"lintFilePatterns": ["src/**/*.ts", "src/**/*.html"]
}
}
}
Expand All @@ -122,7 +121,8 @@
"development": {
"tsConfig": "projects/natural/tsconfig.lib.json"
}
}
},
"defaultConfiguration": "production"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
Expand All @@ -133,10 +133,9 @@
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"builder": "@angular-eslint/builder:lint",
"options": {
"tsConfig": ["projects/natural/tsconfig.lib.json", "projects/natural/tsconfig.spec.json"],
"exclude": ["**/node_modules/**"]
"lintFilePatterns": ["projects/natural/**/*.ts", "projects/natural/**/*.html"]
}
}
}
Expand Down Expand Up @@ -171,17 +170,16 @@
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"builder": "@angular-eslint/builder:lint",
"options": {
"tsConfig": [
"projects/natural-editor/tsconfig.lib.json",
"projects/natural-editor/tsconfig.spec.json"
],
"exclude": ["**/node_modules/**"]
"lintFilePatterns": ["projects/natural-editor/**/*.ts", "projects/natural-editor/**/*.html"]
}
}
}
}
},
"defaultProject": "demo"
"defaultProject": "demo",
"cli": {
"defaultCollection": "@angular-eslint/schematics"
}
}
2 changes: 1 addition & 1 deletion e2e/src/app.po.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Page} from '@playwright/test';

export class AppPage {
constructor(private readonly page: Page) {}
public constructor(private readonly page: Page) {}

public getTitleText(): Promise<string> {
return this.page.innerText('app-root h1');
Expand Down
84 changes: 45 additions & 39 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,26 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^12.2.9",
"@angular/cdk": "^12.2.9",
"@angular/common": "^12.2.9",
"@angular/compiler": "^12.2.9",
"@angular/core": "^12.2.9",
"@angular/flex-layout": "^12.0.0-beta.35",
"@angular/forms": "^12.2.9",
"@angular/localize": "^12.2.9",
"@angular/material": "^12.2.9",
"@angular/platform-browser": "^12.2.9",
"@angular/platform-browser-dynamic": "^12.2.9",
"@angular/router": "^12.2.9",
"@apollo/client": "^3.4.16",
"@graphql-tools/mock": "^8.4.0",
"apollo-angular": "^2.6.0",
"graphql": "^15.6.1",
"@angular/animations": "^13.2.5",
"@angular/cdk": "^13.2.5",
"@angular/common": "^13.2.5",
"@angular/compiler": "^13.2.5",
"@angular/core": "^13.2.5",
"@angular/flex-layout": "^13.0.0-beta.38",
"@angular/forms": "^13.2.5",
"@angular/localize": "^13.2.5",
"@angular/material": "^13.2.5",
"@angular/platform-browser": "^13.2.5",
"@angular/platform-browser-dynamic": "^13.2.5",
"@angular/router": "^13.2.5",
"@apollo/client": "^3.5.10",
"@graphql-tools/mock": "^8.5.2",
"apollo-angular": "^3.0.0",
"graphql": "^16.3.0",
"lodash-es": "^4.17.21",
"prosemirror-commands": "^1.1.12",
"prosemirror-commands": "^1.2.1",
"prosemirror-dropcursor": "^1.4.0",
"prosemirror-gapcursor": "^1.2.1",
"prosemirror-gapcursor": "^1.2.2",
"prosemirror-history": "^1.2.0",
"prosemirror-inputrules": "^1.1.3",
"prosemirror-keymap": "^1.1.5",
Expand All @@ -49,21 +49,26 @@
"prosemirror-schema-list": "^1.1.6",
"prosemirror-state": "^1.3.4",
"prosemirror-tables": "^1.1.1",
"prosemirror-view": "^1.23.5",
"rxjs": "^7.4.0",
"ts-md5": "^1.2.9",
"prosemirror-view": "^1.23.7",
"rxjs": "^7.5.4",
"ts-md5": "^1.2.11",
"tslib": "^2.3.1",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^12.2.9",
"@angular/cli": "^12.2.9",
"@angular/compiler-cli": "^12.2.9",
"@angular/language-service": "^12.2.9",
"@playwright/test": "^1.17.1",
"@types/jasmine": "~3.9.1",
"@angular-devkit/build-angular": "^13.2.5",
"@angular-eslint/builder": "13.1.0",
"@angular-eslint/eslint-plugin": "13.1.0",
"@angular-eslint/eslint-plugin-template": "13.1.0",
"@angular-eslint/schematics": "13.1.0",
"@angular-eslint/template-parser": "13.1.0",
"@angular/cli": "^13.2.5",
"@angular/compiler-cli": "^13.2.5",
"@angular/language-service": "^13.2.5",
"@playwright/test": "^1.19.2",
"@types/jasmine": "~3.10.3",
"@types/jasminewd2": "^2.0.10",
"@types/lodash-es": "^4.17.5",
"@types/lodash-es": "^4.17.6",
"@types/node": "^14.14.28",
"@types/prosemirror-commands": "^1.0.4",
"@types/prosemirror-dropcursor": "^1.0.3",
Expand All @@ -72,23 +77,24 @@
"@types/prosemirror-inputrules": "^1.0.4",
"@types/prosemirror-keymap": "^1.0.4",
"@types/prosemirror-menu": "^1.0.6",
"@types/prosemirror-model": "^1.13.2",
"@types/prosemirror-model": "^1.16.1",
"@types/prosemirror-schema-basic": "^1.0.2",
"@types/prosemirror-schema-list": "^1.0.3",
"@types/prosemirror-state": "^1.2.7",
"@types/prosemirror-view": "^1.19.1",
"codelyzer": "^6.0.2",
"jasmine-core": "~3.9.0",
"@types/prosemirror-view": "^1.23.1",
"@typescript-eslint/eslint-plugin": "5.13.0",
"@typescript-eslint/parser": "5.13.0",
"eslint": "^8.2.0",
"jasmine-core": "~4.0.1",
"jasmine-spec-reporter": "~7.0.0",
"karma": "~6.3.4",
"karma": "~6.3.17",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "^2.1.0",
"karma-coverage": "^2.2.0",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.7.0",
"ng-packagr": "^12.2.2",
"prettier": "2.4.1",
"ts-node": "^10.2.1",
"tslint": "~6.1.0",
"typescript": "~4.3.5"
"ng-packagr": "^13.2.1",
"prettier": "2.5.1",
"ts-node": "^10.6.0",
"typescript": "~4.5.5"
}
}
25 changes: 25 additions & 0 deletions projects/natural-editor/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"overrides": [
{
"files": ["*.ts"],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "natural",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "natural",
"style": "kebab-case"
}
]
}
}
]
}
12 changes: 1 addition & 11 deletions projects/natural-editor/ng-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,7 @@
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/natural-editor",
"lib": {
"entryFile": "src/public-api.ts",
"umdModuleIds": {
"prosemirror-view": "prosemirror-view",
"prosemirror-state": "prosemirror-state",
"prosemirror-example-setup": "prosemirror-example-setup",
"prosemirror-model": "prosemirror-model",
"prosemirror-schema-basic": "prosemirror-schema-basic",
"prosemirror-schema-list": "prosemirror-schema-list",
"prosemirror-menu": "prosemirror-menu",
"prosemirror-commands": "prosemirror-commands"
}
"entryFile": "src/public-api.ts"
},
"assets": ["./**/*.theme.scss"],
"allowedNonPeerDependencies": [
Expand Down
9 changes: 7 additions & 2 deletions projects/natural-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
"license": "MIT",
"repository": "github:Ecodev/natural",
"sideEffects": false,
"exports": {
".": {
"sass": "./theming/_natural-editor.theme.scss"
}
},
"dependencies": {
"@types/prosemirror-commands": "^1.0.4",
"@types/prosemirror-dropcursor": "^1.0.3",
Expand Down Expand Up @@ -33,8 +38,8 @@
"tslib": "^2.3.0"
},
"peerDependencies": {
"@angular/common": "^12.2.0",
"@angular/core": "^12.2.0",
"@angular/common": "^13.2.0",
"@angular/core": "^13.2.0",
"@ecodev/natural": ">40.0"
}
}
2 changes: 1 addition & 1 deletion projects/natural-editor/src/lib/editor/_editor.theme.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@use 'sass:map';
@use '~@angular/material' as mat;
@use '@angular/material' as mat;

@mixin natural-editor($theme) {
$primary: map.get($theme, primary);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const IMAGE_UPLOADER = new InjectionToken<ImageUploader | null>('Image uploader
class TestHostComponent {
public myValue = '';

constructor(@Inject(IMAGE_UPLOADER) public readonly imageUploader: ImageUploader | null) {}
public constructor(@Inject(IMAGE_UPLOADER) public readonly imageUploader: ImageUploader | null) {}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion projects/natural-editor/src/lib/editor/editor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class NaturalEditorComponent implements OnInit, OnDestroy, ControlValueAc
*/
@Output() public readonly save = new EventEmitter<void>();

constructor(
public constructor(
@Optional() @Self() public readonly ngControl: NgControl,
@Inject(DOCUMENT) private readonly document: Document,
private readonly dialog: MatDialog,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class LinkDialogComponent {
title: this.titleControl,
});

constructor(
public constructor(
@Inject(MAT_DIALOG_DATA) data: LinkDialogData,
private dialogRef: MatDialogRef<LinkDialogComponent, LinkDialogData>,
) {
Expand Down
4 changes: 2 additions & 2 deletions projects/natural-editor/src/lib/utils/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type ImageUploader = (file: File) => Observable<string>;
export class ImagePlugin {
public readonly plugin: Plugin<DecorationSet>;

constructor(@Inject(DOCUMENT) private readonly document: Document) {
public constructor(@Inject(DOCUMENT) private readonly document: Document) {
this.plugin = new Plugin<DecorationSet>({
state: {
init(): DecorationSet {
Expand Down Expand Up @@ -42,7 +42,7 @@ export class ImagePlugin {
});
}

private findPlaceholder(state: EditorState, id: {}): number | null {
private findPlaceholder(state: EditorState, id: Record<string, never>): number | null {
const decorators = this.plugin.getState(state);
const found = decorators.find(undefined, undefined, spec => spec.id === id);
return found.length ? found[0].from : null;
Expand Down
2 changes: 1 addition & 1 deletion projects/natural-editor/src/lib/utils/item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class Item {
*/
public show = true;

constructor(public readonly spec: MenuItemSpec) {}
public constructor(public readonly spec: MenuItemSpec) {}

/**
* Update the item state according to the editor state
Expand Down
Loading