mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-16 10:01:59 +08:00
style(angular-server): add eslint and prettier (#24126)
This commit is contained in:
1
packages/angular-server/.eslintignore
Normal file
1
packages/angular-server/.eslintignore
Normal file
@ -0,0 +1 @@
|
||||
dist
|
19
packages/angular-server/.eslintrc.json
Normal file
19
packages/angular-server/.eslintrc.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"root": true,
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*.ts"],
|
||||
"parserOptions": {
|
||||
"project": ["tsconfig.json"],
|
||||
"createDefaultProgram": true
|
||||
},
|
||||
"extends": [
|
||||
"@ionic/eslint-config/recommended"
|
||||
],
|
||||
"rules": {
|
||||
"@typescript-eslint/consistent-type-imports": "off",
|
||||
"@angular-eslint/component-class-suffix": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
1
packages/angular-server/.prettierignore
Normal file
1
packages/angular-server/.prettierignore
Normal file
@ -0,0 +1 @@
|
||||
dist
|
27097
packages/angular-server/package-lock.json
generated
27097
packages/angular-server/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -25,9 +25,10 @@
|
||||
"build": "ng-packagr -p package.json -c tsconfig.json",
|
||||
"build.prod": "npm run clean && npm run build",
|
||||
"clean": "rm -rf ./dist",
|
||||
"lint": "echo linter disabled temporarily",
|
||||
"lint.ts": "tslint --project .",
|
||||
"lint.fix": "tslint --project . --fix"
|
||||
"lint": "eslint . --ext .ts && npm run prettier",
|
||||
"lint.fix": "eslint . --ext .ts --fix && npm run prettier.fix",
|
||||
"prettier": "prettier \"**/*.ts\" --check",
|
||||
"prettier.fix": "prettier \"**/*.ts\" --write"
|
||||
},
|
||||
"ngPackage": {
|
||||
"lib": {
|
||||
@ -42,6 +43,7 @@
|
||||
"zone.js": ">=0.11.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-eslint/eslint-plugin": "^12.6.1",
|
||||
"@angular/animations": "^12.0.0",
|
||||
"@angular/common": "^12.0.0",
|
||||
"@angular/compiler": "^12.0.0",
|
||||
@ -51,7 +53,14 @@
|
||||
"@angular/platform-browser-dynamic": "^12.2.10",
|
||||
"@angular/platform-server": "^12.0.0",
|
||||
"@ionic/core": "6.0.0-rc.1",
|
||||
"@ionic/eslint-config": "^0.3.0",
|
||||
"@ionic/prettier-config": "^2.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.2.0",
|
||||
"eslint": "^8.1.0",
|
||||
"eslint-plugin-import": "^2.25.2",
|
||||
"ng-packagr": "^12.0.0",
|
||||
"prettier": "^2.4.1",
|
||||
"typescript": "4.2.4"
|
||||
}
|
||||
},
|
||||
"prettier": "@ionic/prettier-config"
|
||||
}
|
||||
|
@ -10,15 +10,15 @@ import { hydrateDocument } from '@ionic/core/hydrate';
|
||||
provide: BEFORE_APP_SERIALIZED,
|
||||
useFactory: hydrateIonicComponents,
|
||||
multi: true,
|
||||
deps: [DOCUMENT, APP_ID]
|
||||
}
|
||||
]
|
||||
deps: [DOCUMENT, APP_ID],
|
||||
},
|
||||
],
|
||||
})
|
||||
export class IonicServerModule {}
|
||||
|
||||
// @dynamic
|
||||
// tslint:disable-next-line: only-arrow-functions
|
||||
export function hydrateIonicComponents(doc: any, appId: any) {
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
return () => {
|
||||
return hydrateDocument(doc, {
|
||||
clientHydrateAnnotations: false,
|
||||
@ -46,11 +46,10 @@ export function hydrateIonicComponents(doc: any, appId: any) {
|
||||
|
||||
// auxiliar
|
||||
'ion-picker-column',
|
||||
'ion-virtual-scroll'
|
||||
]
|
||||
})
|
||||
.then(hydrateResults => {
|
||||
hydrateResults.diagnostics.forEach(d => {
|
||||
'ion-virtual-scroll',
|
||||
],
|
||||
}).then((hydrateResults) => {
|
||||
hydrateResults.diagnostics.forEach((d) => {
|
||||
if (d.type === 'error') {
|
||||
console.error(d.messageText);
|
||||
} else if (d.type === 'debug') {
|
||||
@ -62,6 +61,7 @@ export function hydrateIonicComponents(doc: any, appId: any) {
|
||||
|
||||
if (doc.head != null) {
|
||||
const styleElms = doc.head.querySelectorAll('style[data-styles]') as NodeListOf<HTMLStyleElement>;
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
||||
for (let i = 0; i < styleElms.length; i++) {
|
||||
styleElms[i].setAttribute('ng-transition', appId);
|
||||
}
|
||||
@ -69,6 +69,7 @@ export function hydrateIonicComponents(doc: any, appId: any) {
|
||||
|
||||
if (doc.body != null) {
|
||||
const ionPages = doc.body.querySelectorAll('.ion-page.ion-page-invisible') as NodeListOf<HTMLElement>;
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
||||
for (let i = 0; i < ionPages.length; i++) {
|
||||
ionPages[i].classList.remove('ion-page-invisible');
|
||||
}
|
||||
|
@ -1,24 +0,0 @@
|
||||
{
|
||||
"extends": ["tslint-ionic-rules/strict"],
|
||||
"linterOptions": {
|
||||
"exclude": [
|
||||
"**/*.spec.ts",
|
||||
"**/*.spec.tsx"
|
||||
]
|
||||
},
|
||||
"rules": {
|
||||
"no-conditional-assignment": false,
|
||||
"no-non-null-assertion": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-import-side-effect": false,
|
||||
"trailing-comma": false,
|
||||
"no-null-keyword": false,
|
||||
"no-console": false,
|
||||
"no-unbound-method": true,
|
||||
"no-floating-promises": false,
|
||||
"no-invalid-template-strings": true,
|
||||
"ban-export-const-enum": true,
|
||||
"only-arrow-functions": true,
|
||||
"prefer-for-of": false
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user