Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: no longer depends on hd-scripts, packages use/configure eslint directly, fixes warnings from npm lint script #1058

Merged
merged 43 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
587bcc5
tests pass on fix for session proofs
gobengo Oct 30, 2023
083a54b
packages/access-client no longer uses hd-scripts (fixes eslint warning)
gobengo Nov 1, 2023
c84ee62
lint
gobengo Nov 1, 2023
079d50d
package.json for access-client no longer configures unicorn eslint rules
gobengo Nov 1, 2023
b63f49c
rm unused fn
gobengo Nov 1, 2023
6f4866e
rm old #delegations code from bad rebase
gobengo Nov 1, 2023
3503b1a
more fix from bad rebase
gobengo Nov 1, 2023
0ecd73f
fix bad rebase
gobengo Nov 1, 2023
3a22fab
fix depcheck error for access-client
gobengo Nov 1, 2023
7e6a2c3
packages/capabilities no longer uses hd-scripts for eslint
gobengo Nov 1, 2023
6e2b6ef
upload-client uses eslint directly not via hd-scripts
gobengo Nov 1, 2023
d53ccb1
packages/filecoin-client uses eslint directly sans hd-scripts
gobengo Nov 1, 2023
2c3b486
w3up-client no longer uses hd-scripts
gobengo Nov 1, 2023
509a966
packages/did-mailto no longer uses hd-scripts
gobengo Nov 1, 2023
f6a3ad1
packages/upload-api no longer uses hd-scripts
gobengo Nov 1, 2023
3d97f4c
re-add include to filecoin-client tsconfig.json
gobengo Nov 1, 2023
b77c3fc
filecoin-api no longer uses hd-scripts
gobengo Nov 1, 2023
e1b0ac8
fix depcheck in upload-api
gobengo Nov 1, 2023
311e7a7
fix depcheck for did-mailto
gobengo Nov 1, 2023
ddeab48
fix depcheck for filecoin-client
gobengo Nov 1, 2023
b8dd983
fix depcheck for w3up-client
gobengo Nov 1, 2023
950d859
re-pnpm-lock.yaml
gobengo Nov 1, 2023
1943d2a
add packages/eslint-config-w3up
gobengo Nov 2, 2023
4bfaa72
packages/capabilities uses packages/eslint-config-w3up
gobengo Nov 2, 2023
1c4af2c
packages/did-mailto uses packages/eslint-config-w3up
gobengo Nov 2, 2023
0deb2da
pnpm i
gobengo Nov 2, 2023
655506f
packages/filecoin-api uses packages/eslint-config-w3up
gobengo Nov 2, 2023
7dab2bb
packages/filecoin-client uses packages/eslint-config-w3up
gobengo Nov 2, 2023
2dd997b
packages/upload-api uses packages/eslint-config-w3up
gobengo Nov 2, 2023
5e091bc
packages/upload-client uses packages/eslint-config-w3up
gobengo Nov 2, 2023
a47c966
packages/w3up-client uses packages/eslint-config-w3up
gobengo Nov 2, 2023
45cc0ec
depcheck
gobengo Nov 2, 2023
e0a496e
did-mailto spec imports assert from node:assert
gobengo Nov 2, 2023
86cbd84
Revert "did-mailto spec imports assert from node:assert"
gobengo Nov 2, 2023
a2fd63e
w3up-client devDep on assert
gobengo Nov 2, 2023
f527866
w3up-client devDep on @types/node
gobengo Nov 2, 2023
8c9f831
more dep on assert
gobengo Nov 2, 2023
4cb718e
Revert "more dep on assert"
gobengo Nov 2, 2023
3206cc6
w3up-client devDep on @types/assert
gobengo Nov 2, 2023
9ddce7e
add assert back as devDep of w3up-client
gobengo Nov 2, 2023
12172b1
did-mailto devDep on @types/assert
gobengo Nov 2, 2023
2704b32
adjust access eslint env
gobengo Nov 2, 2023
c056da0
remove ugly jsdocs that eslint fix added
gobengo Nov 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 6 additions & 29 deletions packages/access-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"uint8arrays": "^4.0.6"
},
"devDependencies": {
"@web3-storage/eslint-config-w3up": "workspace:^",
"@types/assert": "^1.5.6",
"@types/inquirer": "^9.0.4",
"@types/mocha": "^10.0.1",
Expand All @@ -86,7 +87,6 @@
"@types/ws": "^8.5.4",
"@ucanto/server": "^9.0.1",
"assert": "^2.0.0",
"hd-scripts": "^4.0.0",
"mocha": "^10.2.0",
"playwright-test": "^12.3.4",
"sinon": "^15.0.3",
Expand All @@ -95,37 +95,14 @@
},
"eslintConfig": {
"extends": [
"./node_modules/hd-scripts/eslint/index.js"
"@web3-storage/eslint-config-w3up"
],
"parserOptions": {
"project": "./tsconfig.json"
},
"rules": {
"unicorn/prefer-number-properties": "off",
"unicorn/prefer-export-from": "off",
"unicorn/expiring-todo-comments": "off",
"unicorn/no-array-reduce": "off",
"unicorn/explicit-length-check": "off",
"no-continue": "off",
"jsdoc/no-undefined-types": [
"error",
{
"definedTypes": [
"ArrayLike",
"AsyncIterable",
"AsyncIterableIterator",
"Iterable",
"IterableIterator",
"Generator",
"CryptoKeyPair",
"NodeJS",
"ErrorOptions",
"IDBTransactionMode"
]
}
]
},
"env": {
"browser": true,
"es2022": true,
"mocha": true
},
"ignorePatterns": [
Expand All @@ -138,8 +115,8 @@
],
"ignores": [
"@types/*",
"hd-scripts",
"assert"
"assert",
"@web3-storage/eslint-config-w3up"
]
}
}
1 change: 1 addition & 0 deletions packages/access-client/src/agent-use-cases.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export async function pollAccessClaimUntil(
opts
) {
const interval = opts?.interval || 250
// eslint-disable-next-line no-constant-condition
while (true) {
if (opts?.signal?.aborted)
throw opts.signal.reason ?? new Error('operation aborted')
Expand Down
1 change: 0 additions & 1 deletion packages/access-client/src/crypto/aes-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export class AesKey {
)
const encryptedBytes = new Uint8Array(buf)
const encrypted = uint8arrays.toString(
// eslint-disable-next-line unicorn/prefer-spread
uint8arrays.concat([iv, encryptedBytes]),
'base64pad'
)
Expand Down
1 change: 0 additions & 1 deletion packages/access-client/src/crypto/encoding.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export function decompressP256(comp) {
yPadded.set(y, offset)

// concat coords & prepend P-256 prefix
// eslint-disable-next-line unicorn/prefer-spread
const publicKey = uint8arrays.concat([[0x04], x, yPadded])
return publicKey
}
5 changes: 1 addition & 4 deletions packages/access-client/src/crypto/p256-ecdh.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ async function didFromPubkey(pubkey) {
const buf = await webcrypto.subtle.exportKey('raw', pubkey)
const bytes = new Uint8Array(buf)
return DID.format(
DID.decode(
// eslint-disable-next-line unicorn/prefer-spread
uint8arrays.concat([P256_DID_PREFIX, compressP256Pubkey(bytes)])
)
DID.decode(uint8arrays.concat([P256_DID_PREFIX, compressP256Pubkey(bytes)]))
)
}

Expand Down
1 change: 0 additions & 1 deletion packages/access-client/src/encoding.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*
* @module
*/
/* eslint-disable unicorn/prefer-spread */
import { CarBufferReader } from '@ipld/car/buffer-reader'
import * as CarBufferWriter from '@ipld/car/buffer-writer'
import { Delegation } from '@ucanto/core/delegation'
Expand Down
1 change: 1 addition & 0 deletions packages/access-client/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ export interface SpaceMeta {
* Agent class types
*/

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export interface AgentOptions<S extends Record<string, any>> {
url?: URL
connection?: ConnectionView<S>
Expand Down
1 change: 0 additions & 1 deletion packages/access-client/test/agent-data.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import * as ucanto from '@ucanto/core'

describe('AgentData', () => {
it('should not destructure store methods', async () => {
// eslint-disable-next-line unicorn/no-await-expression-member
const raw = (await AgentData.create()).export()
class Store {
async open() {}
Expand Down
2 changes: 0 additions & 2 deletions packages/access-client/test/agent.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ describe('Agent', function () {
const { nb: input } = capability
const ucan = Delegation.view(
{ root: input.ucan, blocks: invocation.blocks },
// eslint-disable-next-line unicorn/no-null
null
)
return ucan
Expand Down Expand Up @@ -424,7 +423,6 @@ describe('Agent', function () {
// the agent has a delegation+sesssion for each service
const services = [serviceAWeb, serviceBWeb]
for (const service of services) {
// eslint-disable-next-line unicorn/no-await-expression-member
const nonce = (await ed25519.Signer.generate()).did()
const delegation = await ucanto.delegate({
issuer: Absentee.from({ id: account }),
Expand Down
28 changes: 8 additions & 20 deletions packages/capabilities/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@
"@web3-storage/data-segment": "^3.2.0"
},
"devDependencies": {
"@web3-storage/eslint-config-w3up": "workspace:^",
"@types/assert": "^1.5.6",
"@types/mocha": "^10.0.0",
"@types/node": "^20.8.4",
"assert": "^2.0.0",
"hd-scripts": "^4.0.0",
"mocha": "^10.2.0",
"playwright-test": "^12.3.4",
"type-fest": "^3.3.0",
Expand All @@ -101,28 +101,16 @@
},
"eslintConfig": {
"extends": [
"./node_modules/hd-scripts/eslint/index.js"
"@web3-storage/eslint-config-w3up"
],
"parserOptions": {
"project": "./tsconfig.json"
},
"rules": {
"unicorn/expiring-todo-comments": "off",
"unicorn/numeric-separators-style": "off",
"unicorn/prefer-number-properties": "off",
"unicorn/prefer-export-from": "off",
"unicorn/no-array-reduce": "off",
"jsdoc/no-undefined-types": [
"error",
{
"definedTypes": [
"Iterable"
]
}
]
},
"env": {
"mocha": true
"es2022": true,
"mocha": true,
"browser": true,
"node": true
},
"ignorePatterns": [
"dist",
Expand All @@ -135,8 +123,8 @@
],
"ignores": [
"@types/*",
"hd-scripts",
"assert"
"assert",
"@web3-storage/eslint-config-w3up"
]
}
}
1 change: 0 additions & 1 deletion packages/capabilities/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export function equalWith(child, parent) {
* @param {unknown} parent
* @param {string} constraint
*/

export function equal(child, parent, constraint) {
if (parent === undefined || parent === '*') {
return ok({})
Expand Down
1 change: 0 additions & 1 deletion packages/capabilities/test/capabilities/store.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable unicorn/no-null */
import assert from 'assert'
import { access } from '@ucanto/validator'
import { Verifier } from '@ucanto/principal'
Expand Down
18 changes: 4 additions & 14 deletions packages/did-mailto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,33 +31,23 @@
"attw": "attw --pack .",
"build": "tsc --build",
"check": "tsc --build",
"lint": "tsc --build",
"lint": "tsc --build && eslint '**/*.{js,ts}' && prettier --check '**/*.{js,ts,yml,json}' --ignore-path ../../.gitignore",
"test": "mocha --bail --timeout 10s -n no-warnings -n experimental-vm-modules -n experimental-fetch test/**/*.spec.js",
"test-watch": "pnpm build && mocha --bail --timeout 10s --watch --parallel -n no-warnings -n experimental-vm-modules -n experimental-fetch --watch-files src,test"
},
"devDependencies": {
"@web3-storage/eslint-config-w3up": "workspace:^",
"@types/assert": "^1.5.6",
"@types/mocha": "^10.0.1",
"@types/node": "^20.8.4",
"hd-scripts": "^4.1.0",
"mocha": "^10.2.0"
},
"eslintConfig": {
"extends": [
"./node_modules/hd-scripts/eslint/index.js"
"@web3-storage/eslint-config-w3up"
],
"parserOptions": {
"project": "./tsconfig.json"
},
"rules": {
"jsdoc/no-undefined-types": [
"error",
{
"definedTypes": [
"Iterable"
]
}
]
},
"env": {
"mocha": true
},
Expand Down
8 changes: 6 additions & 2 deletions packages/did-mailto/test/did-mailto.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ describe('did-mailto', () => {
})

/**
* @param {typeof didMailto} didMailto
* @param {import("./test-types.js").TestAdder} test
* @param {typeof didMailto} didMailto - did-mailto module to test
* @param {import("./test-types.js").TestAdder} test - function to call to add a named test
*/
function testDidMailto(didMailto, test) {
test('module is an object', async () => {
Expand Down Expand Up @@ -37,6 +37,7 @@ function testDidMailto(didMailto, test) {
}
}

/** @yields examples for testing */
function* examples() {
yield {
email: didMailto.email('[email protected]'),
Expand All @@ -48,6 +49,9 @@ function* examples() {
}
}

/**
* @yields many valid-but-unusual email addresses
*/
function* validEmailAddresses() {
// https://gist.github.com/cjaoude/fd9910626629b53c4d25#file-gistfile1-txt-L5
yield* [
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-config-w3up/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules
61 changes: 61 additions & 0 deletions packages/eslint-config-w3up/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
'use strict'

module.exports = {
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jsdoc/recommended",
],
rules: {
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/ban-ts-comment": "off",

/**
* many of these rules are inherited from hd-scripts.
* It may be useful over time to remove these rules
* and juse use plugin:jsdoc/recommended defaults.
* But that might require updating src.
*/
"jsdoc/check-values": "off",
"jsdoc/check-tag-names": "off",
"jsdoc/require-jsdoc": [
"warn",
{
"publicOnly": true
}
],
"jsdoc/require-returns": "off",
"jsdoc/require-returns-type": "off",
"jsdoc/require-throws": "off",
"jsdoc/require-yields": "off",
"jsdoc/require-param-description": "off",
"jsdoc/require-property-description": "off",
"jsdoc/require-returns-description": "off",
"jsdoc/valid-types": "off",
"jsdoc/tag-lines": [
"error",
"any",
{
"startLines": 1
}
],
"jsdoc/no-undefined-types": [
"error",
{
"definedTypes": [
"ArrayLike",
"AsyncIterable",
"AsyncIterableIterator",
"Iterable",
"IterableIterator",
"Generator",
"CryptoKeyPair",
"NodeJS",
"ErrorOptions",
"IDBTransactionMode"
]
}
]

}
}
25 changes: 25 additions & 0 deletions packages/eslint-config-w3up/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "@web3-storage/eslint-config-w3up",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"lint": "eslint '**/*.{js,ts}'"
},
"author": "",
"license": "ISC",
"dependencies": {
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"eslint-plugin-jsdoc": "^46.8.2"
},
"peerDependencies": {
"eslint": ">= 8"
},
"eslintConfig": {
"extends": "./index.js",
"env": {
"node": true
}
}
}
Loading