angular компиляция не выдает html ошибок - PullRequest
1 голос
/ 04 февраля 2020

Я специально изменил имя функции с toggleMenu () на toggleMen (). Эта новая функция не существует.

<button (click)="toggleMen()"></button>

Когда я компилирую свой проект (по команде npm start), он не выводит мне никаких ошибок или предупреждений. Он просто успешно завершил компиляцию sh. Я хочу, чтобы он остановил меня и потерпел неудачу во время компиляции из-за этой несуществующей функции toggleMen ().

Вот мой файл angular. json.

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "dist": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "build/dist",
            "index": "src/index.html",
            "main": "src/main.ts",
            "tsConfig": "tsconfig.app.json",
            "polyfills": "src/polyfills.ts",
            "stylePreprocessorOptions": {
              "includePaths": ["node_modules"]
            },
            "assets": [
              "src/assets",
              "src/favicon-96x96.png",
              "src/app.config.json",
              {
                "glob": "**/*",
                "input": "resources",
                "output": "/resources"
              },
              {
                "glob": "**/*",
                "input": "node_modules/@alfresco/adf-core/prebuilt-themes",
                "output": "/assets/prebuilt-themes"
              },
              {
                "glob": "**/*",
                "input": "node_modules/@alfresco/adf-core/bundles/assets",
                "output": "/assets"
              },
              {
                "glob": "**/*",
                "input": "node_modules/@alfresco/adf-content-services/bundles/assets",
                "output": "/assets"
              },
              {
                "glob": "pdf.worker.js",
                "input": "node_modules/pdfjs-dist/build",
                "output": "/"
              },
              {
                "glob": "pdf.worker.min.js",
                "input": "node_modules/pdfjs-dist/build",
                "output": "/"
              }
            ],
            "styles": ["src/custom-style.scss"],
            "scripts": [
              "node_modules/pdfjs-dist/build/pdf.js",
              "node_modules/pdfjs-dist/web/pdf_viewer.js",
              "node_modules/raphael/raphael.min.js",
              "node_modules/moment/min/moment.min.js"
            ]
          },
          "configurations": {
            "production": {
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "dist:build",
            "port": 4200,
            "proxyConfig": "proxy.conf.js"
          },
          "configurations": {
            "production": {
              "browserTarget": "dist:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "dist:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "karmaConfig": "./karma.conf.js",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.spec.json",
            "scripts": [
              "node_modules/pdfjs-dist/build/pdf.js",
              "node_modules/pdfjs-dist/web/pdf_viewer.js",
              "node_modules/raphael/raphael.min.js",
              "node_modules/moment/min/moment.min.js"
            ],
            "styles": ["src/custom-style.scss"],
            "assets": [
              "src/assets",
              "src/favicon-96x96.png",
              "src/app.config.json",
              {
                "glob": "**/*",
                "input": "resources",
                "output": "/resources"
              },
              {
                "glob": "**/*",
                "input": "node_modules/@alfresco/adf-core/prebuilt-themes",
                "output": "/assets/prebuilt-themes"
              },
              {
                "glob": "**/*",
                "input": "node_modules/@alfresco/adf-core/bundles/assets",
                "output": "/assets"
              },
              {
                "glob": "**/*",
                "input": "node_modules/@alfresco/adf-content-services/bundles/assets",
                "output": "/assets"
              },
              {
                "glob": "pdf.worker.js",
                "input": "node_modules/pdfjs-dist/build",
                "output": "/"
              }
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": ["tsconfig.app.json", "tsconfig.spec.json"],
            "exclude": []
          }
        }
      }
    }
  },
  "defaultProject": "dist",
  "schematics": {
    "@schematics/angular:component": {
      "prefix": "app",
      "styleext": "scss"
    },
    "@schematics/angular:directive": {
      "prefix": "app"
    }
  }
}

Вот мой файл tsconfig. json.

{
  "compilerOptions": {
    "allowJs": true,
    "baseUrl": "src",
    "jsx": "preserve",
    "lib": ["es2018", "dom"],
    "module": "ESNext",
    "moduleResolution": "node",
    "outDir": "build/tsc",
    "sourceMap": true,
    "target": "es5",
    "typeRoots": ["node_modules/@types"],

    "allowSyntheticDefaultImports": true,
    "declaration": false,
    "downlevelIteration": true,
    "emitDecoratorMetadata": true,
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "forceConsistentCasingInFileNames": true,
    "importHelpers": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noImplicitAny": true,
    "noUnusedLocals": true,
    "resolveJsonModule": true,
    "skipLibCheck": true,
    "strict": false,
    "strictNullChecks": true,
    "suppressImplicitAnyIndexErrors": true
  },
  "exclude": [
    "./build",
    "./config",
    "node_modules",
    "**/*.spec.ts"
  ],
  "include": [
    "./src"
  ],
  "angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true
  }
}

Вот мой пакет. json файл.

{
  "name": "myProject",
  "version": "1.0.0",
  "blueprint": "Content Services",
  "description": "ADF Application with Angular CLI",
  "license": "LGPL-3.0",
  "scripts": {
    "ng": "ng",
    "start": "tslint --project tsconfig.json && npm run validate-config && ng serve --open --port 4200",
    "start-production": "tslint --project tsconfig.json && npm run validate-config && ng serve --configuration=production --open",
    "compodoc": "npx compodoc -p tsconfig.app.json",
    "build": "tslint --project tsconfig.json && ng build",
    "build:prod": "tslint --project tsconfig.json && ng build --prod",
    "postbuild:prod": "ts-node --skip-project config/postbuild.ts",
    "test": "ng test",
    "tslint": "tslint --project tsconfig.json --fix",
    "prettier": "prettier --write \"**/*.ts\"",
    "validate-config": "ajv validate -s node_modules/@alfresco/adf-core/app.config.schema.json -d ./src/app.config.json --errors=text --verbose",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@alfresco/adf-content-services": "3.6.0",
    "@alfresco/adf-core": "3.6.0",
    "@alfresco/adf-extensions": "3.6.0",
    "@alfresco/adf-process-services": "3.6.0",
    "@alfresco/js-api": "3.6.0",
    "@angular/animations": "8.2.14",
    "@angular/cdk": "8.2.3",
    "@angular/common": "8.2.14",
    "@angular/compiler": "8.2.14",
    "@angular/core": "8.2.14",
    "@angular/flex-layout": "8.0.0-beta.27",
    "@angular/forms": "8.2.14",
    "@angular/http": "7.2.16",
    "@angular/material": "8.2.3",
    "@angular/material-moment-adapter": "8.2.3",
    "@angular/platform-browser": "8.2.14",
    "@angular/platform-browser-dynamic": "8.2.14",
    "@angular/router": "8.2.14",
    "@ckeditor/ckeditor5-angular": "^1.1.2",
    "@ckeditor/ckeditor5-build-classic": "^16.0.0",
    "@mat-datetimepicker/core": "2.0.1",
    "@mat-datetimepicker/moment": "2.0.1",
    "@ngrx/effects": "8.6.0",
    "@ngrx/router-store": "8.6.0",
    "@ngrx/store": "8.6.0",
    "@ngrx/store-devtools": "8.6.0",
    "@ngx-translate/core": "11.0.1",
    "ajv": "6.10.2",
    "classlist.js": "1.1.20150312",
    "custom-event-polyfill": "1.0.7",
    "hammerjs": "2.0.8",
    "minimatch-browser": "1.0.0",
    "moment": "2.24.0",
    "moment-es6": "1.0.0",
    "ngrx-store-localstorage": "8.0.0",
    "ngx-tinymce": "7.0.0",
    "pdfjs-dist": "2.2.228",
    "raphael": "2.3.0",
    "rxjs": "6.5.4",
    "systemjs": "6.1.9",
    "xml-js": "1.6.11",
    "zone.js": "0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "0.803.23",
    "@angular-devkit/build-ng-packagr": "0.803.23",
    "@angular/cli": "8.3.23",
    "@angular/compiler-cli": "8.2.14",
    "@compodoc/compodoc": "1.1.11",
    "@types/hammerjs": "2.0.36",
    "@types/jasmine": "3.5.0",
    "@types/jasminewd2": "2.0.8",
    "@types/node": "13.1.7",
    "ajv-cli": "3.0.0",
    "angular2-template-loader": "0.6.2",
    "astrolabe": "0.3.6",
    "autoprefixer": "9.7.4",
    "bundlesize": "0.18.0",
    "chalk": "3.0.0",
    "codelyzer": "5.2.1",
    "commander": "4.1.0",
    "concurrently": "5.0.2",
    "connect-history-api-fallback": "1.6.0",
    "core-js": "3.6.4",
    "ejs": "3.0.1",
    "extract-text-webpack-plugin": "3.0.2",
    "fs-extra": "8.1.0",
    "http-proxy-middleware": "0.20.0",
    "husky": "4.0.10",
    "jasmine-ajax": "4.0.0",
    "jasmine-core": "3.5.0",
    "jasmine-reporters": "2.3.2",
    "jasmine-spec-reporter": "4.2.1",
    "jasmine2-protractor-utils": "1.3.0",
    "js-yaml": "3.13.1",
    "karma": "4.4.1",
    "karma-chrome-launcher": "3.1.0",
    "karma-cli": "2.0.0",
    "karma-coverage": "2.0.1",
    "karma-coverage-istanbul-reporter": "2.1.1",
    "karma-jasmine": "2.0.1",
    "karma-jasmine-ajax": "0.1.13",
    "karma-jasmine-html-reporter": "1.5.1",
    "karma-mocha-reporter": "2.2.5",
    "karma-remap-istanbul": "0.6.0",
    "karma-systemjs": "0.16.0",
    "license-checker": "25.0.1",
    "lite-server": "2.5.4",
    "markdown-toc": "1.2.0",
    "markdownlint-cli": "0.21.0",
    "mdast-util-compact": "2.0.0",
    "mdast-util-heading-range": "2.1.3",
    "mdast-util-toc": "5.0.1",
    "mdast-zone": "3.0.4",
    "merge-stream": "2.0.0",
    "nconf": "0.10.0",
    "ncp": "2.0.0",
    "ng-packagr": "5.7.1",
    "protractor": "5.4.2",
    "protractor-html-reporter-2": "1.0.4",
    "raw-loader": "4.0.0",
    "remap-istanbul": "0.13.0",
    "remark": "11.0.2",
    "remark-frontmatter": "1.3.2",
    "rimraf": "3.0.0",
    "run-sequence": "2.2.1",
    "rxjs-tslint-rules": "4.28.0",
    "sass-loader": "7.1.0",
    "scss-bundle": "3.0.2",
    "stylelint": "12.0.1",
    "systemjs-builder": "0.16.15",
    "ts-node": "8.6.2",
    "tsickle": "0.38.0",
    "tslib": "1.10.0",
    "tslint": "5.20.1",
    "tslint-config-prettier": "1.18.0",
    "typedoc": "0.16.6",
    "typescript": "3.5.3",
    "unist-util-select": "3.0.0",
    "url-join": "4.0.1",
    "webpack": "4.41.5",
    "webpack-bundle-analyzer": "3.6.0",
    "webpack-cli": "3.3.10",
    "webpack-merge": "4.2.2"
  },
  "lint-staged": {
    "*.{ts,js,css,scss,html}": [
      "prettier --single-quote --write"
    ]
  },
  "pre-commit": "lint:staged"
}

Вы знаете, что изменить или добавить в сделать компилятор внимательным для angular HTML функций?

Спасибо за чтение. Я ценю каждый ответ. Хорошего дня.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...