Skip to content

Instantly share code, notes, and snippets.

View JoshuaKGoldberg's full-sized avatar
💖

Josh Goldberg ✨ JoshuaKGoldberg

💖
View GitHub Profile
@JoshuaKGoldberg
JoshuaKGoldberg / External Dependencies.md
Last active September 22, 2023 19:00
DefinitelyFormatted errors Sep 22

External Dependencies

i18next

Error: Errors in [email protected] for external dependencies:
Error: node_modules/i18next/index.d.ts(2,34): error TS2691: An import path cannot end with a '.d.ts' extension. Consider importing './typescript/helpers' instead.
Error: node_modules/i18next/index.d.ts(14,8): error TS2691: An import path cannot end with a '.d.ts' extension. Consider importing './typescript/options' instead.
Error: node_modules/i18next/index.d.ts(16,43): error TS2691: An import path cannot end with a '.d.ts' extension. Consider importing './typescript/t' instead.
Error: node_modules/i18next/index.d.ts(497,1): error TS1383: Only named exports may use 'export type'.
@JoshuaKGoldberg
JoshuaKGoldberg / accept-all-repository-packages.js
Last active September 15, 2023 13:10
Automating Tidelift tasks because the website takes too long to use
function waitFor(time) {
return new Promise((resolve) => setTimeout(resolve, time));
}
async function acceptVisiblePackages() {
const containers = document.querySelectorAll("#container");
for (const container of containers) {
container.click();
await waitFor(500);
async function goThroughFlow() {
const waitFor = (time) => new Promise((resolve) => setTimeout(resolve, time));
const container = document.getElementById("container");
container.click();
await waitFor(1000);
const choice = document.querySelector(`[name=discloure_choice]`);
choice.scrollIntoView();
choice.click();
@JoshuaKGoldberg
JoshuaKGoldberg / README.md
Last active July 6, 2023 15:16
DefinitelyFormatted

👉 This has since been posted to DefinitelyTyped's GitHub Discussions: DefinitelyTyped/DefinitelyTyped#65993 👈

Context

👋 Hi all! I've been working with the TypeScript team on overhauling DefinitelyTyped's usage of formatting and linting tools. Alongside the effort to finally migrate from TSLint to ESLint (https://typescript-eslint.io/linting/troubleshooting/tslint -> microsoft/DefinitelyTyped-tools#648), we'd like to align with how much of the industry & many linter maintainers recommend using a formatter vs. a linter (myself included).

This is a surfacing of a plan we've formulated that we think will get DefinitelyTyped onto using a proper formatter for formatting. I'd very much like to see the community's reaction: does this seem reasonable to you? What edge cases are we missing? Will this offend your sensibilities as a program

@JoshuaKGoldberg
JoshuaKGoldberg / README.md
Last active July 20, 2023 19:23
Draft Astro RFC for ESLint in the setup experience

withastro/roadmap#621

Summary

ESLint is generally considered to be a useful, even necessary, tool for JavaScript/TypeScript web apps. However, configuring it can involve wrangling several configurations and plugins together. It would be useful for many Astro users if npm create astro et al. offered to set up a starting ESLint configuration.

Background & Motivation

Contained here are the most common setup points I think many Astro would need.
@JoshuaKGoldberg
JoshuaKGoldberg / index.js
Created April 3, 2023 02:05
Unfollow current page
// Yes, I know this is super hacky! Don't worry about it.
// In theory we could use mutation observers to check for new elements...
// ...but this worked well enough. 😄
// Used as a script with the Run JavaScript extension:
// https://ataiva.com/run-javascript-chrome-extension-help
async function wait(seconds) {
await new Promise((resolve) => setTimeout(resolve, seconds));
}
@JoshuaKGoldberg
JoshuaKGoldberg / 1. Delayed Effects vs. Immediate States .md
Last active May 16, 2022 20:40
Monterey Class Notes on React - 5/16/2022
@JoshuaKGoldberg
JoshuaKGoldberg / angular.js
Created May 10, 2020 17:37
Basic Angular tslint-to-eslint-config converter generator
const { promisify } = require("util");
const { appendFile, writeFile } = require("fs").promises;
const inquirer = require("inquirer");
const exec = promisify(require("child_process").exec);
const execAndPrint = async (command) => {
console.log(`> ${command}`);
const { stdout, stderr } = await exec(command);
@JoshuaKGoldberg
JoshuaKGoldberg / .eslintrc.json
Created March 29, 2020 17:58
ESLint Import Restrictions
{
"extends": ["../../../.eslintrc.json"],
"rules": {
"no-restricted-syntax": [
"error",
{
"message": "Don't import from /platform into /portal: if you need, move the shared component to /components instead.",
"selector": "ImportDeclaration[source.value=/(^|(\\\\.\\\\.\\\\u002F*))platform\\\\u002F(.*)/]"
}
]
@JoshuaKGoldberg
JoshuaKGoldberg / svg.d.ts
Created March 29, 2020 17:57
SVG Declaration File
/**
* @example
* import happy from './assets/happy.svg';
*/
declare module "*.svg" {
const fileName: string;
export default fileName;
}