updating lint, format, and CI

This commit is contained in:
Luke Hagar
2025-03-19 23:10:08 -05:00
parent 156308d124
commit 32de48691f
15 changed files with 8655 additions and 2031 deletions

View File

@@ -1,36 +0,0 @@
{
"env": {
"es2022": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint"],
"rules": {
"@typescript-eslint/explicit-function-return-type": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"@typescript-eslint/no-unsafe-assignment": "error",
"@typescript-eslint/no-unsafe-member-access": "error",
"@typescript-eslint/no-unsafe-call": "error",
"@typescript-eslint/no-unsafe-return": "error",
"no-console": ["error", { "allow": ["warn", "error", "info"] }],
"eqeqeq": ["error", "always"],
"no-unused-vars": "off",
"prefer-const": "error",
"no-var": "error",
"curly": "error"
},
"ignorePatterns": ["dist", "node_modules", "coverage"],
"root": true
}

67
eslint.config.mjs Normal file
View File

@@ -0,0 +1,67 @@
import { defineConfig, globalIgnores } from "eslint/config";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
export default defineConfig([globalIgnores(["**/dist", "**/node_modules", "**/coverage"]), {
extends: compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier",
),
plugins: {
"@typescript-eslint": typescriptEslint,
},
languageOptions: {
globals: {
...globals.node,
},
parser: tsParser,
ecmaVersion: "latest",
sourceType: "module",
parserOptions: {
project: "./tsconfig.json",
},
},
rules: {
"@typescript-eslint/explicit-function-return-type": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unused-vars": ["error", {
argsIgnorePattern: "^_",
}],
"@typescript-eslint/no-unsafe-assignment": "error",
"@typescript-eslint/no-unsafe-member-access": "error",
"@typescript-eslint/no-unsafe-call": "error",
"@typescript-eslint/no-unsafe-return": "error",
"no-console": ["error", {
allow: ["warn", "error", "info"],
}],
eqeqeq: ["error", "always"],
"no-unused-vars": "off",
"prefer-const": "error",
"no-var": "error",
curly: "error",
},
}]);

19
node_modules/.package-lock.json generated vendored
View File

@@ -400,6 +400,19 @@
"url": "https://github.com/sponsors/epoberezkin"
}
},
"node_modules/@eslint/eslintrc/node_modules/globals": {
"version": "14.0.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",
"integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
@@ -4136,9 +4149,9 @@
}
},
"node_modules/globals": {
"version": "14.0.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",
"integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",
"version": "16.0.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-16.0.0.tgz",
"integrity": "sha512-iInW14XItCXET01CQFqudPOWP2jYMl7T+QRQT+UNcR/iQncN/F0UNpgd76iFkBPgNQb4+X3LV9tLJYzwh+Gl3A==",
"dev": true,
"license": "MIT",
"engines": {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
'use strict';
module.exports = require('./globals.json');

View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
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.

View File

@@ -0,0 +1,58 @@
{
"name": "globals",
"version": "14.0.0",
"description": "Global identifiers from different JavaScript environments",
"license": "MIT",
"repository": "sindresorhus/globals",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"sideEffects": false,
"engines": {
"node": ">=18"
},
"scripts": {
"test": "xo && ava && tsd",
"prepare": "npm run --silent update-types",
"update-builtin-globals": "node scripts/get-builtin-globals.mjs",
"update-types": "node scripts/generate-types.mjs > index.d.ts"
},
"files": [
"index.js",
"index.d.ts",
"globals.json"
],
"keywords": [
"globals",
"global",
"identifiers",
"variables",
"vars",
"jshint",
"eslint",
"environments"
],
"devDependencies": {
"ava": "^2.4.0",
"cheerio": "^1.0.0-rc.12",
"tsd": "^0.30.4",
"type-fest": "^4.10.2",
"xo": "^0.36.1"
},
"xo": {
"ignores": [
"get-browser-globals.js"
],
"rules": {
"node/no-unsupported-features/es-syntax": "off"
}
},
"tsd": {
"compilerOptions": {
"resolveJsonModule": true
}
}
}

View File

@@ -0,0 +1,44 @@
# globals
> Global identifiers from different JavaScript environments
It's just a [JSON file](globals.json), so use it in any environment.
This package is used by ESLint.
**This package [no longer accepts](https://github.com/sindresorhus/globals/issues/82) new environments. If you need it for ESLint, just [create a plugin](http://eslint.org/docs/developer-guide/working-with-plugins#environments-in-plugins).**
## Install
```sh
npm install globals
```
## Usage
```js
const globals = require('globals');
console.log(globals.browser);
/*
{
addEventListener: false,
applicationCache: false,
ArrayBuffer: false,
atob: false,
}
*/
```
Each global is given a value of `true` or `false`. A value of `true` indicates that the variable may be overwritten. A value of `false` indicates that the variable should be considered read-only. This information is used by static analysis tools to flag incorrect behavior. We assume all variables should be `false` unless we hear otherwise.
For Node.js this package provides two sets of globals:
- `globals.nodeBuiltin`: Globals available to all code running in Node.js.
These will usually be available as properties on the `global` object and include `process`, `Buffer`, but not CommonJS arguments like `require`.
See: https://nodejs.org/api/globals.html
- `globals.node`: A combination of the globals from `nodeBuiltin` plus all CommonJS arguments ("CommonJS module scope").
See: https://nodejs.org/api/modules.html#modules_the_module_scope
When analyzing code that is known to run outside of a CommonJS wrapper, for example, JavaScript modules, `nodeBuiltin` can find accidental CommonJS references.

3060
node_modules/globals/globals.json generated vendored

File diff suppressed because it is too large Load Diff

3210
node_modules/globals/index.d.ts generated vendored

File diff suppressed because it is too large Load Diff

71
node_modules/globals/package.json generated vendored
View File

@@ -1,6 +1,6 @@
{
"name": "globals",
"version": "14.0.0",
"version": "16.0.0",
"description": "Global identifiers from different JavaScript environments",
"license": "MIT",
"repository": "sindresorhus/globals",
@@ -15,10 +15,20 @@
"node": ">=18"
},
"scripts": {
"test": "xo && ava && tsd",
"prepare": "npm run --silent update-types",
"update-builtin-globals": "node scripts/get-builtin-globals.mjs",
"update-types": "node scripts/generate-types.mjs > index.d.ts"
"test": "npm run build && xo && ava && tsd",
"prepare": "npm run build",
"update": "node scripts/update.mjs",
"update:browser": "node scripts/update.mjs --environment=browser",
"update:builtin": "node scripts/update.mjs --environment=builtin",
"update:nodeBuiltin": "node scripts/update.mjs --environment=nodeBuiltin",
"update:worker": "node scripts/update.mjs --environment=worker",
"update:serviceworker": "node scripts/update.mjs --environment=serviceworker",
"update:shelljs": "node scripts/update.mjs --environment=shelljs",
"update:jest": "node scripts/update.mjs --environment=jest",
"update:vitest": "node scripts/update.mjs --environment=vitest",
"build": "run-s build:data build:types",
"build:data": "node scripts/generate-data.mjs",
"build:types": "node scripts/generate-types.mjs"
},
"files": [
"index.js",
@@ -36,19 +46,52 @@
"environments"
],
"devDependencies": {
"ava": "^2.4.0",
"@vitest/eslint-plugin": "^1.1.30",
"ava": "^6.1.3",
"cheerio": "^1.0.0-rc.12",
"tsd": "^0.30.4",
"type-fest": "^4.10.2",
"xo": "^0.36.1"
"eslint-plugin-jest": "^28.8.3",
"execa": "^9.4.0",
"get-port": "^7.1.0",
"npm-run-all2": "^6.2.3",
"outdent": "^0.8.0",
"puppeteer": "^23.4.1",
"shelljs": "^0.8.5",
"tsd": "^0.31.2",
"type-fest": "^4.26.1",
"xo": "^0.59.3"
},
"xo": {
"ignores": [
"get-browser-globals.js"
],
"rules": {
"node/no-unsupported-features/es-syntax": "off"
}
"unicorn/prefer-module": "off"
},
"overrides": [
{
"files": [
"data/*.mjs"
],
"rules": {
"import/no-anonymous-default-export": "off",
"camelcase": "off",
"unicorn/filename-case": [
"error",
{
"cases": {
"camelCase": true,
"kebabCase": true
}
}
]
}
},
{
"files": [
"scripts/*.mjs"
],
"rules": {
"n/no-unsupported-features/node-builtins": "off"
}
}
]
},
"tsd": {
"compilerOptions": {

10
node_modules/globals/readme.md generated vendored
View File

@@ -2,11 +2,9 @@
> Global identifiers from different JavaScript environments
It's just a [JSON file](globals.json), so use it in any environment.
It's just a [JSON file](globals.json), so you can use it in any environment.
This package is used by ESLint.
**This package [no longer accepts](https://github.com/sindresorhus/globals/issues/82) new environments. If you need it for ESLint, just [create a plugin](http://eslint.org/docs/developer-guide/working-with-plugins#environments-in-plugins).**
This package is used by ESLint 8 and earlier. For ESLint 9 and later, you should depend on this package directly in [your ESLint config](https://eslint.org/docs/latest/use/configure/language-options#predefined-global-variables).
## Install
@@ -17,7 +15,7 @@ npm install globals
## Usage
```js
const globals = require('globals');
import globals from 'globals';
console.log(globals.browser);
/*
@@ -36,7 +34,7 @@ Each global is given a value of `true` or `false`. A value of `true` indicates t
For Node.js this package provides two sets of globals:
- `globals.nodeBuiltin`: Globals available to all code running in Node.js.
These will usually be available as properties on the `global` object and include `process`, `Buffer`, but not CommonJS arguments like `require`.
These will usually be available as properties on the `globalThis` object and include `process`, `Buffer`, but not CommonJS arguments like `require`.
See: https://nodejs.org/api/globals.html
- `globals.node`: A combination of the globals from `nodeBuiltin` plus all CommonJS arguments ("CommonJS module scope").
See: https://nodejs.org/api/modules.html#modules_the_module_scope

22
package-lock.json generated
View File

@@ -29,6 +29,8 @@
"arbiter": "dist/cli.js"
},
"devDependencies": {
"@eslint/eslintrc": "^3.3.0",
"@eslint/js": "^9.22.0",
"@hono/node-server": "^1.13.8",
"@types/chalk": "^2.2.0",
"@types/commander": "^2.12.2",
@@ -40,6 +42,7 @@
"@vitest/coverage-v8": "^3.0.9",
"eslint": "^9.22.0",
"eslint-config-prettier": "^10.1.1",
"globals": "^16.0.0",
"node-fetch": "^3.3.2",
"openapi-types": "^12.1.3",
"prettier": "^3.5.3",
@@ -853,6 +856,19 @@
"url": "https://github.com/sponsors/epoberezkin"
}
},
"node_modules/@eslint/eslintrc/node_modules/globals": {
"version": "14.0.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",
"integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
@@ -4842,9 +4858,9 @@
}
},
"node_modules/globals": {
"version": "14.0.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",
"integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",
"version": "16.0.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-16.0.0.tgz",
"integrity": "sha512-iInW14XItCXET01CQFqudPOWP2jYMl7T+QRQT+UNcR/iQncN/F0UNpgd76iFkBPgNQb4+X3LV9tLJYzwh+Gl3A==",
"dev": true,
"license": "MIT",
"engines": {

View File

@@ -53,6 +53,8 @@
"yaml": "^2.7.0"
},
"devDependencies": {
"@eslint/eslintrc": "^3.3.0",
"@eslint/js": "^9.22.0",
"@hono/node-server": "^1.13.8",
"@types/chalk": "^2.2.0",
"@types/commander": "^2.12.2",
@@ -64,6 +66,7 @@
"@vitest/coverage-v8": "^3.0.9",
"eslint": "^9.22.0",
"eslint-config-prettier": "^10.1.1",
"globals": "^16.0.0",
"node-fetch": "^3.3.2",
"openapi-types": "^12.1.3",
"prettier": "^3.5.3",