Reference configs

prettier/prettier: the plugin layout, without a build

Each of Prettier's eight language plugins needs two entry files, index.js and languages.evaluate.js; the build fails when one is missing. Two rules check the layout without building, and on the run all eight plugins were complete. This config was written to test alint; Prettier doesn't use alint.

What alint found

.alint.yml
- id: prettier-language-plugin-has-index
  kind: for_each_dir
  select: "src/language-*"
  require:
    - kind: file_exists
      paths: "{path}/index.js"
  level: error

- id: prettier-language-plugin-has-languages-evaluate
  kind: for_each_dir
  select: "src/language-*"
  require:
    - kind: file_exists
      paths: "{path}/languages.evaluate.js"
  level: error

✓ passed prettier-language-plugin-has-languages-evaluate

All 8 language plugins under src/language-*/ have both index.js and languages.evaluate.js.

The config

The config extends oss-baseline, node, ci/github-actions, hygiene/no-tracked-artifacts and tooling/editorconfig. Its own rules cover the plugin layout, most of what lint-changelog.js checks, the exact version pins check-deps.js checks in all five package.json files and the configs the lint scripts read. The lint tools run from command_idempotent rules.

.alint.yml
- id: prettier-deps-pinned
  kind: file_content_forbidden
  paths:
    include:
      - "package.json"
      - "website/package.json"
      - "scripts/release/package.json"
      - "scripts/tools/bundle-test/package.json"
      - "scripts/tools/eslint-plugin-prettier-internal-rules/package.json"
  pattern: '(?m)^\s*"[^"]+"\s*:\s*"[\^~][0-9]'
  level: error

check-deps.js rejects ^ and ~ ranges in five manifests. As a rule it's one pattern over the same five files.

.alint.yml
- id: prettier-changelog-pr-filenames
  kind: filename_regex
  paths:
    include: ["changelog_unreleased/*/*.md"]
  pattern: '^[0-9]{4,}(-[0-9]+)?\.md$'
  level: error

A changelog note is named after its pull request. This is one of the checks from lint-changelog.js; the rules for the #### title heading, the pull request link and leftover template text work the same way.

What stays outside alint

Tools that read code or words stay tools:

  • tsc, ESLint's nine internal rules and knip, which analyze code;
  • cspell, which checks spelling;
  • the rest of the changelog title check, which parses Markdown with remark.