Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3 new configurations added: /bun, /jsdoc, and /jsdoc-typescript #16

Merged
merged 23 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions .github/workflows/publishWorkflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,18 @@ jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: CPU Details
run: lscpu
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: oven-sh/setup-bun@v2
with:
node-version: "20.10.0"
registry-url: https://registry.npmjs.org
- id: super-cache
uses: mangs/super-cache-action@v3
- if: steps.super-cache.outputs.cache-hit != 'true'
run: npm ci

# Task execution
- uses: mangs/simple-release-notes-action@v2
bun-version: "1.1.17"
- uses: mangs/simple-release-notes-action@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_USER_ACCESS_TOKEN }}
should_auto_update_major_tag: false
- uses: JS-DevTools/npm-publish@v3
with:
access: public
registry: https://registry.npmjs.org/
token: ${{ secrets.NPM_USER_ACCESS_TOKEN }}
22 changes: 9 additions & 13 deletions .github/workflows/pullRequestWorkflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@ jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: CPU Details
run: lscpu
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: oven-sh/setup-bun@v2
with:
node-version: "20.10.0"
- id: super-cache
uses: mangs/super-cache-action@v3
- if: steps.super-cache.outputs.cache-hit != 'true'
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.PACKAGES_TOKEN }}

# Task execution
- run: npm run validate:formatting
- run: npm run validate:linting:eslint
- run: npm run test
bun-version: "1.1.17"
- run: bun install --frozen-lockfile
- run: bun run check:environment
- run: bun --bun run check:formatting
- run: bun --bun run check:lint-conflicts
- run: bun run test
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## 2.0.0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could highlight the breaking changes here for ease of update?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing, adding


- 3 new configurations added
- `/bun` for Bun support
- `/jsdoc` for JSDoc support in JavaScript projects
- `/jsdoc-typescript` for JSDoc support in TypeScript projects
- ESLint version `8.56.0` is now the minimum supported version
- Version `9.x` cannot be supported yet due to a dependency on the `eslint-config-airbnb*` packages and its strict peer dependency requirement of no higher than ESLint `8.x`
- Node.js `18.18.0` is now the minimum supported runtime version because of dependency requirements
- [Bun](https://bun.sh/) replaces NPM as a script runner and package manager for maintenance of this package
- Upgrade dependencies to latest versions

## 1.2.2

- Upgrade dependencies to latest versions
Expand Down
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

Hierarchical ESLint configuration collection that intends to be simple to use, layered, and shared with others. [(project maintainers)](./MAINTAINERS.md)

## Table of Contents

- [ESLint Configurations](#eslint-configurations)
- [Base Configuration Assumptions](#base-configuration-assumptions)
- [Example Usage](#example-usage)
- [Browser Environment](#browser-environment)
- [Node.js Environment](#nodejs-environment)
- [Browser Environment That Uses React, TypeScript, Jest, and a Custom Rule](#browser-environment-that-uses-react-typescript-jest-and-a-custom-rule)
- [Making Your Own Config From the Base Config 🎓](#making-your-own-config-from-the-base-config-)
- [Changing This Library](#changing-this-library)

## ESLint Configurations

There are multiple configurations you can use in your projects listed below. These are meant to be used in combination with one another. Please note that the base configuration is used by all the others, so there's no need to include that in your configuration unless it's the only one you're using.
Expand All @@ -12,8 +23,11 @@ The configuration names specified below should be used as items in the `extends`

- [`@babbel/eslint-config`](./lib/eslintBaseConfig.json): base configuration that all configurations inherit from
- [`@babbel/eslint-config/browser`](./lib/eslintBrowserConfig.json): for browser environments (**should always be last in your "extends" array**)
- [`@babbel/eslint-config/bun`](./lib/eslintBunConfig.json): for [Bun](https://bun.sh/) environments (**should always be last in your "extends" array**)
- [`@babbel/eslint-config/isomorphic`](./lib/eslintIsomorphicConfig.json): for isomorphic environments; in other words, using the browser and Node.js simultaneously on the same code (**should always be last in your "extends" array**)
- [`@babbel/eslint-config/jest`](./lib/eslintJestConfig.json): for testing environments using [Jest](https://jestjs.io/)
- [`@babbel/eslint-config/jsdoc`](./lib/eslintJsdocConfig.json): for documentation enforcement using [JSDoc](https://jsdoc.app/)
- [`@babbel/eslint-config/jsdoc-typescript`](./lib/eslintJsdocTypescriptConfig.json): for documentation enforcement using [JSDoc](https://jsdoc.app/) and [TypeScript](https://www.typescriptlang.org/)
- [`@babbel/eslint-config/node`](./lib/eslintNodeConfig.json): for [Node.js](https://nodejs.org/) environments (**should always be last in your "extends" array**)
- [`@babbel/eslint-config/playwright`](./lib/eslintPlaywrightConfig.json): for testing environments using the [Playwright](https://playwright.dev/) test runner (not `jest-playwright`)
- [`@babbel/eslint-config/preact`](./lib/eslintPreactConfig.json): for [Preact](https://preactjs.com/) environments
Expand Down Expand Up @@ -138,10 +152,12 @@ For example, if you want to add an export called `@babbel/eslint-config/example`

- File a pull request and wait for a project maintainer to review it. As a reminder, be sure that your new configuration extends `eslintBaseConfig.json` or a more specific configuration, otherwise the acceptance of your code contributions may be delayed.

## Final Thoughts
## Changing This Library

These are just a few examples. Any field in the ESLint configuration can be overridden, so you can customize these as much as you want. If you find yourself or your team using a configuration set over and over again, consider submitting it to make it part of this collection.
Maintenance of this library requires an exact version of [Bun](https://bun.sh/) to be installed, specifically the one listed in the `packageManager` field of `package.json`. Because there are no well-established version managers for Bun (e.g. like `nvm` for Node.js), a `package.json` script was added to overwrite the currently-installed version of Bun with the expected version for this project; Bun's entire install is a single binary, so doing so is a safe operation.

## Feedback Encouraged =D
Execute the install script by running

If you have any suggestions for improvements, please send them our way. 📫
```bash
bun run --silent install:bun:expected-version
```
Binary file added bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions bunfig.toml
3 changes: 3 additions & 0 deletions config/bun/bunfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[install]
auto = "disable"
exact = true
2 changes: 1 addition & 1 deletion config/github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- [ ] I have read the [CONTRIBUTING](/CONTRIBUTING.md) document
- [ ] Readme and changelog updates were made reflecting this PR's changes
- [ ] Increase the project version number in [`package.json`](/package.json) and [`package-lock.json`](/package-lock.json) following [Semantic Versioning](http://semver.org/)
- [ ] Increase the project version number in `package.json` following [Semantic Versioning](http://semver.org/)

**Changes Included**

Expand Down
1 change: 0 additions & 1 deletion config/npm/npmConfig.ini

This file was deleted.

8 changes: 3 additions & 5 deletions lib/eslintBaseConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@
"reportUnusedDisableDirectives": true,
"env": {
"browser": false,
"es2023": true,
"es2024": true,
"node": false
},
"parserOptions": {
"ecmaFeatures": {
"impliedStrict": true
},
"ecmaVersion": 2023,
"sourceType": "module"
},
"rules": {
Expand All @@ -39,10 +38,9 @@
{
"groups": [
["builtin", "external"],
["index", "internal", "parent", "sibling"],
["index", "internal", "parent", "sibling", "unknown"],
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes in this file don't seem to be documented in the Changelog

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

["type"],
["object"],
["unknown"]
["object"]
],
"newlines-between": "always"
}
Expand Down
9 changes: 9 additions & 0 deletions lib/eslintBunConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": ["./eslintTypescriptConfig.json", "./eslintNodeConfig.json", "eslint-config-prettier"],
"globals": {
"Bun": "readonly"
},
"settings": {
"import/core-modules": ["bun", "bun:jsc", "bun:sql", "bun:sqlite", "bun:test"]
}
}
13 changes: 13 additions & 0 deletions lib/eslintJsdocConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"plugins": ["eslint-plugin-jsdoc"],
"rules": {
"jsdoc/multiline-blocks": ["error", { "noSingleLineBlocks": true }],
"jsdoc/no-bad-blocks": "error",
"jsdoc/require-asterisk-prefix": "error",
"jsdoc/require-description-complete-sentence": "error",
"jsdoc/require-description": "error",
"jsdoc/require-file-overview": "error",
"jsdoc/require-hyphen-before-param-description": ["error", "never"],
"jsdoc/sort-tags": "error"
}
}
3 changes: 3 additions & 0 deletions lib/eslintJsdocTypescriptConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["./eslintJsdocConfig.json", "plugin:jsdoc/recommended-typescript-error"]
}
2 changes: 1 addition & 1 deletion lib/eslintPlaywrightConfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"plugins": ["eslint-plugin-playwright"],
"extends": ["plugin:playwright/recommended", "./eslintNodeConfig.json", "eslint-config-prettier"],
"extends": ["plugin:playwright/recommended"],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Node.js can no longer be assumed. Could be Bun or Node.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eslint-config-prettier only belongs as the last extends entry, so it should only ever be in one of the environment configs:

  • Node
  • Bun
  • Browser

"rules": {
"playwright/prefer-strict-equal": "error",
"playwright/prefer-to-be": "error",
Expand Down
3 changes: 1 addition & 2 deletions lib/eslintReactConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"eslint-config-airbnb",
"airbnb/hooks",
"plugin:jsx-a11y/recommended",
"./eslintBaseConfig.json",
"eslint-config-prettier"
"./eslintBaseConfig.json"
],
"env": {
"browser": false,
Expand Down
3 changes: 1 addition & 2 deletions lib/eslintReactTypescriptConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"extends": [
"eslint-config-airbnb-typescript",
"./eslintReactConfig.json",
"./eslintTypescriptConfig.json",
"eslint-config-prettier"
"./eslintTypescriptConfig.json"
],
"env": {
"browser": false,
Expand Down
5 changes: 2 additions & 3 deletions lib/eslintTypescriptConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
"parserOptions": {
"project": ["./tsconfig.json"]
},
"plugins": ["@typescript-eslint/eslint-plugin", "eslint-plugin-import"],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eslint-plugin-import is added in the base config

"plugins": ["@typescript-eslint/eslint-plugin"],
"extends": [
"plugin:import/typescript",
"eslint-config-airbnb-typescript/base",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
"./eslintBaseConfig.json",
"eslint-config-prettier"
"plugin:import/typescript"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding to eslint-plugin-import should only happen after it is first added to extends (in eslintBaseConfig.json)

],
"env": {
"browser": false,
Expand Down
Loading
Loading