build: refactor linting

This commit is contained in:
iCrawl 2023-08-22 09:40:11 +02:00
parent 2e40a05adf
commit d37632da05
No known key found for this signature in database
GPG key ID: 1AB888B16355FBB2
72 changed files with 427 additions and 530 deletions

View file

@ -1,12 +0,0 @@
{
"$schema": "https://json.schemastore.org/eslintrc.json",
"root": true,
"extends": ["neon/common", "neon/node", "neon/typescript", "neon/prettier"],
"parserOptions": {
"project": ["./tsconfig.eslint.json", "./apps/*/tsconfig.eslint.json", "./packages/*/tsconfig.eslint.json"]
},
"rules": {
"@typescript-eslint/consistent-type-definitions": ["error", "interface"]
},
"ignorePatterns": ["**/dist/*"]
}

View file

@ -1,6 +1,6 @@
{
"$schema": "https://json.schemastore.org/lintstagedrc.schema.json",
"*": "prettier --ignore-unknown --write",
"{src/**,__tests__/**}.{mjs,js,cjs,ts,tsx}": "eslint --ext .mjs,.js,.cjs,.ts,.tsx --fix",
"{src/**,__tests__/**}.{mjs,js,cjs,ts,tsx}": "eslint --fix",
"src/**.ts": "vitest related --run --config ../../vitest.config.ts"
}

View file

@ -1,6 +1,6 @@
{
"eslint.workingDirectories": [{ "pattern": "./apps/*" }, { "pattern": "./packages/*" }],
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact"],
"eslint.experimental.useFlatConfig": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {

View file

@ -1 +0,0 @@
next-env.d.ts

View file

@ -1,13 +0,0 @@
{
"$schema": "https://json.schemastore.org/eslintrc.json",
"extends": ["../../.eslintrc.json", "neon/react", "neon/next", "neon/edge", "@unocss", "neon/prettier"],
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
"react/react-in-jsx-scope": 0,
"react/jsx-filename-extension": [1, { "extensions": [".tsx"] }]
}
}

View file

@ -17,8 +17,8 @@
"dev:next": "next dev",
"dev:css": "yarn generate:css --watch",
"generate:css": "unocss 'src/**/*.tsx' 'contentlayer.config.ts' '../../packages/ui/src/lib/components/**/*.tsx' --out-file ./src/styles/unocss.css --config ../../unocss.config.ts",
"lint": "prettier --check . && cross-env TIMING=1 eslint src --ext .mjs,.js,.cjs,.ts,.tsx --format=pretty",
"format": "prettier --write . && cross-env TIMING=1 eslint src --ext .mjs,.js,.cjs,.ts,.tsx --fix --format=pretty",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
"fmt": "yarn format"
},
"type": "commonjs",
@ -74,14 +74,14 @@
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"@unocss/cli": "^0.55.2",
"@unocss/eslint-config": "^0.55.2",
"@unocss/eslint-plugin": "^0.55.2",
"@unocss/reset": "^0.55.2",
"@vitejs/plugin-react": "^4.0.4",
"@vitest/coverage-v8": "^0.34.2",
"concurrently": "^8.2.0",
"concurrently": "^8.2.1",
"cross-env": "^7.0.3",
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.47",
"eslint-config-neon": "^0.1.54",
"eslint-formatter-pretty": "^5.0.0",
"happy-dom": "^10.10.4",
"hast-util-to-string": "^2.0.0",

View file

@ -1 +0,0 @@
next-env.d.ts

View file

@ -1,13 +0,0 @@
{
"$schema": "https://json.schemastore.org/eslintrc.json",
"extends": ["../../.eslintrc.json", "neon/react", "neon/next", "neon/edge", "@unocss", "neon/prettier"],
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
"react/react-in-jsx-scope": 0,
"react/jsx-filename-extension": [1, { "extensions": [".tsx"] }]
}
}

View file

@ -19,8 +19,8 @@
"dev:next": "next dev",
"dev:css": "yarn generate:css --watch",
"generate:css": "unocss 'src/**/*.tsx' '../../packages/ui/src/lib/components/**/*.tsx' --out-file ./src/styles/unocss.css --config ../../unocss.config.ts",
"lint": "prettier --check . && cross-env TIMING=1 eslint src --ext .mjs,.js,.cjs,.ts,.tsx --format=pretty",
"format": "prettier --write . && cross-env TIMING=1 eslint src --ext .mjs,.js,.cjs,.ts,.tsx --fix --format=pretty",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
"fmt": "yarn format"
},
"type": "module",
@ -83,15 +83,15 @@
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"@unocss/cli": "^0.55.2",
"@unocss/eslint-config": "^0.55.2",
"@unocss/eslint-plugin": "^0.55.2",
"@unocss/reset": "^0.55.2",
"@vitejs/plugin-react": "^4.0.4",
"@vitest/coverage-v8": "^0.34.2",
"concurrently": "^8.2.0",
"concurrently": "^8.2.1",
"cpy-cli": "^5.0.0",
"cross-env": "^7.0.3",
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.47",
"eslint-config-neon": "^0.1.54",
"eslint-formatter-pretty": "^5.0.0",
"happy-dom": "^10.10.4",
"lighthouse": "^11.0.0",

View file

@ -8,6 +8,5 @@ export function useSystemThemeFallback() {
if (theme === 'auto') {
localStorage.setItem('theme', 'system');
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
}

97
eslint.config.js Normal file
View file

@ -0,0 +1,97 @@
import unocss from '@unocss/eslint-plugin';
import common from 'eslint-config-neon/flat/common.js';
import edge from 'eslint-config-neon/flat/edge.js';
import next from 'eslint-config-neon/flat/next.js';
import node from 'eslint-config-neon/flat/node.js';
import prettier from 'eslint-config-neon/flat/prettier.js';
import react from 'eslint-config-neon/flat/react.js';
import typescript from 'eslint-config-neon/flat/typescript.js';
import deepMerge from 'ts-deepmerge';
const generalRuleset = Object.freeze(
deepMerge.withOptions({ mergeArrays: false }, ...common, ...node, ...typescript, {
files: [
'{apps,packages}/**/src/**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}',
'{apps,packages}/**/bin/**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}',
'{apps,packages}/**/__tests__/**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}',
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.eslint.json', './apps/*/tsconfig.eslint.json', './packages/*/tsconfig.eslint.json'],
},
},
rules: {
'@typescript-eslint/consistent-type-definitions': [2, 'interface'],
'jsdoc/no-undefined-types': 1,
},
}),
);
const reactRuleset = Object.freeze(
deepMerge.withOptions({ mergeArrays: false }, generalRuleset, ...react, ...next, ...edge, {
files: [
'apps/**/src/**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}',
'apps/**/bin/**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}',
'apps/**/__tests__/**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}',
'packages/ui/src/**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}',
],
plugins: {
'@unocss': unocss,
},
rules: {
'@next/next/no-html-link-for-pages': 0,
'react/react-in-jsx-scope': 0,
'react/jsx-filename-extension': [1, { extensions: ['.tsx'] }],
},
settings: {
react: {
version: 'detect',
},
},
}),
);
const prettierRuleset = Object.freeze(
deepMerge.withOptions({ mergeArrays: false }, ...prettier, {
files: [
'{apps,packages}/**/src/**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}',
'{apps,packages}/**/bin/**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}',
'{apps,packages}/**/__tests__/**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}',
],
}),
);
/** @type {import('eslint').Linter.FlatConfig[]} */
export default [
{
ignores: ['**/.next', '**/coverage', '**/dist', '**/node_modules', '**/.contentlayer', '**/template'],
},
generalRuleset,
reactRuleset,
{
files: [
'packages/rest/src/**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}',
'packages/rest/__tests__/**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}',
],
rules: {
'n/prefer-global/url': 0,
'n/prefer-global/url-search-params': 0,
'n/prefer-global/buffer': 0,
'n/prefer-global/process': 0,
'no-restricted-globals': 0,
'unicorn/prefer-node-protocol': 0,
},
},
{
files: [
'packages/voice/src/**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}',
'packages/voice/__tests__/**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}',
'packages/voice/__mocks__/**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}',
],
rules: {
'import/extensions': 0,
'no-restricted-globals': 0,
},
},
prettierRuleset,
];

View file

@ -5,6 +5,7 @@
"description": "A powerful library for interacting with the Discord API",
"private": true,
"scripts": {
"lint:fast": "eslint .",
"build": "turbo run build",
"build:affected": "turbo run build --filter='...[origin/main]'",
"build:apps": "turbo run build:local --filter='...{apps/*}'",
@ -23,6 +24,7 @@
"update": "yarn upgrade-interactive",
"create-package": "node packages/scripts/src/packageScript.mjs"
},
"type": "module",
"contributors": [
"Crawl <icrawltogo@gmail.com>",
"Amish Shah <amishshah.2k@gmail.com>",
@ -51,10 +53,14 @@
"@commitlint/config-angular": "^17.7.0",
"@favware/cliff-jumper": "^2.1.1",
"@favware/npm-deprecate": "^1.0.7",
"@unocss/eslint-plugin": "^0.55.2",
"conventional-changelog-cli": "^3.0.0",
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.54",
"husky": "^8.0.3",
"is-ci": "^3.0.1",
"lint-staged": "^14.0.1",
"ts-deepmerge": "^6.2.0",
"tsup": "^7.2.0",
"turbo": "^1.10.12",
"typescript": "^5.1.6",

View file

@ -1,4 +0,0 @@
{
"$schema": "https://json.schemastore.org/eslintrc.json",
"extends": "../../.eslintrc.json"
}

View file

@ -7,8 +7,8 @@
"scripts": {
"test": "vitest run",
"build": "tsup",
"lint": "prettier --check . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --format=pretty",
"format": "prettier --write . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --fix --format=pretty",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
"fmt": "yarn format"
},
"type": "module",
@ -51,7 +51,7 @@
"@vitest/coverage-v8": "^0.34.2",
"cross-env": "^7.0.3",
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.47",
"eslint-config-neon": "^0.1.54",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"tsup": "^7.2.0",

View file

@ -1,5 +1,4 @@
export function formatTag(tag: string) {
// eslint-disable-next-line unicorn/no-unsafe-regex
const parsed = /(?:^@.*\/(?<package>.*)@v?)?(?<semver>\d+.\d+.\d+)-?.*/.exec(tag);
const parsedPackage = /(?<package>.*)@v?-?.*/.exec(tag);

View file

@ -1,4 +0,0 @@
{
"$schema": "https://json.schemastore.org/eslintrc.json",
"extends": "../../.eslintrc.json"
}

View file

@ -6,8 +6,8 @@
"private": true,
"scripts": {
"build": "tsup",
"lint": "prettier --check . && cross-env TIMING=1 eslint src --ext .mjs,.js,.ts --format=pretty",
"format": "prettier --write . && cross-env TIMING=1 eslint src --ext .mjs,.js,.ts --fix --format=pretty",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
"fmt": "yarn format"
},
"exports": {
@ -52,7 +52,7 @@
"@types/node": "16.18.41",
"cross-env": "^7.0.3",
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.47",
"eslint-config-neon": "^0.1.54",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"tsup": "^7.2.0",

View file

@ -54,7 +54,7 @@ export function generatePath(items: readonly ApiItem[], version: string) {
}
}
// eslint-disable-next-line prefer-named-capture-group, unicorn/no-unsafe-regex
// eslint-disable-next-line prefer-named-capture-group
return path.replace(/@discordjs\/(.*)\/(.*)?/, `$1/${version}/$2`);
}

View file

@ -1,4 +0,0 @@
{
"$schema": "https://json.schemastore.org/eslintrc.json",
"extends": "../../.eslintrc.json"
}

View file

@ -15,7 +15,6 @@ const mockRedisClient = {
} as unknown as Redis;
test('pubsub with custom encoding', async () => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
const encode = vi.fn((data) => data);
const broker = new PubSubRedisBroker({ redisClient: mockRedisClient, encode });

View file

@ -7,8 +7,8 @@
"test": "vitest run",
"build": "tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --format=pretty",
"format": "prettier --write . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --fix --format=pretty",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
"fmt": "yarn format",
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "yarn lint && yarn test && yarn build",
@ -77,7 +77,7 @@
"@vitest/coverage-v8": "^0.34.2",
"cross-env": "^7.0.3",
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.47",
"eslint-config-neon": "^0.1.54",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"tsup": "^7.2.0",

View file

@ -113,7 +113,7 @@ export abstract class BaseRedisBroker<TEvents extends Record<string, any>>
}
this.listening = true;
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
while (true) {
try {
const data = await this.streamReadClient.xreadgroupBuffer(

View file

@ -1,4 +0,0 @@
{
"$schema": "https://json.schemastore.org/eslintrc.json",
"extends": "../../.eslintrc.json"
}

View file

@ -102,7 +102,6 @@ describe('Application Command toJSON() results', () => {
min_value: -1,
autocomplete: true,
// TODO
// @ts-expect-error You *can* send an empty array with autocomplete: true, should correct that in types
choices: [],
});
@ -147,7 +146,6 @@ describe('Application Command toJSON() results', () => {
min_value: -1.23,
autocomplete: true,
// TODO
// @ts-expect-error You *can* send an empty array with autocomplete: true, should correct that in types
choices: [],
});
@ -190,7 +188,6 @@ describe('Application Command toJSON() results', () => {
required: true,
autocomplete: true,
// TODO
// @ts-expect-error you *can* send an empty array with autocomplete: true, should correct that in types
choices: [],
});

View file

@ -7,8 +7,8 @@
"test": "vitest run",
"build": "tsup",
"build:docs": "tsc -p tsconfig.docs.json && yarn downlevel-dts ./dist-docs ./dist-docs",
"lint": "prettier --check . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --format=pretty",
"format": "prettier --write . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --fix --format=pretty",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
"fmt": "yarn format",
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "yarn lint && yarn test && yarn build",
@ -81,7 +81,7 @@
"downlevel-dts": "^0.11.0",
"esbuild-plugin-version-injector": "^1.2.0",
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.47",
"eslint-config-neon": "^0.1.54",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"tsup": "^7.2.0",

View file

@ -59,7 +59,7 @@ export interface MappedComponentTypes {
* @param data - The API data to transform to a component class
*/
export function createComponentBuilder<T extends keyof MappedComponentTypes>(
// eslint-disable-next-line @typescript-eslint/sort-type-union-intersection-members
// eslint-disable-next-line @typescript-eslint/sort-type-constituents
data: (APIModalComponent | APIMessageComponent) & { type: T },
): MappedComponentTypes[T];

View file

@ -6,7 +6,7 @@ import type { ContextMenuCommandType } from './ContextMenuCommandBuilder.js';
const namePredicate = s.string
.lengthGreaterThanOrEqual(1)
.lengthLessThanOrEqual(32)
// eslint-disable-next-line prefer-named-capture-group, unicorn/no-unsafe-regex
// eslint-disable-next-line prefer-named-capture-group
.regex(/^( *[\p{P}\p{L}\p{N}\p{sc=Devanagari}\p{sc=Thai}]+ *)+$/u)
.setValidationEnabled(isValidationEnabled);
const typePredicate = s

View file

@ -1,4 +0,0 @@
{
"$schema": "https://json.schemastore.org/eslintrc.json",
"extends": "../../.eslintrc.json"
}

View file

@ -7,8 +7,8 @@
"test": "vitest run",
"build": "tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --format=pretty",
"format": "prettier --write . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --fix --format=pretty",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
"fmt": "yarn format",
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "yarn lint && yarn test && yarn build",
@ -67,7 +67,7 @@
"cross-env": "^7.0.3",
"esbuild-plugin-version-injector": "^1.2.0",
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.47",
"eslint-config-neon": "^0.1.54",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"tsup": "^7.2.0",

View file

@ -1,4 +0,0 @@
{
"$schema": "https://json.schemastore.org/eslintrc.json",
"extends": "../../.eslintrc.json"
}

View file

@ -7,8 +7,8 @@
"test": "vitest run",
"build": "tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint src --ext .mjs,.js,.ts --format=pretty",
"format": "prettier --write . && cross-env TIMING=1 eslint src --ext .mjs,.js,.ts --fix --format=pretty",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "yarn build && yarn lint",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/core/*'",
@ -80,7 +80,7 @@
"cross-env": "^7.0.3",
"esbuild-plugin-version-injector": "^1.2.0",
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.47",
"eslint-config-neon": "^0.1.54",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"tsup": "^7.2.0",

View file

@ -1 +0,0 @@
dist

View file

@ -1,5 +0,0 @@
{
"$schema": "https://json.schemastore.org/eslintrc.json",
"extends": "../../.eslintrc.json",
"ignorePatterns": ["**/template/Deno/*"]
}

View file

@ -5,8 +5,8 @@
"description": "A simple way to create a startup Discord bot.",
"scripts": {
"build": "tsup",
"lint": "prettier --check . && cross-env TIMING=1 eslint src --ext .mjs,.js,.ts --format=pretty",
"format": "prettier --write . && cross-env TIMING=1 eslint src --ext .mjs,.js,.ts --fix --format=pretty",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
"prepack": "yarn build && yarn lint",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/create-discord-bot/*'",
"release": "cliff-jumper"
@ -62,7 +62,7 @@
"@vitest/coverage-v8": "^0.34.2",
"cross-env": "^7.0.3",
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.47",
"eslint-config-neon": "^0.1.54",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"terser": "^5.19.2",

View file

@ -5,9 +5,9 @@
"private": true,
"type": "module",
"scripts": {
"lint": "prettier --check . && eslint ./src --ext .[REPLACE_IMPORT_EXT] --format=pretty",
"lint": "prettier --check . && eslint --ext .[REPLACE_IMPORT_EXT] --format=pretty src",
"deploy": "bun run src/util/deploy.[REPLACE_IMPORT_EXT]",
"format": "prettier --write . && eslint ./src --ext .[REPLACE_IMPORT_EXT] --fix --format=pretty",
"format": "prettier --write . && eslint --ext .[REPLACE_IMPORT_EXT] --fix --format=pretty src",
"start": "bun run src/index.[REPLACE_IMPORT_EXT]"
},
"dependencies": {

View file

@ -5,9 +5,9 @@
"private": true,
"type": "module",
"scripts": {
"lint": "tsc && prettier --check . && eslint ./src --ext .[REPLACE_IMPORT_EXT] --format=pretty",
"lint": "tsc && prettier --check . && eslint --ext .[REPLACE_IMPORT_EXT] --format=pretty src",
"deploy": "bun run src/util/deploy.[REPLACE_IMPORT_EXT]",
"format": "prettier --write . && eslint ./src --ext .[REPLACE_IMPORT_EXT] --fix --format=pretty",
"format": "prettier --write . && eslint --ext .[REPLACE_IMPORT_EXT] --fix --format=pretty src",
"start": "bun run src/index.[REPLACE_IMPORT_EXT]"
},
"dependencies": {

View file

@ -5,8 +5,8 @@
"private": true,
"type": "module",
"scripts": {
"lint": "prettier --check . && eslint src --ext .js,.cjs --format=pretty",
"format": "prettier --write . && eslint src --ext .js,.cjs --fix --format=pretty",
"lint": "prettier --check . && eslint --ext .js,.mjs,.cjs --format=pretty src",
"format": "prettier --write . && eslint --ext .js,.mjs,.cjs --fix --format=pretty src",
"start": "node --require dotenv/config src/index.js",
"deploy": "node --require dotenv/config src/util/deploy.js"
},

View file

@ -5,5 +5,5 @@
"parserOptions": {
"project": ["./tsconfig.eslint.json"]
},
"ignorePatterns": ["dist/*"]
"ignorePatterns": ["**/dist/*"]
}

View file

@ -6,9 +6,9 @@
"type": "module",
"scripts": {
"build": "tsc",
"lint": "prettier --check . && eslint ./src --ext .ts --format=pretty",
"lint": "prettier --check . && eslint --ext .ts --format=pretty src",
"deploy": "node --require dotenv/config dist/util/deploy.js",
"format": "prettier --write . && eslint ./src --ext .ts --fix --format=pretty",
"format": "prettier --write . && eslint --ext .ts --fix --format=pretty src",
"start": "node --require dotenv/config dist/index.js"
},
"dependencies": {

View file

@ -6,8 +6,8 @@
"scripts": {
"test": "yarn docs:test && yarn test:typescript",
"test:typescript": "tsc --noEmit && tsd",
"lint": "prettier --check . && tslint typings/index.d.ts && eslint src --format=pretty",
"format": "prettier --write . && eslint src --fix --format=pretty",
"lint": "prettier --check . && tslint typings/index.d.ts && cross-env ESLINT_USE_FLAT_CONFIG=false eslint --format=pretty src",
"format": "prettier --write . && cross-env ESLINT_USE_FLAT_CONFIG=false eslint --fix --format=pretty src",
"fmt": "yarn format",
"docs": "docgen -i './src/*.js' './src/**/*.js' -c ./docs/index.json -r ../../ -o ./docs/docs.json",
"docs:test": "docgen -i './src/*.js' './src/**/*.js' -c ./docs/index.json -r ../../",
@ -70,6 +70,7 @@
"@discordjs/docgen": "workspace:^",
"@favware/cliff-jumper": "2.1.1",
"@types/node": "16.18.41",
"cross-env": "^7.0.3",
"dtslint": "4.2.1",
"eslint": "8.47.0",
"eslint-formatter-pretty": "5.0.0",

View file

@ -1,7 +0,0 @@
{
"$schema": "https://json.schemastore.org/eslintrc.json",
"extends": "../.eslintrc.json",
"parserOptions": {
"sourceType": "module"
}
}

View file

@ -1,4 +0,0 @@
{
"$schema": "https://json.schemastore.org/eslintrc.json",
"extends": "../../.eslintrc.json"
}

View file

@ -1,2 +1,3 @@
.turbo
dist
coverage

View file

@ -5,8 +5,8 @@
"description": "The docs.json generator for discord.js and its related projects",
"scripts": {
"build": "tsup",
"lint": "prettier --check . && cross-env TIMING=1 eslint src --ext .mjs,.js,.ts --format=pretty",
"format": "prettier --write . && cross-env TIMING=1 eslint src --ext .mjs,.js,.ts --fix --format=pretty",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
"fmt": "yarn format",
"prepack": "yarn format && yarn build"
},
@ -68,7 +68,7 @@
"@types/node": "16.18.41",
"cross-env": "^7.0.3",
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.47",
"eslint-config-neon": "^0.1.54",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"tsup": "^7.2.0",

View file

@ -1,4 +0,0 @@
{
"$schema": "https://json.schemastore.org/eslintrc.json",
"extends": "../../.eslintrc.json"
}

View file

@ -226,11 +226,9 @@ describe('Markdown escapers', () => {
});
test('neither inline code or code block content', () => {
expect(escapeMarkdown(testString, { inlineCodeContent: false, codeBlockContent: false }))
// eslint-disable-next-line max-len
.toEqual(
"\\`_Behold!_\\`\n\\|\\|\\_\\_\\_\\~\\~\\*\\*\\*\\`\\`\\`js\n`use strict`;\nrequire('discord.js');\\`\\`\\`\\*\\*\\*\\~\\~\\_\\_\\_\\|\\|",
);
expect(escapeMarkdown(testString, { inlineCodeContent: false, codeBlockContent: false })).toEqual(
"\\`_Behold!_\\`\n\\|\\|\\_\\_\\_\\~\\~\\*\\*\\*\\`\\`\\`js\n`use strict`;\nrequire('discord.js');\\`\\`\\`\\*\\*\\*\\~\\~\\_\\_\\_\\|\\|",
);
});
test('neither code blocks or code block content', () => {

View file

@ -7,8 +7,8 @@
"test": "vitest run",
"build": "tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --format=pretty",
"format": "prettier --write . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --fix --format=pretty",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "yarn build && yarn lint",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/formatters/*'",
@ -63,7 +63,7 @@
"@vitest/coverage-v8": "^0.34.2",
"cross-env": "^7.0.3",
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.47",
"eslint-config-neon": "^0.1.54",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"tsup": "^7.2.0",

View file

@ -1,4 +0,0 @@
{
"$schema": "https://json.schemastore.org/eslintrc.json",
"extends": "../../.eslintrc.json"
}

View file

@ -7,8 +7,8 @@
"test": "vitest run",
"build": "tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --format=pretty",
"format": "prettier --write . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --fix --format=pretty",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "yarn build && yarn lint",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/next/*'",
@ -81,7 +81,7 @@
"cross-env": "^7.0.3",
"esbuild-plugin-version-injector": "^1.2.0",
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.47",
"eslint-config-neon": "^0.1.54",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"tsup": "^7.2.0",

View file

@ -1,4 +0,0 @@
{
"$schema": "https://json.schemastore.org/eslintrc.json",
"extends": "../../.eslintrc.json"
}

View file

@ -5,8 +5,8 @@
"description": "Lightweight HTTP proxy for Discord's API, brought to you as a container 📦",
"scripts": {
"build": "tsup",
"lint": "prettier --check . && cross-env TIMING=1 eslint src --ext .mjs,.js,.ts --format=pretty",
"format": "prettier --write . && cross-env TIMING=1 eslint src --ext .mjs,.js,.ts --fix --format=pretty",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
"fmt": "yarn format",
"prepack": "yarn lint && yarn build"
},
@ -52,7 +52,7 @@
"@types/node": "18.17.6",
"cross-env": "^7.0.3",
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.47",
"eslint-config-neon": "^0.1.54",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"tsup": "^7.2.0",

View file

@ -1,4 +0,0 @@
{
"$schema": "https://json.schemastore.org/eslintrc.json",
"extends": "../../.eslintrc.json"
}

View file

@ -7,8 +7,8 @@
"test": "vitest run",
"build": "tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --format=pretty",
"format": "prettier --write . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --fix --format=pretty",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
"fmt": "yarn format",
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "yarn lint && yarn test && yarn build",
@ -77,7 +77,7 @@
"@vitest/coverage-v8": "^0.34.2",
"cross-env": "^7.0.3",
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.47",
"eslint-config-neon": "^0.1.54",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"supertest": "^6.3.3",

View file

@ -21,7 +21,7 @@ export function proxyRequests(rest: REST): RequestHandler {
// The 2nd parameter is here so the URL constructor doesn't complain about an "invalid url" when the origin is missing
// we don't actually care about the origin and the value passed is irrelevant
const parsedUrl = new URL(url, 'http://noop');
// eslint-disable-next-line unicorn/no-unsafe-regex, prefer-named-capture-group
// eslint-disable-next-line prefer-named-capture-group
const fullRoute = parsedUrl.pathname.replace(/^\/api(\/v\d+)?/, '') as RouteLike;
const headers: Record<string, string> = {

View file

@ -1,12 +0,0 @@
{
"$schema": "https://json.schemastore.org/eslintrc.json",
"extends": "../../.eslintrc.json",
"rules": {
"n/prefer-global/url": 0,
"n/prefer-global/url-search-params": 0,
"n/prefer-global/buffer": 0,
"n/prefer-global/process": 0,
"no-restricted-globals": 0,
"unicorn/prefer-node-protocol": 0
}
}

View file

@ -7,8 +7,8 @@
"test": "vitest run",
"build": "tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --format=pretty",
"format": "prettier --write . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --fix --format=pretty",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
"fmt": "yarn format",
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "yarn lint && yarn test && yarn build",
@ -100,7 +100,7 @@
"cross-env": "^7.0.3",
"esbuild-plugin-version-injector": "^1.2.0",
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.47",
"eslint-config-neon": "^0.1.54",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"tsup": "^7.2.0",

View file

@ -1 +0,0 @@
src/template

View file

@ -1,4 +0,0 @@
{
"$schema": "https://json.schemastore.org/eslintrc.json",
"extends": "../../.eslintrc.json"
}

View file

@ -6,8 +6,8 @@
"private": true,
"scripts": {
"build": "tsup",
"lint": "prettier --check . && cross-env TIMING=1 eslint src --ext .mjs,.js,.ts --format=pretty",
"format": "prettier --write . && cross-env TIMING=1 eslint src --ext .mjs,.js,.ts --fix --format=pretty",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
"fmt": "yarn format"
},
"exports": {
@ -68,7 +68,7 @@
"@vitest/coverage-v8": "^0.34.2",
"cross-env": "^7.0.3",
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.47",
"eslint-config-neon": "^0.1.54",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"tsup": "^7.2.0",

View file

@ -6,8 +6,8 @@
"test": "vitest run",
"build": "tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --format=pretty",
"format": "prettier --write . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --fix --format=pretty",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "yarn build && yarn lint",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/{name}/*'",

View file

@ -1,18 +0,0 @@
{
"$schema": "https://json.schemastore.org/eslintrc.json",
"extends": ["../../.eslintrc.json", "neon/react", "plugin:storybook/recommended", "@unocss", "neon/prettier"],
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
"react/react-in-jsx-scope": 0,
"react/jsx-filename-extension": [
1,
{
"extensions": [".tsx"]
}
]
}
}

View file

@ -6,8 +6,8 @@
"scripts": {
"test": "vitest run --config ../../vitest.config.ts",
"build": "vite build",
"lint": "prettier --check . && cross-env TIMING=1 eslint src --ext .mjs,.js,.ts,.tsx --format=pretty",
"format": "prettier --write . && cross-env TIMING=1 eslint src --ext .mjs,.js,.ts,.tsx --fix --format=pretty",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
"prepack": "yarn build && yarn lint",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/ui/*'",
"release": "cliff-jumper",
@ -70,16 +70,15 @@
"@types/node": "16.18.41",
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"@unocss/eslint-config": "^0.55.2",
"@unocss/eslint-plugin": "^0.55.2",
"@unocss/reset": "^0.55.2",
"@vitejs/plugin-react": "^4.0.4",
"@vitest/coverage-c8": "^0.33.0",
"chromatic": "^6.22.0",
"chromatic": "^6.23.0",
"cross-env": "^7.0.3",
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.47",
"eslint-config-neon": "^0.1.54",
"eslint-formatter-pretty": "^5.0.0",
"eslint-plugin-storybook": "^0.6.13",
"prettier": "^3.0.2",
"prop-types": "^15.8.1",
"storybook": "^7.3.2",

View file

@ -1,4 +0,0 @@
{
"$schema": "https://json.schemastore.org/eslintrc.json",
"extends": "../../.eslintrc.json"
}

View file

@ -7,8 +7,8 @@
"build": "tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"test": "vitest run && tsd",
"lint": "prettier --check . && TIMING=1 eslint src --ext .mjs,.js,.ts --format=pretty",
"format": "prettier --write . && TIMING=1 eslint src --ext .mjs,.js,.ts --fix --format=pretty",
"lint": "prettier --check . && TIMING=1 eslint --format=pretty src",
"format": "prettier --write . && TIMING=1 eslint --fix --format=pretty src",
"fmt": "yarn format",
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "yarn lint && yarn test && yarn build",
@ -67,7 +67,7 @@
"@vitest/coverage-v8": "^0.34.2",
"cross-env": "^7.0.3",
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.47",
"eslint-config-neon": "^0.1.54",
"eslint-formatter-pretty": "^5.0.0",
"prettier": "^3.0.2",
"tsd": "^0.28.1",

View file

@ -1,3 +1,5 @@
/* eslint-disable n/prefer-global/process */
export function shouldUseGlobalFetchAndWebSocket() {
// Browser env and deno when ran directly
if (typeof globalThis.process === 'undefined') {

View file

@ -1,5 +1,4 @@
/* eslint-disable n/prefer-global/process */
/* eslint-disable no-restricted-globals */
/**
* Resolves the user agent appendix string for the current environment.

View file

@ -1,8 +0,0 @@
{
"$schema": "https://json.schemastore.org/eslintrc.json",
"extends": "../../.eslintrc.json",
"rules": {
"import/extensions": 0,
"no-restricted-globals": 0
}
}

View file

@ -7,8 +7,8 @@
"build": "tsup && node scripts/postbuild.mjs",
"build:docs": "tsc -p tsconfig.docs.json",
"test": "jest --coverage",
"lint": "prettier --check . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --format=pretty",
"format": "prettier --write . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --fix --format=pretty",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
"fmt": "yarn format",
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "yarn lint && yarn test && yarn build",
@ -79,7 +79,7 @@
"cross-env": "^7.0.3",
"esbuild-plugin-version-injector": "^1.2.0",
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.47",
"eslint-config-neon": "^0.1.54",
"eslint-formatter-pretty": "^5.0.0",
"jest": "^29.6.3",
"jest-websocket-mock": "^2.4.1",

View file

@ -17,7 +17,6 @@ const libs = {
return null;
},
close: (opusPacket: Buffer, nonce: Buffer, secretKey: Uint8Array) => {
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
const output = Buffer.allocUnsafe(opusPacket.length + sodium.crypto_box_MACBYTES);
sodium.crypto_secretbox_easy(output, opusPacket, nonce, secretKey);
return output;

View file

@ -1,4 +0,0 @@
{
"$schema": "https://json.schemastore.org/eslintrc.json",
"extends": "../../.eslintrc.json"
}

View file

@ -7,8 +7,8 @@
"test": "vitest run",
"build": "tsup",
"build:docs": "tsc -p tsconfig.docs.json",
"lint": "prettier --check . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --format=pretty",
"format": "prettier --write . && cross-env TIMING=1 eslint src __tests__ --ext .mjs,.js,.ts --fix --format=pretty",
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src __tests__",
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src __tests__",
"docs": "yarn build:docs && api-extractor run --local && api-extractor run --local --config ./api-extractor-docs.json",
"prepack": "yarn build && yarn lint",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/ws/*'",
@ -90,7 +90,7 @@
"cross-env": "^7.0.3",
"esbuild-plugin-version-injector": "^1.2.0",
"eslint": "^8.47.0",
"eslint-config-neon": "^0.1.47",
"eslint-config-neon": "^0.1.54",
"eslint-formatter-pretty": "^5.0.0",
"mock-socket": "^9.2.1",
"prettier": "^3.0.2",

513
yarn.lock

File diff suppressed because it is too large Load diff