Skip to content

Commit

Permalink
fix: enforce type imports (#1370)
Browse files Browse the repository at this point in the history
  • Loading branch information
prescottprue authored Oct 11, 2024
1 parent b0d9e07 commit 72b3377
Show file tree
Hide file tree
Showing 22 changed files with 288 additions and 2,642 deletions.
10 changes: 0 additions & 10 deletions .eslintignore

This file was deleted.

69 changes: 0 additions & 69 deletions .eslintrc.js

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ es
*.log*
.nyc_output/**
coverage/**
**/*.eslintcache
.pnp.*
.yarn/*
!.yarn/patches
Expand Down
1 change: 1 addition & 0 deletions .mocharc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// biome-ignore lint/suspicious/noRedundantUseStrict: preserve
'use strict';

module.exports = {
Expand Down
3 changes: 1 addition & 2 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ test
coverage
.istanbul.yml
.babelrc
.eslintignore
.eslintrc
biome.json
.github
yarn.lock
.travis.yml
Expand Down
4 changes: 0 additions & 4 deletions .prettierignore

This file was deleted.

4 changes: 0 additions & 4 deletions .prettierrc.js

This file was deleted.

76 changes: 76 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.3/schema.json",
"vcs": {
"enabled": false,
"clientKind": "git",
"useIgnoreFile": false
},
"files": {
"ignoreUnknown": false,
"ignore": [
".yarn",
"node_modules",
"coverage",
"lib",
"lib-esm",
"examples"
]
},
"formatter": {
"enabled": true,
"indentStyle": "space"
},
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"suspicious": {
"noConsole": "error"
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
},
"overrides": [
{
"include": ["**/package.json"],
"formatter": {
"lineWidth": 1
}
},
{
"include": ["test/**"],
"linter": {
"rules": {
"complexity": {
"noForEach": "off"
},
"suspicious": {
"noImplicitAnyLet": "off",
"noExplicitAny": "off"
}
}
}
},
{
"include": ["src/**"],
"linter": {
"rules": {
"complexity": {
"useOptionalChain": "off"
},
"suspicious": {
"noImplicitAnyLet": "off",
"noExplicitAny": "off"
}
}
}
}
]
}
1 change: 1 addition & 0 deletions examples/basic/.eslintcache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"/Users/scott/Dev/Code/cypress-firebase/examples/basic/src/index.js":"1","/Users/scott/Dev/Code/cypress-firebase/examples/basic/src/App.js":"2","/Users/scott/Dev/Code/cypress-firebase/examples/basic/src/serviceWorker.js":"3","/Users/scott/Dev/Code/cypress-firebase/examples/basic/src/FirestoreProjects.js":"4","/Users/scott/Dev/Code/cypress-firebase/examples/basic/src/RTDBProjects.js":"5","/Users/scott/Dev/Code/cypress-firebase/examples/basic/src/initFirebase.js":"6","/Users/scott/Dev/Code/cypress-firebase/examples/basic/src/NewProject.js":"7","/Users/scott/Dev/Code/cypress-firebase/examples/basic/src/Project.js":"8","/Users/scott/Dev/Code/cypress-firebase/examples/basic/src/fbConfig.js":"9"},{"size":451,"mtime":1655317617829,"results":"10","hashOfConfig":"11"},{"size":531,"mtime":1655317617829,"results":"12","hashOfConfig":"11"},{"size":4812,"mtime":1655317617829,"results":"13","hashOfConfig":"11"},{"size":1551,"mtime":1655317617829,"results":"14","hashOfConfig":"11"},{"size":1514,"mtime":1655318966047,"results":"15","hashOfConfig":"11"},{"size":1197,"mtime":1655317617829,"results":"16","hashOfConfig":"11"},{"size":806,"mtime":1655317617829,"results":"17","hashOfConfig":"11"},{"size":225,"mtime":1655317617829,"results":"18","hashOfConfig":"11"},{"size":324,"mtime":1655317617829,"results":"19","hashOfConfig":"11"},{"filePath":"20","messages":"21","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"15ic4cq",{"filePath":"22","messages":"23","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"24","messages":"25","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"26","messages":"27","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"28","messages":"29","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"30","messages":"31","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"32","messages":"33","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"34","messages":"35","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"36","messages":"37","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/scott/Dev/Code/cypress-firebase/examples/basic/src/index.js",[],"/Users/scott/Dev/Code/cypress-firebase/examples/basic/src/App.js",[],"/Users/scott/Dev/Code/cypress-firebase/examples/basic/src/serviceWorker.js",[],"/Users/scott/Dev/Code/cypress-firebase/examples/basic/src/FirestoreProjects.js",[],"/Users/scott/Dev/Code/cypress-firebase/examples/basic/src/RTDBProjects.js",[],"/Users/scott/Dev/Code/cypress-firebase/examples/basic/src/initFirebase.js",[],"/Users/scott/Dev/Code/cypress-firebase/examples/basic/src/NewProject.js",[],"/Users/scott/Dev/Code/cypress-firebase/examples/basic/src/Project.js",[],"/Users/scott/Dev/Code/cypress-firebase/examples/basic/src/fbConfig.js",[]]
27 changes: 7 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"clean": "rimraf lib lib-esm",
"build": "tsc",
"watch": "yarn build --watch",
"lint": "eslint . --ext .js,.ts",
"lint:fix": "yarn lint --fix",
"format:check": "prettier --check .",
"format": "prettier --write .",
"format": "biome format --write",
"format:check": "biome format",
"lint": "biome lint",
"lint:fix": "biome lint --write",
"test:base": "GCLOUD_PROJECT=test-project NODE_OPTIONS='--import tsx' mocha ./test/unit/**/*.spec.ts",
"test:cov:base": "nyc --reporter=lcov --reporter=html yarn test:base",
"test:watch": "yarn test:base --watch",
Expand All @@ -26,6 +26,7 @@
"firebase-admin": "^11.0.0 || ^12.0.0"
},
"devDependencies": {
"@biomejs/biome": "^1.9.3",
"@commitlint/cli": "19.5.0",
"@commitlint/config-conventional": "19.5.0",
"@firebase/rules-unit-testing": "3.0.4",
Expand All @@ -36,26 +37,15 @@
"@types/mocha": "10.0.9",
"@types/node": "20.16.11",
"@types/sinon-chai": "4.0.0",
"@typescript-eslint/eslint-plugin": "8.8.1",
"@typescript-eslint/parser": "8.8.1",
"chai": "4.5.0",
"cypress": "13.15.0",
"eslint": "8.57.1",
"eslint-config-airbnb-base": "15.0.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-babel": "5.3.1",
"eslint-plugin-import": "2.31.0",
"eslint-plugin-jsdoc": "50.3.1",
"eslint-plugin-jsx-a11y": "6.10.0",
"eslint-plugin-prettier": "5.2.1",
"firebase": "10.14.1",
"firebase-admin": "12.3.0",
"firebase-tools": "13.22.0",
"husky": "9.1.6",
"lint-staged": "15.2.10",
"mocha": "10.7.3",
"nyc": "17.1.0",
"prettier": "3.3.3",
"rimraf": "6.0.1",
"sinon": "15.2.0",
"sinon-chai": "4.0.0",
Expand Down Expand Up @@ -94,11 +84,8 @@
"index.d.ts"
],
"lint-staged": {
"*.{json,md,yaml,yml}": [
"prettier --write"
],
"*.{js,ts}": [
"eslint --fix"
"*.{js,ts,json,md,yaml,yml}": [
"biome check --no-errors-on-unmatched --write"
]
},
"size-limit": [
Expand Down
5 changes: 4 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>prescottprue/renovate-config:library"],
"extends": [
"github>prescottprue/renovate-config:library",
"customManagers:biomeVersions"
],
"packageRules": [
{
"description": "Disable dep updates to react-redux-firebase example (needs manual updating)",
Expand Down
5 changes: 2 additions & 3 deletions src/attachCustomCommands.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { auth, firestore } from 'firebase-admin';
import type { authCreateUser } from './tasks';
import { typedTask, TaskNameToParams } from './tasks';
import { type TaskNameToParams, typedTask } from './tasks';

/**
* Params for attachCustomCommand function for
Expand Down Expand Up @@ -165,9 +165,7 @@ export interface CallRtdbOptions {

// Add custom commands to the existing Cypress interface
declare global {
/* eslint-disable @typescript-eslint/no-namespace */
namespace Cypress {
/* eslint-enable @typescript-eslint/no-namespace,@typescript-eslint/no-unused-vars */
interface Chainable {
/**
* Call Real Time Database path with some specified action. Authentication is through
Expand Down Expand Up @@ -944,6 +942,7 @@ export default function attachCustomCommands(
// Attach options if they exist
taskSettings.options = options;
}
// biome-ignore lint/correctness/noVoidTypeReturn: keeping src the same
return cy.task('callFirestore', taskSettings);
},
);
Expand Down
1 change: 1 addition & 0 deletions src/extendWithFirebaseConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export default function extendWithFirebaseConfig(
'GCLOUD_PROJECT',
].reduce(
(acc, varKey) =>
// biome-ignore lint/performance/noAccumulatingSpread: list is small
process.env[varKey] ? { ...acc, [varKey]: process.env[varKey] } : acc,
{},
);
Expand Down
Loading

0 comments on commit 72b3377

Please sign in to comment.