Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ jobs:
run: |
npm run test:types

- name: Test types (object-schema)
working-directory: packages/object-schema
run: |
npm run test:types

- name: Test types (config-array)
working-directory: packages/config-array
run: |
npm run test:types

- name: Test types (config-helpers)
working-directory: packages/config-helpers
run: |
Expand Down
5 changes: 3 additions & 2 deletions packages/config-array/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@
"build:cts": "node ../../tools/build-cts.js dist/esm/index.d.ts dist/cjs/index.d.cts",
"build:std__path": "rollup -c rollup.std__path-config.js && node fix-std__path-imports",
"build": "rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts && npm run build:std__path",
"test:jsr": "npx jsr@latest publish --dry-run",
"pretest": "npm run build",
"test": "mocha \"tests/**/*.test.js\"",
"test:coverage": "c8 npm test"
"test:coverage": "c8 npm test",
"test:jsr": "npx jsr@latest publish --dry-run",
"test:types": "tsc -p tests/types/tsconfig.json"
},
"keywords": [
"configuration",
Expand Down
2 changes: 1 addition & 1 deletion packages/config-array/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default {
plugins: [
copy({
targets: [
{ src: "src/types.ts", dest: "dist/cjs" },
{ src: "src/types.ts", dest: "dist/cjs", rename: "types.cts" },
{ src: "src/types.ts", dest: "dist/esm" },
],
}),
Expand Down
4 changes: 4 additions & 0 deletions packages/config-array/rollup.std__path-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ export default [
input: resolve("@jsr/std__path/posix"),
output: [
{
banner: "// @ts-nocheck",
file: "./dist/cjs/std__path/posix.cjs",
format: "cjs",
},
{
banner: "// @ts-nocheck",
file: "./dist/esm/std__path/posix.js",
format: "esm",
},
Expand All @@ -20,10 +22,12 @@ export default [
input: resolve("@jsr/std__path/windows"),
output: [
{
banner: "// @ts-nocheck",
file: "./dist/cjs/std__path/windows.cjs",
format: "cjs",
},
{
banner: "// @ts-nocheck",
file: "./dist/esm/std__path/windows.js",
format: "esm",
},
Expand Down
10 changes: 4 additions & 6 deletions packages/config-array/src/config-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ import { filesAndIgnoresSchema } from "./files-and-ignores-schema.js";
// Types
//------------------------------------------------------------------------------

/** @typedef {import("@eslint/object-schema").PropertyDefinition} PropertyDefinition */
/** @typedef {import("@eslint/object-schema").ObjectDefinition} ObjectDefinition */
/** @typedef {import("./types.ts").ConfigObject} ConfigObject */
/** @typedef {import("minimatch").IMinimatchStatic} IMinimatchStatic */
/** @typedef {import("minimatch").IMinimatch} IMinimatch */
/** @typedef {import("@jsr/std__path")} PathImpl */
/** @import * as PathImpl from "@jsr/std__path" */

/*
* This is a bit of a hack to make TypeScript happy with the Rollup-created
Expand All @@ -34,7 +32,7 @@ import { filesAndIgnoresSchema } from "./files-and-ignores-schema.js";
* for `ObjectSchema`. To work around that, we just import the type manually
* and give it a different name to use in the JSDoc comments.
*/
/** @typedef {import("@eslint/object-schema").ObjectSchema} ObjectSchemaInstance */
/** @typedef {ObjectSchema} ObjectSchemaInstance */

//------------------------------------------------------------------------------
// Helpers
Expand Down Expand Up @@ -968,7 +966,7 @@ export class ConfigArray extends Array {
* @param {Object} config The config to finalize.
* @returns {Object} The finalized config.
*/
[ConfigArraySymbol.finalizeConfig](config) {
[/** @type {never} */ (ConfigArraySymbol.finalizeConfig)](config) {
return config;
}

Expand All @@ -980,7 +978,7 @@ export class ConfigArray extends Array {
* @param {Object} config The config to preprocess.
* @returns {Object} The config to use in place of the argument.
*/
[ConfigArraySymbol.preprocessConfig](config) {
[/** @type {never} */ (ConfigArraySymbol.preprocessConfig)](config) {
return config;
}

Expand Down
10 changes: 10 additions & 0 deletions packages/config-array/tests/types/cjs-import.test.cts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* @fileoverview CommonJS type import test for Config Array package.
* @author Francesco Trotta
*/

//-----------------------------------------------------------------------------
// Imports
//-----------------------------------------------------------------------------

import "@eslint/config-array";
8 changes: 8 additions & 0 deletions packages/config-array/tests/types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"noEmit": true,
"rootDir": "../.."
},
"include": [".", "../../dist"]
}
10 changes: 10 additions & 0 deletions packages/config-array/tests/types/types.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* @fileoverview Type tests for Config Array package.
* @author Francesco Trotta
*/

//-----------------------------------------------------------------------------
// Imports
//-----------------------------------------------------------------------------

import "@eslint/config-array";
5 changes: 3 additions & 2 deletions packages/object-schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
"scripts": {
"build:cts": "node ../../tools/build-cts.js dist/esm/index.d.ts dist/cjs/index.d.cts",
"build": "rollup -c && tsc -p tsconfig.esm.json && npm run build:cts",
"test:jsr": "npx jsr@latest publish --dry-run",
"test": "mocha \"tests/**/*.test.js\"",
"test:coverage": "c8 npm test"
"test:coverage": "c8 npm test",
"test:jsr": "npx jsr@latest publish --dry-run",
"test:types": "tsc -p tests/types/tsconfig.json"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/object-schema/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default {
plugins: [
copy({
targets: [
{ src: "src/types.ts", dest: "dist/cjs" },
{ src: "src/types.ts", dest: "dist/cjs", rename: "types.cts" },
{ src: "src/types.ts", dest: "dist/esm" },
],
}),
Expand Down
10 changes: 10 additions & 0 deletions packages/object-schema/tests/types/cjs-import.test.cts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* @fileoverview CommonJS type import test for ObjectSchema package.
* @author Francesco Trotta
*/

//-----------------------------------------------------------------------------
// Imports
//-----------------------------------------------------------------------------

import "@eslint/object-schema";
8 changes: 8 additions & 0 deletions packages/object-schema/tests/types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"noEmit": true,
"rootDir": "../.."
},
"include": [".", "../../dist"]
}
10 changes: 10 additions & 0 deletions packages/object-schema/tests/types/types.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* @fileoverview Type tests for ObjectSchema package.
* @author Francesco Trotta
*/

//-----------------------------------------------------------------------------
// Imports
//-----------------------------------------------------------------------------

import "@eslint/object-schema";
5 changes: 3 additions & 2 deletions templates/package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@
"build:dedupe-types": "node ../../tools/dedupe-types.js dist/cjs/index.cjs dist/esm/index.js",
"build:cts": "node ../../tools/build-cts.js dist/esm/index.d.ts dist/cjs/index.d.cts",
"build": "rollup -c && npm run build:dedupe-types && tsc -p tsconfig.esm.json && npm run build:cts",
"test:jsr": "npx jsr@latest publish --dry-run",
"test": "mocha \"tests/**/*.test.js\"",
"test:coverage": "c8 npm test"
"test:coverage": "c8 npm test",
"test:jsr": "npx jsr@latest publish --dry-run",
"test:types": "tsc -p tests/types/tsconfig.json"
},
"repository": {
"type": "git",
Expand Down
8 changes: 8 additions & 0 deletions templates/package/tests/types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"noEmit": true,
"rootDir": "../.."
},
"include": [".", "../../dist"]
}