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
29 changes: 0 additions & 29 deletions .eslintrc

This file was deleted.

33 changes: 23 additions & 10 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,29 @@ jobs:

strategy:
matrix:
node-version: [18.x, 20.x]
node-version: [20.x]

steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and lint
run: |
yarn
yarn build
yarn lint
yarn test
- name: setup pnpm
uses: pnpm/action-setup@v4
- name: install
run: pnpm install
- name: build
run: pnpm build
- name: lint
run: pnpm lint

- name: check
run: pnpm check
- name: format check
run: pnpm format:check
- name: test
run: pnpm test

release:
runs-on: ubuntu-latest
Expand All @@ -43,11 +52,15 @@ jobs:
with:
node-version: 20.x

- name: setup pnpm
uses: pnpm/action-setup@v4

- name: Create Release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
yarn install --frozen-lockfile
yarn build
yarn release
pnpm install --frozen-lockfile
pnpm build
pnpm check
pnpm release
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.idea
node_modules
dist
example-dist
coverage
.env
yarn-error.log
test-output
3 changes: 1 addition & 2 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
registry=https://registry.npmjs.org/
package-lock=false
shamefully-hoist=true
1 change: 0 additions & 1 deletion .prettierrc

This file was deleted.

10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ yarn add -D react-docgen-typescript-plugin

```ts
const ts = require('typescript');
const ReactDocgenTypescriptPlugin = require("react-docgen-typescript-plugin").default;
const ReactDocgenTypescriptPlugin = require('react-docgen-typescript-plugin').default;

module.exports = {
plugins: [
// Will default to loading your root tsconfig.json
new ReactDocgenTypescriptPlugin(),
// or with a specific tsconfig
new ReactDocgenTypescriptPlugin({ tsconfigPath: "./tsconfig.dev.json" }),
new ReactDocgenTypescriptPlugin({ tsconfigPath: './tsconfig.dev.json' }),
// or with compiler options
new ReactDocgenTypescriptPlugin({ compilerOptions: { jsx: ts.JsxEmit.Preserve } }),
],
Expand All @@ -45,8 +45,8 @@ This plugins support all parser options from [react-docgen-typescript](https://g
| docgenCollectionName | string or null | Specify the docgen collection name to use. All docgen information will be collected into this global object. Set to `null` to disable. | `STORYBOOK_REACT_CLASSES` |
| setDisplayName | boolean | Set the components' display name. If you want to set display names yourself or are using another plugin to do this, you should disable this option. | `true` |
| typePropName | string | Specify the name of the property for docgen info prop type. | `type` |
| exclude | glob[] | Glob patterns to ignore and not generate docgen information for. (Great for ignoring large icon libraries) | `[]` |
| include | glob[] | Glob patterns to generate docgen information for | `['**/**.tsx']` |
| exclude | glob[] | Glob patterns to ignore and not generate docgen information for. (Great for ignoring large icon libraries) | `[]` |
| include | glob[] | Glob patterns to generate docgen information for | `['**/**.tsx']` |

## Debugging

Expand Down Expand Up @@ -98,4 +98,4 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
88 changes: 88 additions & 0 deletions eslint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import js from '@eslint/js';
import type { Linter } from 'eslint';
import prettier from 'eslint-config-prettier';
import importPlugin from 'eslint-plugin-import';
import jsdoc from 'eslint-plugin-jsdoc';
import nPlugin from 'eslint-plugin-n';
import prettierPlugin from 'eslint-plugin-prettier';
import vitest from 'eslint-plugin-vitest';
import globals from 'globals';
import tseslint from 'typescript-eslint';

const config: Linter.Config[] = [
js.configs.recommended,
...tseslint.configs.recommended,
prettier,
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
globals: {
...globals.node,
},
parser: tseslint.parser,
parserOptions: {
project: './tsconfig.json',
sourceType: 'module',
},
},
plugins: {
'@typescript-eslint': tseslint.plugin,
import: importPlugin,
jsdoc: jsdoc,
n: nPlugin,
prettier: prettierPlugin,
},
rules: {
'prettier/prettier': 'error',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
'import/no-unresolved': 'off',
'import/extensions': 'off',
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
fixStyle: 'inline-type-imports',
},
],
'@typescript-eslint/no-import-type-side-effects': 'error',
'n/prefer-node-protocol': 'error',
complexity: 'off',
'class-methods-use-this': 'off',
'object-shorthand': ['error', 'always'],
},
},
{
files: ['**/*.test.ts', '**/*.test.tsx', '**/__tests__/**/*'],
languageOptions: {
globals: {
...globals.vitest,
},
},
plugins: {
vitest: vitest,
},
rules: {
...vitest.configs.recommended.rules,
},
},
{
ignores: [
'test-output/**',
'prettier.config.mjs',
'eslint.config.ts',
'**/__fixtures__/**',
'dist/**',
'node_modules/**',
],
},
];

export default config;
8 changes: 0 additions & 8 deletions jest.config.js

This file was deleted.

122 changes: 58 additions & 64 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,86 +2,80 @@
"name": "react-docgen-typescript-plugin",
"version": "1.0.8",
"description": "A webpack plugin to inject react typescript docgen information.",
"license": "MIT",
"repository": "hipstersmoothie/react-docgen-typescript-plugin",
"author": "Andrew Lisowski <lisowski54@gmail.com>",
"main": "dist/index.js",
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
},
"scripts": {
"build:example": "npm run build && webpack",
"build": "tsc -p tsconfig.build.json",
"start": "yarn build --watch",
"lint": "eslint src --ext .ts,.js",
"test": "npm run test:v4 && npm run test:v5",
"pretest:v4": "add-no-save @types/webpack ts-loader@8 webpack@4",
"test:v4": "jest",
"pretest:v5": "add-no-save webpack@5",
"test:v5": "jest",
"release": "auto shipit"
},
"keywords": [
"react",
"docgen",
"typescript",
"webpack",
"plugin"
],
"repository": "hipstersmoothie/react-docgen-typescript-plugin",
"license": "MIT",
"author": "Andrew Lisowski <lisowski54@gmail.com>",
"main": "dist/index.js",
"files": [
"dist"
],
"dependencies": {
"debug": "^4.1.1",
"find-cache-dir": "^3.3.1",
"flat-cache": "^3.0.4",
"micromatch": "^4.0.2",
"react-docgen-typescript": "^2.2.2",
"tslib": "^2.6.2"
"scripts": {
"build": "tsup src/index.ts src/loader.ts --dts",
"format": "prettier --write \"**/*.{js,ts,tsx,json,css,md}\"",
"format:check": "prettier --check \"**/*.{js,ts,tsx,json,css,md}\"",
"lint": "eslint src",
"check": "tsc --noEmit",
"release": "auto shipit",
"start": "pnpm build --watch",
"test": "vitest"
},
"lint-staged": {
"*.{js,css,md,json}": [
"prettier --write",
"git add"
]
},
"devDependencies": {
"@types/debug": "^4.1.5",
"@types/find-cache-dir": "^3.2.0",
"@types/flat-cache": "^2.0.0",
"@types/jest": "^29.5.12",
"@types/micromatch": "^4.0.1",
"@types/node": "^14.0.12",
"@types/react": "^17.0.0",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
"auto": "^11.1.1",
"@eslint/js": "^9.39.2",
"@stzhu/prettier-plugin-tsconfig": "^0.7.1",
"@trivago/prettier-plugin-sort-imports": "^6.0.2",
"@types/debug": "^4.1.12",
"@types/find-cache-dir": "^5.0.2",
"@types/flat-cache": "^2.0.2",
"@types/micromatch": "^4.0.10",
"@types/node": "^25.0.3",
"@types/react": "^19.2.7",
"auto": "^11.3.6",
"auto-config-hipstersmoothie": "^4.0.0",
"eslint": "^8.57.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-xo": "^0.44.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^27.9.0",
"eslint-plugin-jsdoc": "^48.2.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-prettier": "^5.1.3",
"jest": "^29.7.0",
"memfs": "^3.2.2",
"memory-fs": "^0.5.0",
"prettier": "^2.0.5",
"react": "^17.0.1",
"ts-jest": "^29.1.2",
"ts-loader": "^9.1.2",
"typescript": "5.4.2",
"webpack": "^5.36.2",
"webpack-cli": "^4.7.0",
"yarn-add-no-save": "^1.0.3"
"debug": "^4.4.3",
"eslint": "^9.39.2",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-jsdoc": "^62.0.0",
"eslint-plugin-n": "^17.0.0",
"eslint-plugin-prettier": "^5.5.4",
"eslint-plugin-vitest": "^0.5.4",
"find-cache-dir": "^6.0.0",
"flat-cache": "^6.1.19",
"globals": "^17.0.0",
"jiti": "^2.6.1",
"micromatch": "^4.0.8",
"prettier": "^3.7.4",
"react": "^19.2.3",
"react-docgen-typescript": "^2.4.0",
"ts-loader": "^9.5.4",
"tsup": "^8.5.1",
"typescript": "5.9.3",
"typescript-eslint": "^8.52.0",
"vitest": "^4.0.16",
"webpack": "^5.104.1",
"webpack-cli": "^6.0.1"
},
"peerDependencies": {
"typescript": ">= 4.x",
"webpack": ">= 4"
"typescript": ">= 5.x",
"webpack": ">= 5"
},
"lint-staged": {
"*.{js,css,md}": [
"prettier --write",
"git add"
]
"packageManager": "pnpm@10.25.0+sha512.5e82639027af37cf832061bcc6d639c219634488e0f2baebe785028a793de7b525ffcd3f7ff574f5e9860654e098fe852ba8ac5dd5cefe1767d23a020a92f501",
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"auto": {
"extends": "hipstersmoothie"
Expand Down
Loading