angular-cn/aio/tools
dario-piotrowicz ca7d4c3403 refactor(docs-infra): migrate aio from tslint to eslint (#42820)
migrate aio to eslint as tslint has been deprecated, the migration is restricted to the aio app and
its e2e tests and does not include the other tools, for such reason both tslint and codelyzer have not
been removed (to be done in a next PR)

some minor tweaks needed to be applied to the code so that it would adhere to the new ESLinting behaviour

most TSLint rules have been substituted with their ESLint equivalent, with some exceptions:
  * [whitespace] does not have an ESLint equivalent (suggested to be handled by prettier)
  * [import-spacing] does not have an ESLint equivalent (suggested to be handled by prettier)
  * [ban] replaced with [no-restricted-syntax] as there is no (official/included) ESLint equivalent

some rules have minor different behaviours compared to their TSLint counterparts:
  * @typescript-eslint/naming-convention:
    - typescript-eslint does not enforce uppercase for const only.
  * @typescript-eslint/no-unused-expressions:
    - The TSLint optional config "allow-new" is the default ESLint behavior and will no longer be ignored.
  * arrow-body-style:
    - ESLint will throw an error if the function body is multiline yet has a one-line return on it.
  * eqeqeq:
    - Option "smart" allows for comparing two literal values, evaluating the value of typeof and null comparisons.
  * no-console:
    - Custom console methods, if they exist, will no longer be allowed.
  * no-invalid-this:
    - Functions in methods will no longer be ignored.
  * no-underscore-dangle:
    - Leading and trailing underscores (_) on identifiers will now be ignored.
  * prefer-arrow/prefer-arrow-functions:
    - ESLint does not support allowing standalone function declarations.
    - ESLint does not support allowing named functions defined with the function keyword.
  * space-before-function-paren:
    - Option "constructor" is not supported by ESLint.
    - Option "method" is not supported by ESLint.

additional notes:
  * the current typescript version used by the aio app is 4.3.5, which is not supported by typescript-eslint (the supported
    versions are >=3.3.1 and <4.3.0). this causes a warning message to appear during linting, this issue should
    likely/hopefully disappear in the future as typescript-eslint catches up
  * The new "no-console" rule is not completely equivalent to what we had prior the migration, this is because TSLint's "no-console"
    rule let you specify the methods you did not want to allow, whilst ESLint's "no-console" lets you specify the methods that you do
    want to allow, so and in order not to have a very long list of methods in the ESLint rule it's been decided for the time being
    to simply only allow the "log", "warn" and "error" methods
  * 4 dependencies have been added as they have been considered necessary (see: https://github.com/angular/angular/pull/42820#discussion_r669978232)

extra:
  * the migration has been performed by following: https://github.com/angular-eslint/angular-eslint#migrating-an-angular-cli-project-from-codelyzer-and-tslin
  * more on typescript-eslint at: https://github.com/typescript-eslint/typescript-eslint

PR Close #42820
2021-07-20 11:55:28 -07:00
..
cli-patches docs(docs-infra): apply the one-sentence-per-line rule to Markdown files in `aio/tools/` (#38992) 2020-09-30 09:20:00 -04:00
example-zipper docs(docs-infra): apply the one-sentence-per-line rule to Markdown files in `aio/tools/` (#38992) 2020-09-30 09:20:00 -04:00
examples test(docs-infra): allow excluding certain docs examples from tests (#42660) 2021-06-29 10:29:58 -07:00
firebase-test-utils test(docs-infra): ensure all redirect rules are tested (#42452) 2021-06-18 17:32:57 +00:00
ng-packages-installer build: correctly publish `angular-in-memory-web-api` as CI build artifact (#41429) 2021-04-06 10:22:54 -07:00
stackblitz-builder build(docs-infra): fixed i18n broken stackblitz example (#42001) 2021-05-10 16:11:34 -04:00
transforms refactor(docs-infra): migrate aio from tslint to eslint (#42820) 2021-07-20 11:55:28 -07:00
README.md build(docs-infra): add a tool to create new examples (#39283) 2020-10-16 08:14:38 -07:00
tslint.json refactor: remove tslint no-use-before-declare rule (#30288) 2019-05-07 10:25:36 -07:00

README.md

AIO project tooling

This document gives an overview of the tools that we use to generate the content for the angular.io website.

The application that actually renders this content can be found in the /aio/src folder. The handwritten content can be found in the /aio/content folder.

Each subfolder in this /aio/tools/ folder contains a self-contained tool and its configuration. There is a README.md file in each folder that describes the tool in more detail.

cli-patches

The AIO application is built using the Angular CLI tool. We are often trialling new features for the CLI, which we apply to the library after it is installed. This folder contains git patch files that contain these new features and a utility to apply those patches to the CLI library.

See the README.md for more details.

examples

Many of the documentation pages contain snippets of code examples. We extract these snippets from real working example applications, which are stored in subfolders of the /aio/content/examples folder. Each example can be built and run independently. Each example also provides e2e specs, which are run as part of our CI build tasks, to verify that the examples continue to work as expected, as changes are made to the core Angular libraries.

In order to build, run and test these examples independently we need to install dependencies into their sub-folder. Also there are a number of common boilerplate files that are needed to configure each example's project. We maintain these common boilerplate files centrally to reduce the amount of effort if one of them needs to change.

This examples tool folder contains three utilities:

  • example-boilerplate.js - install/remove the npm dependencies and boilerplate files into/from each of the examples' subfolders.
  • run-example-e2e.js - run the e2e tests for one or more examples
  • create-example.js - create a new example from the example-scaffold/ directory or by importing files from a CLI project.

See the README.md for more details.

example-zipper

In the AIO application, we offer the reader the option to download each example as a full self-contained runnable project packaged as a zip file. These zip files are generated by the utility in this folder.

See the README.md for more details.

stackblitz-builder

In the AIO application, we can embed a running version of the example as a Stackblitz session. We can also provide a link to create a runnable version of the example in the Stackblitz editor.

See the README.md for more details.

transforms

All the content that is rendered by the AIO application, and some of its configuration files, are generated from source files by Dgeni. Dgeni is a general purpose documentation generation tool.

Markdown files in /aio/content, code comments in the core Angular source files and example files are processed and transformed into files that are consumed by the AIO application.

Dgeni is configured by "packages", which contain services and processors. Some of these packages are installed as node_modules from the dgeni-packages and some are specific to the AIO project.

The project specific packages are stored in the aio/tools/transforms folder. See the README.md for more details.