Skip to content
Merged
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
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

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

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ jobs:
with:
node-version-file: .node-version
- run: npm install
- run: npm run build-lint-test
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.17.0
22.17.1
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ api-extractor/**/*
dist/**/*
docs/**/*
temp/**/*
types/**/*
16 changes: 13 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
{
"cSpell.words": ["heaslip", "rushstack", "tsdoc", "unscoped", "yalc"],
"cSpell.words": [
"heaslip",
"packagehash",
"rushstack",
"tsdoc",
"unscoped",
"yalc"
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"eslint.enable": true,
"eslint.validate": ["javascript", "typescript"],
"eslint.validate": [
"javascript",
"typescript"
],
"files.associations": {
"api-extractor.json": "jsonc"
},
Expand Down Expand Up @@ -33,7 +43,7 @@
"CHANGELOG": true,
"docs/**/*": true,
"LICENSE": true,
"types/**/*": true
"package-lock.json": true
},
"testing.openTesting": "neverOpen",
"testing.automaticallyOpenTestResults": "neverOpen",
Expand Down
4 changes: 2 additions & 2 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ This package is developed with Node.js 18 (the active LTS [release](https://node
In this folder:

```sh
# Watch src and build into dist/cjs and dist/esm on change
# Watch src and build into dist on change
npm run dev
```

If you add a new function or making a change to the arguments of an existing function (without this TypeScript won’t be aware of the changes, and the `build-lint-test` script will fail):

```sh
# Update api-extractor/* (metadata about code generated by api-extractor), docs/* (Markdown documentation generated by api-documenter using api-extractor metadata) and types/react-dom-utils.d.ts (types generated by api-extractor)
# Update api-extractor/* (metadata about code generated by api-extractor) and docs/* (Markdown documentation generated by api-documenter using api-extractor metadata)
npm run api-extractor-update
```

Expand Down
19 changes: 18 additions & 1 deletion api-extractor.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,22 @@
*/
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "@asl-19/shared-package-configs/api-extractor.json"
"mainEntryPointFilePath": "<projectFolder>/dist/index.d.ts",
"apiReport": {
"enabled": true,
"reportFolder": "<projectFolder>/api-extractor"
},
"compiler": {
"tsconfigFilePath": "tsconfig-dist.json"
},
"docModel": {
"enabled": true,
"apiJsonFilePath": "<projectFolder>/api-extractor/react-dom-utils.api.json"
},
"dtsRollup": {
"enabled": false
},
"tsdocMetadata": {
"enabled": false
}
}
24 changes: 12 additions & 12 deletions api-extractor/react-dom-utils.api.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"metadata": {
"toolPackage": "@microsoft/api-extractor",
"toolVersion": "7.47.8",
"toolVersion": "7.52.10",
"schemaVersion": 1011,
"oldestForwardsCompatibleVersion": 1001,
"tsdocConfig": {
Expand Down Expand Up @@ -175,7 +175,7 @@
{
"kind": "TypeAlias",
"canonicalReference": "@asl-19/react-dom-utils!FormState:type",
"docComment": "/**\n * {@link useFormStateAndFocusManagement} state\n */\n",
"docComment": "/**\n * {@link useFormStateAndFocusManagement} state\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
Expand All @@ -199,7 +199,7 @@
"text": ";"
}
],
"fileUrlPath": "src/FormState.ts",
"fileUrlPath": "dist/FormState.d.ts",
"releaseTag": "Public",
"name": "FormState",
"typeTokenRange": {
Expand All @@ -210,7 +210,7 @@
{
"kind": "TypeAlias",
"canonicalReference": "@asl-19/react-dom-utils!StylableFC:type",
"docComment": "/**\n * React FunctionComponent that takes an optional className prop.\n *\n * @remarks\n *\n * The className prop is used for styling the component instance’s top-level element (which should have `className={className}`) from the outside.\n */\n",
"docComment": "/**\n * React FunctionComponent that takes an optional className prop.\n *\n * @remarks\n *\n * The className prop is used for styling the component instance’s top-level element (which should have `className={className}`) from the outside.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
Expand Down Expand Up @@ -238,7 +238,7 @@
"text": ";"
}
],
"fileUrlPath": "src/StylableFC.ts",
"fileUrlPath": "dist/StylableFC.d.ts",
"releaseTag": "Public",
"name": "StylableFC",
"typeParameters": [
Expand Down Expand Up @@ -273,7 +273,7 @@
"text": "void"
}
],
"fileUrlPath": "src/useAddHydratedClassName.ts",
"fileUrlPath": "dist/useAddHydratedClassName.d.ts",
"returnTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
Expand All @@ -297,7 +297,7 @@
"text": "void"
}
],
"fileUrlPath": "src/useDynamicFocusOutlines.ts",
"fileUrlPath": "dist/useDynamicFocusOutlines.d.ts",
"returnTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
Expand Down Expand Up @@ -348,7 +348,7 @@
"text": " | null>>"
}
],
"fileUrlPath": "src/useFocusElementAfterRender.ts",
"fileUrlPath": "dist/useFocusElementAfterRender.d.ts",
"returnTypeTokenRange": {
"startIndex": 1,
"endIndex": 8
Expand Down Expand Up @@ -395,7 +395,7 @@
},
{
"kind": "Content",
"text": ">;\n errorMessagesListRef: import(\"react\")."
"text": " | null>;\n errorMessagesListRef: import(\"react\")."
},
{
"kind": "Reference",
Expand All @@ -413,7 +413,7 @@
},
{
"kind": "Content",
"text": ">;\n formState: "
"text": " | null>;\n formState: "
},
{
"kind": "Reference",
Expand Down Expand Up @@ -452,7 +452,7 @@
"text": ">>;\n}"
}
],
"fileUrlPath": "src/useFormStateAndFocusManagement.ts",
"fileUrlPath": "dist/useFormStateAndFocusManagement.d.ts",
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 20
Expand Down Expand Up @@ -520,7 +520,7 @@
"text": "void"
}
],
"fileUrlPath": "src/useOnClickOutside.ts",
"fileUrlPath": "dist/useOnClickOutside.d.ts",
"returnTypeTokenRange": {
"startIndex": 9,
"endIndex": 10
Expand Down
4 changes: 2 additions & 2 deletions api-extractor/react-dom-utils.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export const useFocusElementAfterRender: () => Dispatch<SetStateAction<HTMLEleme
export const useFormStateAndFocusManagement: ({ disableFocusManagement, }?: {
disableFocusManagement?: boolean;
}) => {
confirmationMessageElementRef: RefObject<HTMLParagraphElement>;
errorMessagesListRef: RefObject<HTMLUListElement>;
confirmationMessageElementRef: RefObject<HTMLParagraphElement | null>;
errorMessagesListRef: RefObject<HTMLUListElement | null>;
formState: FormState;
setFormState: Dispatch<SetStateAction<FormState>>;
};
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ Shared ReactDOM utility functions and types for ASL19 projects.

</td></tr>
</tbody></table>

1 change: 1 addition & 0 deletions docs/react-dom-utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,4 @@ React FunctionComponent that takes an optional className prop.

</td></tr>
</tbody></table>

7 changes: 4 additions & 3 deletions docs/react-dom-utils.useformstateandfocusmanagement.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Hook for storing [FormState](./react-dom-utils.formstate.md) and manipulating fo
useFormStateAndFocusManagement: ({ disableFocusManagement, }?: {
disableFocusManagement?: boolean;
}) => {
confirmationMessageElementRef: import("react").RefObject<HTMLParagraphElement>;
errorMessagesListRef: import("react").RefObject<HTMLUListElement>;
confirmationMessageElementRef: import("react").RefObject<HTMLParagraphElement | null>;
errorMessagesListRef: import("react").RefObject<HTMLUListElement | null>;
formState: FormState;
setFormState: import("react").Dispatch<import("react").SetStateAction<FormState>>;
}
Expand Down Expand Up @@ -54,9 +54,10 @@ _(Optional)_

</td></tr>
</tbody></table>

**Returns:**

{ confirmationMessageElementRef: import("react").RefObject&lt;HTMLParagraphElement&gt;; errorMessagesListRef: import("react").RefObject&lt;HTMLUListElement&gt;; formState: [FormState](./react-dom-utils.formstate.md)<!-- -->; setFormState: import("react").Dispatch&lt;import("react").SetStateAction&lt;[FormState](./react-dom-utils.formstate.md)<!-- -->&gt;&gt;; }
{ confirmationMessageElementRef: import("react").RefObject&lt;HTMLParagraphElement \| null&gt;; errorMessagesListRef: import("react").RefObject&lt;HTMLUListElement \| null&gt;; formState: [FormState](./react-dom-utils.formstate.md)<!-- -->; setFormState: import("react").Dispatch&lt;import("react").SetStateAction&lt;[FormState](./react-dom-utils.formstate.md)<!-- -->&gt;&gt;; }

## Remarks

Expand Down
1 change: 1 addition & 0 deletions docs/react-dom-utils.useonclickoutside.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Description

</td></tr>
</tbody></table>

**Returns:**

void
Expand Down
22 changes: 22 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import asl19 from "@asl-19/eslint-config";
import { defineConfig } from "eslint/config";

const typedAsl19 = /** @type {import("@asl-19/eslint-config")["default"]} */ (
asl19
);

const eslintConfig = defineConfig([
{ ignores: ["dist/", ".yalc/"] },
{
extends: [
typedAsl19.base, // (for all projects)
typedAsl19.typescript, // (for TypeScript projects)
],
rules: {
// https://github.com/eslint-community/eslint-plugin-security/issues/21
"security/detect-object-injection": "off",
},
},
]);

export default eslintConfig;
Loading