Skip to content

Commit

Permalink
Fix a bunch more builds
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg committed Oct 2, 2023
1 parent 6062dca commit 63a7df4
Show file tree
Hide file tree
Showing 78 changed files with 2,206 additions and 2,494 deletions.
2 changes: 1 addition & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"badgeTemplate": "<img alt=\"All Contributors: <%= contributors.length %>\" src=\"https://img.shields.io/badge/all_contributors-<%= contributors.length %>-21bb42.svg\" />",
"badgeTemplate": "<img alt=\"All Contributors: <%= contributors.length %> 👪\" src=\"https://img.shields.io/badge/all_contributors-<%= contributors.length %>_👪-21bb42.svg\" />",
"commit": false,
"commitConvention": "angular",
"contributors": [
Expand Down
69 changes: 39 additions & 30 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
/*
👋 Hi! This ESLint configuration contains a lot more stuff than many repos'!
You can read from it to see all sorts of linting goodness, but don't worry -
it's not something you need to exhaustively understand immediately. 💙
If you're interested in learning more, see the 'getting started' docs on:
- ESLint: https://eslint.org
- typescript-eslint: https://typescript-eslint.io
*/

/** @type {import("@types/eslint").Linter.Config} */
module.exports = {
env: {
Expand All @@ -17,8 +7,9 @@ module.exports = {
extends: [
"eslint:recommended",
"plugin:eslint-comments/recommended",
"plugin:perfectionist/recommended-natural",
"plugin:regexp/recommended",
"prettier",
"plugin:vitest/recommended",
],
overrides: [
{
Expand All @@ -29,14 +20,20 @@ module.exports = {
{
extends: [
"plugin:jsdoc/recommended-typescript-error",
"plugin:@typescript-eslint/recommended",
"plugin:typescript-sort-keys/recommended",
"plugin:@typescript-eslint/strict",
"plugin:@typescript-eslint/stylistic",
],
files: ["**/*.ts"],
parser: "@typescript-eslint/parser",
rules: {
// These off-by-default rules work well for this repo and we like them on.
"jsdoc/informative-docs": "error",
"logical-assignment-operators": [
"error",
"always",
{ enforceForIfStatements: true },
],
"operator-assignment": "error",

// These on-by-default rules don't work well for this repo and we like them off.
"jsdoc/require-jsdoc": "off",
Expand All @@ -46,40 +43,48 @@ module.exports = {
},
},
{
excludedFiles: ["**/*.md/*.ts"],
extends: [
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@typescript-eslint/strict",
"plugin:@typescript-eslint/strict-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
],
excludedFiles: ["**/*.md/*.ts"],
files: ["**/*.ts"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./tsconfig.eslint.json",
},
rules: {
// TODO: Investigate turning these on
// These off-by-default rules work well for this repo and we like them on.
"deprecation/deprecation": "error",

// TODO
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-confusing-void-expression": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-redundant-type-constituents": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/unbound-method": "off",

// These off-by-default rules work well for this repo and we like them on.
"deprecation/deprecation": "error",
},
},
{
files: ["*.json", "*.jsonc"],
excludedFiles: ["package.json"],
extends: ["plugin:jsonc/recommended-with-json"],
files: ["*.json", "*.jsonc"],
parser: "jsonc-eslint-parser",
rules: {
"jsonc/sort-keys": "error",
},
extends: ["plugin:jsonc/recommended-with-json"],
},
{
files: ["*.jsonc"],
rules: {
"jsonc/no-comments": "off",
},
},
{
files: "**/*.test.ts",
Expand Down Expand Up @@ -116,33 +121,37 @@ module.exports = {
plugins: [
"@typescript-eslint",
"deprecation",
"import",
"jsdoc",
"no-only-tests",
"perfectionist",
"regexp",
"simple-import-sort",
"typescript-sort-keys",
"vitest",
],
reportUnusedDisableDirectives: true,
root: true,
rules: {
// These off/less-strict-by-default rules work well for this repo and we like them on.
"@typescript-eslint/no-unused-vars": ["error", { caughtErrors: "all" }],
"import/extensions": ["error", "ignorePackages"],
"no-only-tests/no-only-tests": "error",
"simple-import-sort/exports": "error",
"simple-import-sort/imports": "error",

// These on-by-default rules don't work well for this repo and we like them off.
"no-case-declarations": "off",
"no-constant-condition": "off",
"no-inner-declarations": "off",
"no-mixed-spaces-and-tabs": "off",

// Stylistic concerns that don't interfere with Prettier
curly: ["error", "all"],
"padding-line-between-statements": "off",
"@typescript-eslint/padding-line-between-statements": [
"error",
{ blankLine: "always", next: "*", prev: "block-like" },
],
"perfectionist/sort-objects": [
"error",
{
order: "asc",
"partition-by-comment": true,
type: "natural",
},
],
},
};
2 changes: 1 addition & 1 deletion .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ representative at an online or offline event.

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
npmjoshuakgoldberg.com.
git@joshuakgoldberg.com.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
Expand Down
20 changes: 17 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,24 @@ There are two steps involved:

### Finding an Issue

With the exception of very small typos, all changes to this repository generally need to correspond to an [open issue marked as `accepting prs` on the issue tracker](https://github.com/JoshuaKGoldberg/console-fail-test/issues?q=is%3Aopen+is%3Aissue+label%3A%22accepting+prs%22).
If this is your first time contributing, consider searching for [unassigned issues that also have the `good first issue` label](https://github.com/JoshuaKGoldberg/console-fail-test/issues?q=is%3Aopen+is%3Aissue+label%3A%22accepting+prs%22+label%3A%22good+first+issue%22+no%3Aassignee).
With the exception of very small typos, all changes to this repository generally need to correspond to an [unassigned open issue marked as `status: accepting prs` on the issue tracker](https://github.com/JoshuaKGoldberg/console-fail-test/issues?q=is%3Aissue+is%3Aopen+label%3A%22status%3A+accepting+prs%22+no%3Aassignee+).
If this is your first time contributing, consider searching for [unassigned issues that also have the `good first issue` label](https://github.com/JoshuaKGoldberg/console-fail-test/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22+label%3A%22status%3A+accepting+prs%22+no%3Aassignee+).
If the issue you'd like to fix isn't found on the issue, see [Reporting Issues](#reporting-issues) for filing your own (please do!).

#### Issue Claiming

We don't use any kind of issue claiming system.
We've found in the past that they result in accidental ["licked cookie"](https://devblogs.microsoft.com/oldnewthing/20091201-00/?p=15843) situations where contributors claim an issue but run out of time or energy trying before sending a PR.

If an unassigned issue has been marked as `status: accepting prs` and an open PR does not exist, feel free to send a PR.
Please don't post comments asking for permission or stating you will work on an issue.

### Sending a Pull Request

Once you've identified an open issue accepting PRs that doesn't yet have a PR sent, you're free to send a pull request.
Be sure to fill out the pull request template's requested information -- otherwise your PR will likely be closed.

PRs are also expected to have a title that adheres to [commitlint](https://github.com/conventional-changelog/commitlint).
PRs are also expected to have a title that adheres to [conventional commits](https://www.conventionalcommits.org/en/v1.0.0).
Only PR titles need to be in that format, not individual commits.
Don't worry if you get this wrong: you can always change the PR title after sending it.
Check [previously merged PRs](https://github.com/JoshuaKGoldberg/console-fail-test/pulls?q=is%3Apr+is%3Amerged+-label%3Adependencies+) for reference.
Expand Down Expand Up @@ -81,3 +89,9 @@ Once all feedback is addressed and the PR is approved, we'll ensure the branch i

Once your PR is merged, if you haven't yet been added to the [_Contributors_ table in the README.md](../README.md#contributors) for its [type of contribution](https://allcontributors.org/docs/en/emoji-key "Allcontributors emoji key"), you should be soon.
Please do ping the maintainer who merged your PR if that doesn't happen within 24 hours - it was likely an oversight on our end!

## Emojis & Appreciation

If you made it all the way to the end, bravo dear user, we love you.
Please include your favorite emoji in the bottom of your issues and PRs to signal to us that you did in fact read this file and are trying to conform to it as best as possible.
💖 is a good starter if you're not sure which to use.
47 changes: 32 additions & 15 deletions .github/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ pnpm install
## Building

Run [TypeScript](https://typescriptlang.org) locally to type check and build source files from `src/` into output files in `lib/`:
Run [**tsup**](https://tsup.egoist.dev) locally to build source files from `src/` into output files in `lib/`:

```shell
pnpm build --watch
pnpm build
```

You should also see suggestions from TypeScript in your editor.
Add `--watch` to run the builder in a watch mode that continuously cleans and recreates `lib/` as you save files:

```shell
pnpm build --watch
```

## Formatting

Expand All @@ -29,20 +33,30 @@ It should be applied automatically when you save files in VS Code or make a Git
To manually reformat all files, you can run:

```shell
pnpm format:write
pnpm format --write
```

## Linting

This package includes several forms of linting to enforce consistent code quality and styling.
Each should be shown in VS Code, and can be run manually on the command-line:

- `pnpm lint` ([ESLint](https://eslint.org) with [typescript-eslint](https://typescript-eslint.io)): Lints JavaScript and TypeScript source files
- `pnpm lint:knip` ([knip](https://github.com/webpro/knip)): Detects unused files, dependencies, and code exports
- `pnpm lint:md` ([Markdownlint](https://github.com/DavidAnson/markdownlint)): Checks Markdown source files
- `pnpm lint:package` ([npm-package-json-lint](https://npmpackagejsonlint.org/)): Lints the `package.json` file
- `pnpm lint:package-json` ([npm-package-json-lint](https://npmpackagejsonlint.org/)): Lints the `package.json` file
- `pnpm lint:packages` ([pnpm dedupe --check](https://pnpm.io/cli/dedupe)): Checks for unnecessarily duplicated packages in the `pnpm-lock.yml` file
- `pnpm lint:spelling` ([cspell](https://cspell.org)): Spell checks across all source files
- `pnpm lint` ([ESLint](https://eslint.org) with [typescript-eslint](https://typescript-eslint.io)): Lints JavaScript and TypeScript source files

Read the individual documentation for each linter to understand how it can be configured and used best.

For example, ESLint can be run with `--fix` to auto-fix some lint rule complaints:

```shell
pnpm run lint --fix
```

Note that you'll likely need to run `pnpm build` before `pnpm lint` so that lint rules which check the file system can pick up on any built files.

## Testing

Expand All @@ -59,23 +73,26 @@ Add the `--coverage` flag to compute test coverage and place reports in the `cov
pnpm run test --coverage
```

Note that [console-fail-test](https://github.com/JoshuaKGoldberg/console-fail-test) is enabled for all test runs.
Calls to `console.log`, `console.warn`, and other console methods will cause a test to fail.

### Debugging Tests

This repository includes a [VS Code launch configuration](https://code.visualstudio.com/docs/editor/debugging) for debugging unit tests.
To launch it, open a test file, then run _Debug Current Test File_ from the VS Code Debug panel (or press F5).

### Testing the Setup Script
## Type Checking

In addition to unit tests, this template also includes an "end-to-end" test for `script/setup.js`.
You can run it locally on the command-line:
You should be able to see suggestions from [TypeScript](https://typescriptlang.org) in your editor for all open files.

However, it can be useful to run the TypeScript command-line (`tsc`) to type check all files in `src/`:

```shell
pnpm run setup:test
pnpm tsc
```

That end-to-end test executes `script/setup-test-e2e.js`, which:

1. Runs the setup script using `--skip-api`
2. Checks that the local repository's files were changed correctly (e.g. removed setup-only files)
Add `--watch` to keep the type checker running in a watch mode that updates the display as you save files:

As with the setup script itself, end-to-end tests are removed on package setup.
```shell
pnpm tsc --watch
```
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/01-bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ body:
description: Report a bug trying to run the code
labels:
- "type: bug"
name: 🐛 Report a Bug
name: 🐛 Bug
title: "🐛 Bug: <short description of the bug>"
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/03-feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ body:
description: Request that a new feature be added or an existing feature improved
labels:
- "type: feature"
name: 🚀 Request a Feature
name: 🚀 Feature
title: "🚀 Feature: <short description of the feature>"
9 changes: 9 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Security Policy

We take all security vulnerabilities seriously.
If you have a vulnerability or other security issues to disclose:

- Thank you very much, please do!
- Please send them to us by emailing `[email protected]`

We appreciate your efforts and responsible disclosure and will make every effort to acknowledge your contributions.
4 changes: 2 additions & 2 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"automerge": true,
"internalChecksFilter": "strict",
"labels": ["dependencies"],
"postUpdateOptions": ["pnpmDedupe"],
"stabilityDays": 3
"minimumReleaseAge": "3 days",
"postUpdateOptions": ["pnpmDedupe"]
}
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: pnpm build
- run: node ./lib/index.js

name: Build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ jobs:
contributors:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/prepare
- env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
uses: JoshuaKGoldberg/[email protected].0
uses: JoshuaKGoldberg/[email protected].2

name: Contributors

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lint-knip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ jobs:
lint_knip:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: pnpm build || true
- run: pnpm lint:knip

name: Lint Knip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-markdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ jobs:
lint_markdown:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: pnpm lint:md

Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/lint-package-json.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
jobs:
lint_package_json:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prepare
- run: pnpm lint:package-json

name: Lint Package JSON

on:
pull_request: ~
push:
branches:
- main
Loading

0 comments on commit 63a7df4

Please sign in to comment.