Skip to content

Commit

Permalink
feat(plugin): fromDocs integration
Browse files Browse the repository at this point in the history
  • Loading branch information
unicornware committed Feb 20, 2024
1 parent d6a8d5f commit 80307ec
Show file tree
Hide file tree
Showing 32 changed files with 960 additions and 438 deletions.
3 changes: 2 additions & 1 deletion .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,5 @@ ignore:
- src/types/

profiling:
critical_files_paths: []
critical_files_paths:
- src/plugin.ts
8 changes: 1 addition & 7 deletions .commitlintrc.cts → .commitlintrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,7 @@ import { scopes } from '@flex-development/commitlint-config'
const config: UserConfig = {
extends: ['@flex-development'],
rules: {
'scope-enum': [Severity.Error, 'always', scopes([
'attacher',
'grammar',
'lexer',
'parser',
'reader'
])]
'scope-enum': [Severity.Error, 'always', scopes(['plugin'])]
}
}

Expand Down
2 changes: 2 additions & 0 deletions .dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ cefc
codecov
commitlintrc
dedupe
deno
dessant
docast
dohm
Expand All @@ -16,6 +17,7 @@ iife
jchen
jsdoc
kaisugi
lcov
lintstagedrc
mdast
mkbuild
Expand Down
2 changes: 2 additions & 0 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
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
91 changes: 73 additions & 18 deletions .eslintrc.base.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const fs = require('node:fs')
*/
const config = {
env: {
[require('./tsconfig.build.json').compilerOptions.target]: true,
es2023: true,
node: true
},
extends: [],
Expand All @@ -33,15 +33,8 @@ const config = {
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true
},
extraFileExtensions: [],
project: [
'**/tsconfig.json',
'./tsconfig.cjs.json'
],
sourceType: require('./package.json').type,
project: ['**/tsconfig.json'],
tsconfigRootDir: process.cwd(),
warnOnUnsupportedTypeScriptVersion: true
},
Expand Down Expand Up @@ -630,7 +623,7 @@ const config = {
2,
{
version: require('./package.json').engines?.node ??
'>=' + fs.readFileSync('./.nvmrc', 'utf8')
'>=' + fs.readFileSync('.nvmrc', 'utf8')
}
],
'node/prefer-global/buffer': 2,
Expand Down Expand Up @@ -925,6 +918,68 @@ const config = {
'@typescript-eslint/explicit-member-accessibility': 0
}
},
{
files: ['**/*.html'],
parser: '@html-eslint/parser',
plugins: ['@html-eslint', 'html'],
rules: {
'@html-eslint/element-newline': 2,
'@html-eslint/id-naming-convention': 2,
'@html-eslint/indent': [2, 2],
'@html-eslint/lowercase': 2,
'@html-eslint/no-abstract-roles': 2,
'@html-eslint/no-accesskey-attrs': 2,
'@html-eslint/no-aria-hidden-body': 2,
'@html-eslint/no-duplicate-attrs': 2,
'@html-eslint/no-duplicate-id': 2,
'@html-eslint/no-extra-spacing-attrs': 2,
'@html-eslint/no-inline-styles': 2,
'@html-eslint/no-multiple-empty-lines': 2,
'@html-eslint/no-multiple-h1': 2,
'@html-eslint/no-non-scalable-viewport': 2,
'@html-eslint/no-obsolete-tags': 2,
'@html-eslint/no-positive-tabindex': 2,
'@html-eslint/no-restricted-attr-values': [
2,
{
attrPatterns: [],
attrValuePatterns: []
}
],
'@html-eslint/no-restricted-attrs': [
2,
{
attrPatterns: [],
tagPatterns: []
}
],
'@html-eslint/no-script-style-type': 2,
'@html-eslint/no-skip-heading-levels': 2,
'@html-eslint/no-target-blank': 2,
'@html-eslint/no-trailing-spaces': 2,
'@html-eslint/quotes': 2,
'@html-eslint/require-attrs': [2],
'@html-eslint/require-button-type': 2,
'@html-eslint/require-closing-tags': [2, { selfClosing: 'always' }],
'@html-eslint/require-doctype': 2,
'@html-eslint/require-frame-title': 2,
'@html-eslint/require-img-alt': 2,
'@html-eslint/require-lang': 2,
'@html-eslint/require-li-container': 2,
'@html-eslint/require-meta-charset': 2,
'@html-eslint/require-meta-description': 2,
'@html-eslint/require-meta-viewport': 2,
'@html-eslint/require-open-graph-protocol': 0,
'@html-eslint/require-title': 2,
'@html-eslint/sort-attrs': 2
},
settings: {
html: {
extensions: ['.html'],
indent: '+2'
}
}
},
{
files: '**/*.+(json|json5|jsonc)',
parser: 'jsonc-eslint-parser',
Expand Down Expand Up @@ -981,14 +1036,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 Down Expand Up @@ -1257,6 +1304,14 @@ const config = {
}
}
],
parserOptions: {
ecmaFeatures: {
impliedStrict: true,
jsx: true
},
ecmaVersion: 'latest',
sourceType: require('./package.json').type
},
plugins: [],
reportUnusedDisableDirectives: true,
rules: {},
Expand Down
31 changes: 0 additions & 31 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,6 @@
*/
const config = {
extends: ['./.eslintrc.base.cjs'],
overrides: [
...require('./.eslintrc.base.cjs').overrides,
{
files: ['__fixtures__/calculate.ts'],
rules: {
'@typescript-eslint/strict-boolean-expressions': 0,
'unicorn/no-unreadable-array-destructuring': 0
}
},
{
files: ['__fixtures__/dbl-linear.ts', '__fixtures__/fibonacci.ts'],
rules: {
'@typescript-eslint/require-await': 0
}
},
{
files: ['src/parser-abstract.ts'],
rules: {
'@typescript-eslint/no-unused-vars': [
2,
{
args: 'none',
caughtErrors: 'all',
ignoreRestSiblings: false,
vars: 'all'
}
],
'@typescript-eslint/no-useless-constructor': 0
}
}
],
root: true
}

Expand Down
2 changes: 0 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ updates:
patterns:
- '@vitest/*'
- vitest*
ignore:
- dependency-name: unist-util-inspect
labels:
- scope:dependencies
- type:build
Expand Down
11 changes: 4 additions & 7 deletions .github/infrastructure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ labels:
- name: flag:needs-refactor
description: code improvements required before being merged
color: fbca04
- name: scope:attacher
description: unified attacher
color: 74cefc
- name: scope:dependencies
description: dependency updates
color: 74cefc
Expand All @@ -77,12 +74,12 @@ labels:
- name: scope:install
description: package install
color: 74cefc
- name: scope:parser
description: file parser
color: 74cefc
- name: scope:patches
description: patches
color: 74cefc
- name: scope:plugin
description: unified plugin
color: 74cefc
- name: scope:release
description: package release
color: 74cefc
Expand Down Expand Up @@ -174,7 +171,7 @@ repository:
automated_security_fixes: true
default_branch: main
delete_branch_on_merge: true
description: unified compliant file parser for docast
description: unified compliant parser for docast
has_issues: true
has_projects: true
has_wiki: false
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": [
"vitest run --changed --coverage",
Expand Down
31 changes: 22 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[![vitest](https://img.shields.io/badge/-vitest-6e9f18?style=flat&logo=vitest&logoColor=ffffff)](https://vitest.dev/)
[![yarn](https://img.shields.io/badge/-yarn-2c8ebb?style=flat&logo=yarn&logoColor=ffffff)](https://yarnpkg.com/)

[**unified**][unified] compliant file parser for [**docast**][docast].
[**unified**][unified] compliant parser for [**docast**][docast].

## Contents

Expand All @@ -37,23 +37,34 @@ syntax tree][docast].

This package is [ESM only][esm].

```sh
yarn add @flex-development/docast-parse @flex-development/docast @types/mdast @types/unist
```

From Git:
In Node.js (version 18+) with [yarn][yarn]:

```sh
yarn add @flex-development/docast-parse@flex-development/docast-parse
yarn add @flex-development/docast-parse
yarn add -D @flex-development/docast @types/mdast @types/unist micromark-util-types
```

<blockquote>
<small>
See <a href='https://yarnpkg.com/features/protocols#git'>Git - Protocols | Yarn</a>
&nbsp;for details on requesting a specific branch, commit, or tag.
See <a href='https://yarnpkg.com/protocol/git'>Git - Protocols | Yarn</a>
&nbsp;for details regarding installing from Git.
</small>
</blockquote>

In Deno with [`esm.sh`][esmsh]:

```ts
import docastParse from 'https://esm.sh/@flex-development/docast-parse'
```

In browsers with [`esm.sh`][esmsh]:

```html
<script type="module">
import docastParse from 'https://esm.sh/@flex-development/docast-parse'
</script>
```

## Use

**TODO**: use
Expand All @@ -80,5 +91,7 @@ See [`CONTRIBUTING.md`](CONTRIBUTING.md).

[docast]: https://github.com/flex-development/docast
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
[esmsh]: https://esm.sh/
[typescript]: https://www.typescriptlang.org
[unified]: https://github.com/unifiedjs/unified
[yarn]: https://yarnpkg.com
Empty file removed __fixtures__/.gitkeep
Empty file.
Loading

0 comments on commit 80307ec

Please sign in to comment.