Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
fpapado committed Oct 29, 2024
0 parents commit 61c456e
Show file tree
Hide file tree
Showing 57 changed files with 15,272 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changesets

Hello and welcome! This folder has been automatically generated by
`@changesets/cli`, a build tool that works with multi-package repos, or
single-package repos to help you version and publish your code. You can find the
full documentation for it
[in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this
project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
14 changes: 14 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"bumpVersionsWithWorkspaceProtocolOnly": true,
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true
}
}
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @fpapado
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on:
push:
branches: ["main"]
pull_request:
branches:
- "**"

jobs:
checks:
name: Checks
runs-on: ubuntu-latest
strategy:
matrix:
command: ["check-types", "lint", "test"]
# We want a comprehensive view of checks, so let them all run even if one fails
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v3
- name: Setup node
uses: actions/setup-node@v4
with:
cache: "pnpm"
node-version-file: ".nvmrc"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build all
# The plugin packages depend on the parser. This currently works
# incidentally, and will be improved when we use a dedicated monorepo
# task runner.
run: pnpm run -r build
- run: pnpm ${{ matrix.command }}
54 changes: 54 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Release

on:
push:
branches:
- main
workflow_dispatch:

concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions: {}

jobs:
release:
# do not run on forks
if: github.repository == 'woltapp/browserbug'
permissions:
pull-requests: write # to create a release pull request (changesets/action)
contents: write # to create the release itself (changesets/action)
id-token: write # OpenID Connect token needed for npm publish provenance
packages: write # to publish to GitHub packages
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can
# generate changelogs with the correct commits
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- run: corepack enable
- run: pnpm install
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
# Calls out to `changeset version` and also updates the lockfile,
# which Changesets does not do out of the box.
version: pnpm changeset:version
# We use a recursive pnpm script under the hood, to ensure that
# publishing runs topologically. Changesets does not do this out of
# the box. @see: https://github.com/changesets/changesets/issues/238
publish: pnpm changeset:release
env:
# Used to write releases and create the PR
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Used to actually publish to the NPM registry; this is set as a
# repository secret
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
NPM_CONFIG_PROVENANCE: true
130 changes: 130 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm lint-staged
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20.18.0
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.ohm-bundle.*
pnpm-lock.yaml
package.json
.tsup
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Wolt Enterprises Oy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# browserbug

> Lint rules for documenting, and eventually removing, browser bug workarounds
In active development! Follow
[the eslint plugin directory for more information](./packages/eslint-plugin-browserbug/).

## Motivation

As a web frontend codebase grows, it accumulates codepaths that work around
specific browser bugs, quirks, and implementation details. These workarounds are
often a pragmatic choice, in order to get things to work or look correct.

Over a long period of time, these browser bug workarounds end up looking
mysterious at best, and scary at worst. It often seems better to "leave them
be", or risk things breaking. This accumulation of workarounds can make
codepaths less efficient, leads to larger bundle sizes, and makes the codebase
less inviting.

To tackle this problem, these lint rules offer a way to document such browser
bugs and their versions, and to warn you when the browser versions change.

The rules are backed by your project's
[browserslist config](https://github.com/browserslist/browserslist#browserslist-).
Browserslist is commonly used by similar tools, such as automated code
transpilation via Babel, SWC, and PostCSS. Thus, you are prompted to change
things _at a pace dictated by your project's browser support_, instead of
arbitrary version numbers.

While automated tools and code transpilation go a long way, there are categories
of bugs, workarounds and manual feature detection, that require some manual
intervention. These lint rules tackle this space.

## Installation

- [ESLint](./packages/eslint-plugin-browserbug/#Installation)

## Usage

- [ESLint](./packages/eslint-plugin-browserbug/#Usage)

## Contributing
13 changes: 13 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// @ts-check

import eslintJs from '@eslint/js';
import tseslint from 'typescript-eslint';
import eslintPlugin from 'eslint-plugin-eslint-plugin';

export default tseslint.config(
{ ignores: ['**/*.ohm-bundle.d.ts', '**/dist/*'] },
eslintJs.configs.recommended,
...tseslint.configs.recommended,
// @ts-expect-error -- the types do not line up
eslintPlugin.configs['flat/recommended'],
);
58 changes: 58 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"private": true,
"name": "@woltapp/browserbug-root",
"version": "0.0.0",
"description": "Document, and eventually remove, browser bug workarounds",
"license": "MIT",
"author": "Wolt Enterprises Oy",
"repository": {
"type": "git",
"url": "https://github.com/woltapp/browserbug.git"
},
"scripts": {
"build": "pnpm --recursive run build",
"changeset:release": "pnpm build && changeset tag && pnpm --recursive publish",
"changeset:version": "changeset version && pnpm install --lockfile-only",
"check-types": "pnpm --recursive run check-types",
"preinstall": "npx only-allow pnpm",
"lint": "pnpm --recursive lint",
"prepare": "husky",
"release": "pnpm --recursive publish",
"test": "vitest",
"test:coverage": "vitest --coverage"
},
"dependencies": {
"@changesets/cli": "^2.27.1"
},
"devDependencies": {
"@arethetypeswrong/cli": "0.16.4",
"@tsconfig/node20": "20.1.4",
"@vitest/coverage-v8": "2.1.4",
"eslint": "9.13.0",
"husky": "9.1.6",
"lint-staged": "15.2.10",
"npm-run-all2": "7.0.1",
"prettier": "3.3.3",
"prettier-package-json": "2.8.0",
"publint": "0.2.12",
"rimraf": "6.0.1",
"tsup": "8.3.5",
"typescript": "5.6.3",
"typescript-eslint": "8.12.1",
"vitest": "2.1.4"
},
"keywords": [
"eslint",
"eslint-plugin",
"eslintplugin"
],
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},
"lint-staged": {
"*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}": "eslint --fix",
"*": "prettier --write --ignore-unknown",
"package.json": "prettier-package-json --write"
},
"packageManager": "[email protected]"
}
Loading

0 comments on commit 61c456e

Please sign in to comment.