mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
chore: Migrate ESLint and prettier to Biome (#3634)
* Migrate eslint and prettier to biomejs This does NOT include examples/bigbot as it has its own formatter * Update to biome 1.8.0 * Readd dotenv dev dependency to rest During a merge it got lost
This commit is contained in:
@@ -18,8 +18,8 @@
|
||||
"build": "swc src --strip-leading-paths --delete-dir-on-start src --out-dir dist/esm && swc --strip-leading-paths --delete-dir-on-start src --out-dir dist/cjs -C module.type=commonjs && node ../../scripts/fixCjsExtension.js",
|
||||
"build:type": "tsc --skipDefaultLibCheck --declaration --emitDeclarationOnly --declarationDir dist/types",
|
||||
"release-build": "yarn build && yarn build:type",
|
||||
"fmt": "eslint --fix \"src/**/*.ts*\"",
|
||||
"lint": "eslint \"src/**/*.ts*\"",
|
||||
"fmt": "biome format --write",
|
||||
"lint": "biome lint --write",
|
||||
"test:unit-coverage": "c8 mocha --no-warnings 'tests/**/*.spec.ts'",
|
||||
"test:unit": "c8 --r lcov mocha --no-warnings 'tests/**/*.spec.ts' && node ../../scripts/coveragePathFixing.js utils",
|
||||
"test:deno-unit": "swc tests --strip-leading-paths --delete-dir-on-start -C jsc.minify.mangle=false --out-dir denoTestsDist && node ../../scripts/fixDenoTestExtension.js && deno test -A --import-map ../../denoImportMap.json denoTestsDist",
|
||||
@@ -32,6 +32,7 @@
|
||||
"@discordeno/types": "19.0.0-beta.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "^1.8.0",
|
||||
"@swc/cli": "^0.4.0",
|
||||
"@swc/core": "^1.4.2",
|
||||
"@types/chai": "^4.3.16",
|
||||
@@ -40,8 +41,6 @@
|
||||
"@types/sinon": "^17.0.3",
|
||||
"c8": "^9.1.0",
|
||||
"chai": "^5.1.1",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-discordeno": "*",
|
||||
"mocha": "^10.5.1",
|
||||
"sinon": "^18.0.0",
|
||||
"ts-node": "^10.9.2",
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface PlaceHolderBot {}
|
||||
|
||||
export class Collection<K, V> extends Map<K, V> {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
||||
|
||||
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
||||
// A module to print ANSI terminal colors. Inspired by chalk, kleur, and colors
|
||||
// on npm.
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { type BigString, type GetGuildWidgetImageQuery, type ImageFormat, type ImageSize, StickerFormatTypes } from '@discordeno/types'
|
||||
import { iconBigintToHash } from './hash.js'
|
||||
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-confusing-void-expression */
|
||||
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import { bgBrightMagenta, black, bold, cyan, gray, italic, red, yellow } from './colors.js'
|
||||
|
||||
export enum LogLevels {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/** Pause the execution for a given amount of milliseconds. */
|
||||
export async function delay(ms: number): Promise<void> {
|
||||
// eslint-disable-next-line @typescript-eslint/return-await
|
||||
return new Promise(
|
||||
(resolve): NodeJS.Timeout =>
|
||||
setTimeout((): void => {
|
||||
@@ -12,8 +11,6 @@ export async function delay(ms: number): Promise<void> {
|
||||
// Typescript is not so good as we developers so we need this little utility function to help it out
|
||||
// Taken from https://fettblog.eu/typescript-hasownproperty/
|
||||
/** TS save way to check if a property exists in an object */
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export function hasProperty<T extends {}, Y extends PropertyKey = string>(obj: T, prop: Y): obj is T & Record<Y, unknown> {
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
return obj.hasOwnProperty(prop)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Buffer } from 'node:buffer'
|
||||
import { expect } from 'chai'
|
||||
import { describe, it } from 'mocha'
|
||||
import { Buffer } from 'node:buffer'
|
||||
import { decode, encode } from '../src/base64.js'
|
||||
|
||||
describe('base64.ts', () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { expect } from 'chai'
|
||||
import { describe, it } from 'mocha'
|
||||
import { camelize, snakelize, snakeToCamelCase } from '../src/casing.js'
|
||||
import { camelize, snakeToCamelCase, snakelize } from '../src/casing.js'
|
||||
|
||||
describe('casting.ts', () => {
|
||||
describe('camelize function', () => {
|
||||
|
||||
@@ -108,24 +108,24 @@ describe('collection.ts', () => {
|
||||
|
||||
describe('.find() method', () => {
|
||||
it('will find value by value', () => {
|
||||
expect(collection.find((v, k) => v === 'tri')).to.be.equal('tri')
|
||||
expect(collection.find((v, k) => v === 'skillz')).to.be.undefined
|
||||
expect(collection.find((v) => v === 'tri')).to.be.equal('tri')
|
||||
expect(collection.find((v) => v === 'skillz')).to.be.undefined
|
||||
})
|
||||
|
||||
it('will find value by key', () => {
|
||||
expect(collection.find((v, k) => k === 'proficient')).to.be.equal('yui')
|
||||
expect(collection.find((v, k) => k === 'skillz')).to.be.undefined
|
||||
expect(collection.find((_v, k) => k === 'proficient')).to.be.equal('yui')
|
||||
expect(collection.find((_v, k) => k === 'skillz')).to.be.undefined
|
||||
})
|
||||
})
|
||||
|
||||
describe('.filter() method', () => {
|
||||
it('will filter by key', () => {
|
||||
expect(collection.filter((v, k) => v === 'yui').array()).to.deep.equal(['yui'])
|
||||
expect(collection.filter((v, k) => v === 'skillz').array()).to.deep.equal([])
|
||||
expect(collection.filter((v) => v === 'yui').array()).to.deep.equal(['yui'])
|
||||
expect(collection.filter((v) => v === 'skillz').array()).to.deep.equal([])
|
||||
})
|
||||
it('will filter by key', () => {
|
||||
expect(collection.filter((v, k) => k === 'best').array()).to.deep.equal(['tri'])
|
||||
expect(collection.filter((v, k) => k === 'skillz').array()).to.deep.equal([])
|
||||
expect(collection.filter((_v, k) => k === 'best').array()).to.deep.equal(['tri'])
|
||||
expect(collection.filter((_v, k) => k === 'skillz').array()).to.deep.equal([])
|
||||
})
|
||||
})
|
||||
|
||||
@@ -201,7 +201,6 @@ describe('collection.ts', () => {
|
||||
|
||||
describe('.changeSweeperFilter() method', () => {
|
||||
it('will call startSweeper with new interval', () => {
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
||||
const newFilter = () => true
|
||||
collection.startSweeper({ filter: () => false, interval: 1000 })
|
||||
collection.changeSweeperFilter(newFilter)
|
||||
@@ -209,7 +208,6 @@ describe('collection.ts', () => {
|
||||
})
|
||||
|
||||
it('will not startsweeper if not started', () => {
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
||||
const newFilter = () => true
|
||||
collection.changeSweeperFilter(newFilter)
|
||||
expect(collection.sweeper).to.undefined
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { expect } from 'chai'
|
||||
import { describe, it } from 'mocha'
|
||||
import { iconBigintToHash, iconHashToBigInt } from '../src/hash.js'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { expect } from 'chai'
|
||||
import { describe, it } from 'mocha'
|
||||
import { LogDepth, LogLevels, createLogger } from '../src/logger.js'
|
||||
import { expect } from 'chai'
|
||||
|
||||
describe('Logger', () => {
|
||||
it('create logger with default options', () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Buffer } from 'node:buffer'
|
||||
import { expect } from 'chai'
|
||||
import { describe, it } from 'mocha'
|
||||
import { Buffer } from 'node:buffer'
|
||||
import { getBotIdFromToken, removeTokenPrefix } from '../src/token.js'
|
||||
|
||||
describe('token.ts', () => {
|
||||
|
||||
Reference in New Issue
Block a user