Skip to content

Commit

Permalink
feat(content): NodeMap
Browse files Browse the repository at this point in the history
Signed-off-by: Lexus Drumgold <[email protected]>
  • Loading branch information
unicornware committed Apr 12, 2024
1 parent b1756f9 commit f9692c5
Show file tree
Hide file tree
Showing 32 changed files with 380 additions and 377 deletions.
17 changes: 10 additions & 7 deletions .dprint.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
"**/.temp/",
"**/.vercel/",
"**/__fixtures__/git/**/*.txt",
"**/__tests__/benchmark.json",
"**/__tests__/report.json",
"**/__tests__/typecheck.json",
"**/coverage/",
"**/dist/",
"**/node_modules",
Expand Down Expand Up @@ -62,7 +64,8 @@
"array.preferSingleLine": false,
"commentLine.forceSpaceAfterSlashes": true,
"ignoreNodeCommentText": "dprint-ignore",
"object.preferSingleLine": false
"object.preferSingleLine": false,
"trailingCommas": "never"
},
"lineWidth": 80,
"markdown": {
Expand All @@ -78,10 +81,10 @@
},
"newLineKind": "lf",
"plugins": [
"https://plugins.dprint.dev/typescript-0.88.3.wasm",
"https://plugins.dprint.dev/json-0.17.4.wasm",
"https://plugins.dprint.dev/markdown-0.16.0.wasm",
"https://plugins.dprint.dev/exec-0.4.3.json@42343548b8022c99b1d750be6b894fe6b6c7ee25f72ae9f9082226dd2e515072"
"https://plugins.dprint.dev/typescript-0.90.1.wasm",
"https://plugins.dprint.dev/json-0.19.2.wasm",
"https://plugins.dprint.dev/markdown-0.16.4.wasm",
"https://plugins.dprint.dev/exec-0.4.4.json@c207bf9b9a4ee1f0ecb75c594f774924baf62e8e53a2ce9d873816a408cecbf7"
],
"typescript": {
"arrowFunction.useParentheses": "preferNone",
Expand All @@ -95,7 +98,7 @@
"constructorType.spaceAfterNewKeyword": true,
"doWhileStatement.spaceAfterWhileKeyword": true,
"enumDeclaration.memberSpacing": "maintain",
"exportDeclaration.forceMultiLine": false,
"exportDeclaration.forceMultiLine": "never",
"exportDeclaration.forceSingleLine": false,
"exportDeclaration.sortNamedExports": "maintain",
"exportDeclaration.spaceSurroundingNamedExports": true,
Expand All @@ -110,7 +113,7 @@
"ifStatement.spaceAfterIfKeyword": true,
"ignoreFileCommentText": "dprint-ignore-file",
"ignoreNodeCommentText": "dprint-ignore",
"importDeclaration.forceMultiLine": false,
"importDeclaration.forceMultiLine": "never",
"importDeclaration.forceSingleLine": false,
"importDeclaration.sortNamedImports": "maintain",
"importDeclaration.spaceSurroundingNamedImports": true,
Expand Down
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
**/*config.*.timestamp*
**/.DS_Store
**/.temp/
**/__tests__/benchmark.json
**/__tests__/report.*
**/__tests__/typecheck.json
**/coverage/
**/dist/
**/node_modules/
Expand Down
42 changes: 20 additions & 22 deletions .eslintrc.base.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,8 @@ const config = {
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true
},
extraFileExtensions: [],
project: ['**/tsconfig.json'],
sourceType: require('./package.json').type,
project: ['**/tsconfig.json', '**/tsconfig.*.json'],
tsconfigRootDir: process.cwd(),
warnOnUnsupportedTypeScriptVersion: true
},
Expand Down Expand Up @@ -499,9 +495,16 @@ const config = {
checkConstructors: true,
checkGetters: true,
checkSetters: true,
contexts: [
'TSDeclareFunction:not(TSDeclareFunction + TSDeclareFunction)',
'FunctionDeclaration:not(TSDeclareFunction + FunctionDeclaration)'
],
enableFixer: true,
exemptEmptyConstructors: true,
exemptEmptyFunctions: false
exemptEmptyFunctions: false,
require: {
FunctionDeclaration: false
}
}
],
'jsdoc/require-param': [
Expand Down Expand Up @@ -623,13 +626,7 @@ const config = {
'node/no-unpublished-require': 0,
'node/no-unsupported-features/es-builtins': 2,
'node/no-unsupported-features/es-syntax': 0,
'node/no-unsupported-features/node-builtins': [
2,
{
version: require('./package.json').engines?.node ??
'>=' + fs.readFileSync('./.nvmrc', 'utf8')
}
],
'node/no-unsupported-features/node-builtins': 2,
'node/prefer-global/buffer': 2,
'node/prefer-global/console': 2,
'node/prefer-global/process': 2,
Expand Down Expand Up @@ -750,7 +747,7 @@ const config = {
'unicorn/prefer-export-from': [2, { ignoreUsedVariables: true }],
'unicorn/prefer-includes': 2,
'unicorn/prefer-json-parse-buffer': 0,
'unicorn/prefer-math-trunc': 2,
'unicorn/prefer-math-trunc': 0,
'unicorn/prefer-module': 2,
'unicorn/prefer-negative-index': 2,
'unicorn/prefer-node-protocol': 2,
Expand Down Expand Up @@ -978,14 +975,6 @@ const config = {
React: false
},
parser: 'eslint-mdx',
parserOptions: {
ecmaFeatures: {
impliedStrict: true,
jsx: true
},
ecmaVersion: 'latest',
sourceType: 'module'
},
plugins: ['markdown', 'markdownlint', 'mdx'],
processor: 'mdx/remark',
rules: {
Expand All @@ -1007,6 +996,7 @@ const config = {
'@typescript-eslint/no-floating-promises': 0,
'@typescript-eslint/no-for-in-array': 0,
'@typescript-eslint/no-implied-eval': 0,
'@typescript-eslint/no-invalid-void-type': 0,
'@typescript-eslint/no-meaningless-void-operator': 0,
'@typescript-eslint/no-misused-promises': 0,
'@typescript-eslint/no-mixed-enums': 0,
Expand Down Expand Up @@ -1254,6 +1244,14 @@ const config = {
}
}
],
parserOptions: {
ecmaFeatures: {
impliedStrict: true,
jsx: true
},
ecmaVersion: 'latest',
sourceType: require('./package.json').type
},
plugins: [],
reportUnusedDisableDirectives: true,
rules: {},
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ yarn-error.log*
# Testing
# ------------------------------------------------------------------------------
**/*config.*.timestamp*
**/__tests__/benchmark.json
**/__tests__/report.*
**/__tests__/typecheck.json
**/coverage/
**/tsconfig*temp.json
*.lcov
Expand Down
2 changes: 1 addition & 1 deletion .lintstagedrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"eslint --exit-on-fatal-error",
"cspell lint --color --no-progress --relative $@"
],
"**/*.{cts,mts,ts}": "vitest run --changed --typecheck",
"**/*.{cts,mts,ts}": "vitest run --changed --mode=typecheck --typecheck",
"**/yarn.lock": "yarn dedupe --check",
"src/**/*.ts": ["yarn build", "bash -c tsc -p tsconfig.build.json"]
}
60 changes: 6 additions & 54 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,54 +67,6 @@
"editor.wordWrapColumn": 100,
"rewrap.wrappingColumn": 100
},
"better-comments.highlightPlainText": true,
"better-comments.tags": [
{
"backgroundColor": "transparent",
"bold": false,
"color": "#ff2d00",
"italic": false,
"strikethrough": false,
"tag": "!",
"underline": false
},
{
"backgroundColor": "transparent",
"bold": false,
"color": "#3498db",
"italic": false,
"strikethrough": false,
"tag": "?",
"underline": false
},
{
"backgroundColor": "transparent",
"bold": false,
"color": "#474747",
"italic": false,
"strikethrough": true,
"tag": "//",
"underline": false
},
{
"backgroundColor": "transparent",
"bold": false,
"color": "#ff8c00",
"italic": false,
"strikethrough": false,
"tag": "todo",
"underline": false
},
{
"backgroundColor": "transparent",
"bold": false,
"color": "#98c379",
"italic": false,
"strikethrough": false,
"tag": "*",
"underline": false
}
],
"breadcrumbs.enabled": true,
"cSpell.enabled": true,
"debug.showBreakpointsInOverviewRuler": true,
Expand Down Expand Up @@ -287,7 +239,7 @@
"todo-tree.tree.buttons.viewStyle": true,
"todo-tree.tree.expanded": true,
"todo-tree.tree.filterCaseSensitive": true,
"todo-tree.tree.scanMode": "workspace",
"todo-tree.tree.scanMode": "workspace only",
"todo-tree.tree.showBadges": true,
"todo-tree.tree.showCountsInTree": true,
"todo-tree.tree.showCurrentScanMode": true,
Expand Down Expand Up @@ -315,11 +267,6 @@
"resolutions"
],
"vsicons.associations.files": [
{
"extensions": [".commitlintrc.cts"],
"format": "svg",
"icon": "commitlint"
},
{
"extensions": [".eslintrc.base.cjs"],
"format": "svg",
Expand Down Expand Up @@ -362,6 +309,11 @@
"format": "svg",
"icon": "private"
},
{
"extensions": ["namespaces"],
"format": "svg",
"icon": "module"
},
{
"extensions": ["patches"],
"format": "svg",
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ This means every commit must conform to the following format:
│ │ │
│ │ └─⫸ optional breaking change flag
│ │
│ └─⫸ see .commitlintrc.cts
│ └─⫸ see .commitlintrc.ts
└─⫸ build|ci|chore|docs|feat|fix|perf|refactor|revert|style|test|wip

Expand Down Expand Up @@ -198,7 +198,7 @@ e.g:
- `build(deps-dev): bump cspell from 6.7.0 to 6.8.0`
- `perf: lighten initial load`

See [`.commitlintrc.cts`](.commitlintrc.cts) to view all commit guidelines.
See [`.commitlintrc.ts`](.commitlintrc.ts) to view all commit guidelines.

### Code Style

Expand Down Expand Up @@ -309,7 +309,7 @@ When squashing, be sure to follow [commit message standards](#commit-messages):
│ │ │
│ │ └─⫸ optional breaking change flag
│ │
│ └─⫸ see .commitlintrc.cts
│ └─⫸ see .commitlintrc.ts
└─⫸ build|ci|chore|docs|feat|fix|perf|refactor|release|revert|style|test
```
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ yarn add @flex-development/docast @types/mdast @types/unist

## Nodes (abstract)

### Node
### `Node`

```ts
interface Node extends unist.Node {
Expand Down
6 changes: 0 additions & 6 deletions __tests__/setup/index.ts

This file was deleted.

6 changes: 6 additions & 0 deletions __tests__/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* @file Entry Point - Test Types
* @module tests/types
*/

export type { default as NodeObject } from './node-object'
15 changes: 15 additions & 0 deletions __tests__/types/node-object.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* @file Test Types - NodeObject
* @module tests/types/NodeObject
*/

import type { Node } from 'unist'

/**
* Create an object mapping a node type to a node.
*
* @template {Node} T - Node to map
*/
type NodeObject<T extends Node> = { [K in T['type']]: T }

export type { NodeObject as default }
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
"prepublishOnly": "toggle-scripts -prepack",
"release": "bash ./scripts/release.sh",
"test": "yarn typecheck",
"typecheck": "vitest run --typecheck",
"typecheck:watch": "vitest --typecheck"
"typecheck": "vitest run --mode=typecheck --typecheck",
"typecheck:watch": "vitest --mode=typecheck --typecheck"
},
"dependencies": {
"@flex-development/tutils": "6.0.0-alpha.25"
Expand Down Expand Up @@ -126,7 +126,7 @@
"ts-dedent": "2.2.0",
"typescript": "5.4.5",
"vite": "5.2.8",
"vitest": "1.4.0",
"vitest": "1.5.0",
"yaml-eslint-parser": "1.2.2"
},
"peerDependencies": {
Expand Down
Loading

0 comments on commit f9692c5

Please sign in to comment.