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

typecheck tests and bump typescript-eslint #2674

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
1e12520
chore: bump yarn to 4.6
turadg Dec 30, 2024
1d2b1d1
chore(deps): bump lint deps
turadg Dec 30, 2024
49542b9
chore(deps): bump prettier 3.4.2
turadg Dec 30, 2024
4dd027a
chore(deps): major bump typescript-eslint (8.18.2)
turadg Dec 30, 2024
8e29780
lint(types): include "test"
turadg Dec 30, 2024
efc3c6d
chore(types): conform
turadg Dec 30, 2024
ae2f3d1
chore(types): conform 'where"
turadg Dec 30, 2024
090b7b7
chore(types): conform "stream"
turadg Dec 30, 2024
f6a36a2
chore(types): conform "syrup"
turadg Dec 30, 2024
fff384e
lint: allow optional chaining in tests
turadg Dec 30, 2024
ae19195
chore(types): conform "ses"
turadg Dec 30, 2024
ad663a1
chore(types): conform "pass-style"
turadg Dec 30, 2024
67f40c9
chore(types): conform 'module-source'
turadg Dec 30, 2024
532026c
chore(types): conform 'netstring'
turadg Dec 30, 2024
42634d6
chore(types): conform 'exo'
turadg Dec 30, 2024
9d9f878
chore(types): conform 'far'
turadg Dec 30, 2024
d3ba182
chore(types): conform 'eventual-send'
turadg Dec 30, 2024
5f1988c
chore(types): conform 'captp'
turadg Dec 30, 2024
f7846f2
chore(types): conform 'bundle-source'
turadg Dec 30, 2024
08faeb0
chore(types): conform 'cli'
turadg Dec 30, 2024
5e5ed6c
test: s/strip/elide/
turadg Dec 30, 2024
eaf3fad
chore(types): conform 'evasive-transform'
turadg Dec 30, 2024
2add234
chore(types): conform 'ses-ava'
turadg Dec 30, 2024
fd9a25a
lint(types): remove 'strict' in evasive-transform
turadg Dec 30, 2024
f8b96b6
chore(types): conform 'compartment-mapper'
turadg Dec 30, 2024
d43cf2a
chore(types): conform 'stream-node'
turadg Dec 30, 2024
266c10e
chore(types): conform 'lp32'
turadg Dec 30, 2024
d6897d4
chore(types): conform 'import-bundle'
turadg Dec 30, 2024
dc9a3ee
chore(types): conform 'nat'
turadg Dec 30, 2024
5616803
chore(types): conform 'immutable-arraybuffer'
turadg Dec 30, 2024
3944089
chore(types): conform 'common'
turadg Dec 30, 2024
a3f89e1
chore(types): conform 'init'
turadg Dec 30, 2024
1d04823
chore(types): conform 'zip'
turadg Dec 30, 2024
30fce0f
chore(types): conform 'daemon'
turadg Dec 30, 2024
3c5dce5
lint: include eslint-ed files in tsconfig
turadg Dec 30, 2024
00cd946
chore(types): conform
turadg Dec 30, 2024
7d467c8
chore(deps): repair typescript-eslint config
turadg Dec 30, 2024
347275f
lint: ignore bundle-source/demo
turadg Dec 30, 2024
fd3c3f7
fixup! test: s/strip/elide/
turadg Dec 30, 2024
e4059e5
lint: skipLibCheck in ses
turadg Dec 30, 2024
8298cdc
build: omit d.ts twin from ts build
turadg Dec 31, 2024
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
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@
"engines": {
"node": ">=16"
},
"packageManager": "yarn@4.5.1",
"packageManager": "yarn@4.6.0",
"devDependencies": {
"@jessie.js/eslint-plugin": "^0.4.1",
"@octokit/core": "^3.4.0",
"@types/node": "^20.9.0",
"ava": "^6.1.3",
"eslint": "^8.57.0",
"eslint": "^8.57.1",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-jessie": "^0.0.6",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^50.4.3",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsdoc": "^50.6.1",
"lerna": "^8.1.8",
"prettier": "^3.3.3",
"prettier": "^3.4.2",
"type-coverage": "^2.29.1",
"typedoc": "^0.26.6",
"typedoc-plugin-markdown": "^4.2.5",
"typescript": "~5.6.3",
"typescript-eslint": "^7.3.1",
"typescript-eslint": "^8.18.2",
"zx": "^8.1.8"
},
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions packages/base64/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@
"ava": "^6.1.3",
"babel-eslint": "^10.1.0",
"c8": "^7.14.0",
"eslint": "^8.57.0",
"eslint": "^8.57.1",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.29.1",
"prettier": "^3.3.3",
"eslint-plugin-import": "^2.31.0",
"prettier": "^3.4.2",
"typescript": "~5.6.3"
},
"files": [
Expand Down
1 change: 1 addition & 0 deletions packages/base64/test/_bench-main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
/* eslint-disable no-restricted-globals */
/* global print */

Expand Down
3 changes: 2 additions & 1 deletion packages/base64/test/main.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ test('invalid encodings', t => {
];
for (const [badInput, message] of badInputs) {
t.throws(
// @ts-expect-error intentional error
() => decodeBase64(badInput),
message && { message },
message ? { message } : undefined,
`${badInput} is rejected`,
);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/base64/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"include": [
"*.js",
"*.ts",
"src/**/*.js",
"src/**/*.ts"
"src",
"test"
]
}
2 changes: 1 addition & 1 deletion packages/bundle-source/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/dist/
/scripts/
/demo/tildot/
/demo/
1 change: 1 addition & 0 deletions packages/bundle-source/demo/reexport-fortune-ts.js
Copy link
Contributor

@boneskull boneskull Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe exclude this dir from typechecking? same with other frequent @ts-nocheck directives

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
/* eslint-disable @endo/restrict-comparison-operands */

export { fortune } from './fortune.ts';
Expand Down
1 change: 1 addition & 0 deletions packages/bundle-source/demo/reexport-fortune-ts.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
export { fortune } from './fortune.ts';

if ((0).toFixed.apply<Number, String>(1) === false) {
Expand Down
1 change: 1 addition & 0 deletions packages/bundle-source/demo/reexport-meaning-js.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
export { meaning } from './meaning.js';

if ((0).toFixed.apply<Number, String>(1) === false) {
Expand Down
2 changes: 1 addition & 1 deletion packages/bundle-source/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@endo/zip": "workspace:^",
"ava": "^6.1.3",
"c8": "^7.14.0",
"eslint": "^8.57.0",
"eslint": "^8.57.1",
"typescript": "~5.6.3"
},
"keywords": [],
Expand Down
1 change: 1 addition & 0 deletions packages/bundle-source/test/endo-script-format.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import bundleSource from '../src/index.js';
* @param {string} entry
* @param {Options} options
*/
// @ts-expect-error 'Options' could be instantiated with a different subtype of constraint 'Partial<any>'.
const generate = async (entry, options = {}) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const generate = async (entry, options = {}) => {
const generate = async (entry, options) => {

This should suppress the error, but then you'll need to supply an empty object somewhere below

const entryPath = url.fileURLToPath(new URL(entry, import.meta.url));
return bundleSource(entryPath, {
Expand Down
1 change: 1 addition & 0 deletions packages/bundle-source/test/no-transforms.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ test('no-transforms applies no transforms', async t => {
const entryPath = url.fileURLToPath(
new URL(`../demo/circular/a.js`, import.meta.url),
);
// @ts-expect-error Property 'endoZipBase64' does not exist on type '{ moduleFormat: "endoScript"; source: string; } | { moduleFormat: "endoZipBase64"; endoZipBase64: string; endoZipBase64Sha512: string; } | { moduleFormat: "nestedEvaluate"; source: string; sourceMap: string; } | { ...; }'.
Copy link
Contributor

@boneskull boneskull Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like we'll need to use @overload to define bundleSource

const { endoZipBase64 } = await bundleSource(entryPath, {
moduleFormat: 'endoZipBase64',
noTransforms: true,
Expand Down
1 change: 1 addition & 0 deletions packages/bundle-source/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"allowJs": true
},
"exclude": [
"src/exports.*",
"test/"
]
}
5 changes: 3 additions & 2 deletions packages/bundle-source/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"include": [
"*.js",
"*.ts",
"src/**/*.js",
"src/**/*.ts"
"demo",
"src",
"test"
]
}
2 changes: 1 addition & 1 deletion packages/captp/src/captp.js
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ export const makeCapTP = (
};

// Abort a connection.
const abort = (reason = undefined) => {
const abort = reason => {
dispatch({ type: 'CTP_DISCONNECT', epoch, reason });
};

Expand Down
1 change: 0 additions & 1 deletion packages/captp/test/engine-gc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* global globalThis */
export const detectEngineGC = async () => {
/** @type {() => void} */
const globalGC = globalThis.gc;
if (typeof globalGC === 'function') {
return globalGC;
Expand Down
5 changes: 4 additions & 1 deletion packages/captp/test/worker.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import '@endo/init/pre-remoting.js';
import '@endo/init/debug.js';

import { parentPort } from 'worker_threads';
import { parentPort as maybeParentPort } from 'worker_threads';
import { Fail } from '@endo/errors';
import { makeGuest, makeHost } from './traplib.js';

if (!maybeParentPort) throw new Error('null parentPort');
const parentPort = maybeParentPort;

let dispatch;
parentPort.addListener('message', obj => {
switch (obj.type) {
Expand Down
4 changes: 2 additions & 2 deletions packages/captp/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"include": [
"*.js",
"*.ts",
"src/**/*.js",
"src/**/*.ts"
"src",
"test"
]
}
6 changes: 3 additions & 3 deletions packages/check-bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@
"ava": "^6.1.3",
"babel-eslint": "^10.1.0",
"c8": "^7.14.0",
"eslint": "^8.57.0",
"eslint": "^8.57.1",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.29.1",
"prettier": "^3.3.3",
"eslint-plugin-import": "^2.31.0",
"prettier": "^3.4.2",
"typescript": "~5.6.3"
},
"files": [
Expand Down
4 changes: 2 additions & 2 deletions packages/check-bundle/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"include": [
"*.js",
"*.ts",
"src/**/*.js",
"src/**/*.ts"
"src",
"test"
]
}
6 changes: 3 additions & 3 deletions packages/cjs-module-analyzer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@
"ava": "^6.1.3",
"babel-eslint": "^10.1.0",
"c8": "^7.14.0",
"eslint": "^8.57.0",
"eslint": "^8.57.1",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.29.1",
"prettier": "^3.3.3",
"eslint-plugin-import": "^2.31.0",
"prettier": "^3.4.2",
"typescript": "~5.6.3"
},
"files": [
Expand Down
4 changes: 2 additions & 2 deletions packages/cjs-module-analyzer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"include": [
"*.js",
"*.ts",
"src/**/*.js",
"src/**/*.ts"
"src",
"test"
]
}
6 changes: 3 additions & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@
"devDependencies": {
"ava": "^6.1.3",
"babel-eslint": "^10.1.0",
"eslint": "^8.57.0",
"eslint": "^8.57.1",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-import": "^2.31.0",
"execa": "^9.3.0",
"prettier": "^3.3.3",
"prettier": "^3.4.2",
"typescript": "~5.6.3"
},
"files": [
Expand Down
10 changes: 5 additions & 5 deletions packages/cli/test/_types.d.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import type { Execa } from 'execa';
import type { ExecaMethod } from 'execa';

export type Expectation = {
stdout: RegExp | string | undefined;
stderr?: RegExp | string | undefined;
};
export type TestCommand = (
command: ReturnType<Execa>,
command: ReturnType<ExecaMethod>,
expectation: Expectation,
) => Promise<true>;
export type TestRoutine = (
execa: Execa,
execa: ExecaMethod,
testCommnd: TestCommand,
) => Promise<void>;
export type Context = {
setup: (execa: Execa) => Promise<void>;
teardown?: (execa: Execa) => Promise<void>;
setup: (execa: ExecaMethod) => Promise<void>;
teardown?: (execa: ExecaMethod) => Promise<void>;
};
5 changes: 3 additions & 2 deletions packages/cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"include": [
"*.js",
"*.ts",
"src/**/*.js",
"src/**/*.ts"
"demo",
"src",
"test"
]
}
1 change: 1 addition & 0 deletions packages/common/test/object-meta-map.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ test('test objectMetaMap', async t => {
? undefined
: {
...desc,
// @ts-expect-error desc.value possibly undefined
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably throw a t.assert.ok(desc.value) before this statement

value: desc.value * 2,
enumerable: false,
},
Expand Down
4 changes: 2 additions & 2 deletions packages/common/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"include": [
"*.js",
"*.ts",
"src/**/*.js",
"src/**/*.ts"
"src",
"test"
]
}
1 change: 1 addition & 0 deletions packages/compartment-mapper/demo/policy/app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
/* global require Buffer module */
require('@endo/compartment-mapper-demo-polyfill1');
const Poet = require('entropoetry');
Expand Down
1 change: 1 addition & 0 deletions packages/compartment-mapper/demo/policy/att2/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
console.log('Attenuator2 imported');

const { create, assign, fromEntries, entries, defineProperties } = Object;
Expand Down
6 changes: 3 additions & 3 deletions packages/compartment-mapper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@
"ava": "^6.1.3",
"babel-eslint": "^10.1.0",
"c8": "^7.14.0",
"eslint": "^8.57.0",
"eslint": "^8.57.1",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.29.1",
"prettier": "^3.3.3",
"eslint-plugin-import": "^2.31.0",
"prettier": "^3.4.2",
"typescript": "~5.6.3"
},
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/compartment-mapper/src/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ const sortedModules = (
return { modules, aliases };
};

/** @type {Record<string, BundlerSupport<unknown>>} */
/** @type {Record<string, BundlerSupport<any>>} */
const bundlerSupportForLanguage = {
'pre-mjs-json': mjsSupport,
'pre-cjs-json': cjsSupport,
Expand Down
2 changes: 1 addition & 1 deletion packages/compartment-mapper/src/policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export const makeDeferredAttenuatorsProvider = (
// time of the import function being called.
/**
*
* @param {string} attenuatorSpecifier
* @param {string | null} attenuatorSpecifier
* @returns {Promise<Attenuator>}
*/
importAttenuator = async attenuatorSpecifier => {
Expand Down
1 change: 1 addition & 0 deletions packages/compartment-mapper/test/_parse-jsonp.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const parseJsonp = (bytes, _specifier, _location, _packageLocation) => {
const compartment = new Compartment({
__options__: true,
globals: harden({
// @ts-expect-error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like we should enable the rule that requires an explanation for use of @ts-expect-error

exports(value) {
exports.default = value;
},
Expand Down
1 change: 1 addition & 0 deletions packages/compartment-mapper/test/app.agar-make.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
// This script regenerates app.agar, an archived application generated
// from the test fixtures.
// This should be done *manually*, *rarely* and *deliberately*.
Expand Down
1 change: 1 addition & 0 deletions packages/compartment-mapper/test/bundle.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const fixture = new URL(
import.meta.url,
).toString();

// @ts-expect-error XXX Node interface munging
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted this to actually work. 😄

  • @boneskull investigate why this is causing an error

const { read } = makeReadPowers({ fs, url });

const expectedLog = [
Expand Down
2 changes: 2 additions & 0 deletions packages/compartment-mapper/test/capture-lite.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const { keys, entries, fromEntries } = Object;
test('captureFromMap() should resolve with a CaptureResult', async t => {
t.plan(5);

// @ts-expect-error XXX Node interface munging
const readPowers = makeReadPowers({ fs, url });
const moduleLocation = `${new URL(
'fixtures-0/node_modules/bundle/main.js',
Expand Down Expand Up @@ -65,6 +66,7 @@ test('captureFromMap() should resolve with a CaptureResult', async t => {
});

test('captureFromMap() should round-trip sources based on parsers', async t => {
// @ts-expect-error XXX Node interface munging
const readPowers = makeReadPowers({ fs, url });
const moduleLocation = `${new URL(
'fixtures-0/node_modules/bundle/main.js',
Expand Down
1 change: 1 addition & 0 deletions packages/compartment-mapper/test/custom-parser.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import 'ses';
import fs from 'fs';
import test from 'ava';
Expand Down
1 change: 1 addition & 0 deletions packages/compartment-mapper/test/cycle-cjs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import test from 'ava';
import { loadLocation } from '../src/import.js';
import { makeReadPowers } from '../src/node-powers.js';

// @ts-expect-error XXX Node interface munging
const readPowers = makeReadPowers({ fs, url });
const { read } = readPowers;

Expand Down
Loading
Loading