Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♻️ Improved development setup #78

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
50 changes: 45 additions & 5 deletions asg.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,62 @@
],
"settings": {
"cSpell.words": [
"antfu",
"consola",
"magicast",
"satoshi",
"scule",
"vitepress",
"vumdoc",
"vumdoc"
],
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",

// Enable the ESlint flat config support
"eslint.experimental.useFlatConfig": true,

// Disable the default formatter, use eslint instead
"prettier.enable": false,
"editor.tabSize": 2,
"editor.formatOnSave": false,
"files.eol": "\n",
"typescript.preferences.importModuleSpecifier": "non-relative",

// Auto fix
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never",
"source.addMissingImports": "explicit",
},
"files.eol": "\n",
"typescript.preferences.importModuleSpecifier": "non-relative",

// Silent the stylistic rules in you IDE, but still auto fix them
"eslint.rules.customizations": [
{ "rule": "style/*", "severity": "off" },
{ "rule": "format/*", "severity": "off" },
{ "rule": "*-indent", "severity": "off" },
{ "rule": "*-spacing", "severity": "off" },
{ "rule": "*-spaces", "severity": "off" },
{ "rule": "*-order", "severity": "off" },
{ "rule": "*-dangle", "severity": "off" },
{ "rule": "*-newline", "severity": "off" },
{ "rule": "*quotes", "severity": "off" },
{ "rule": "*semi", "severity": "off" },
],

// Enable eslint for all supported languages
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml",
"toml",
"gql",
"graphql",
],
},
"extensions": {},
}
2 changes: 0 additions & 2 deletions packages/auto-story-generator/.eslintignore

This file was deleted.

13 changes: 0 additions & 13 deletions packages/auto-story-generator/.prettierrc.cjs

This file was deleted.

46 changes: 42 additions & 4 deletions packages/auto-story-generator/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,49 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
// Enable the ESlint flat config support
"eslint.experimental.useFlatConfig": true,

// Disable the default formatter, use eslint instead
"prettier.enable": false,
"editor.tabSize": 2,
"editor.formatOnSave": false,
"files.eol": "\n",
"typescript.preferences.importModuleSpecifier": "non-relative",

// Auto fix
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never",
"source.addMissingImports": "explicit"
},
"files.eol": "\n",
"typescript.preferences.importModuleSpecifier": "non-relative"

// Silent the stylistic rules in you IDE, but still auto fix them
"eslint.rules.customizations": [
{ "rule": "style/*", "severity": "off" },
{ "rule": "format/*", "severity": "off" },
{ "rule": "*-indent", "severity": "off" },
{ "rule": "*-spacing", "severity": "off" },
{ "rule": "*-spaces", "severity": "off" },
{ "rule": "*-order", "severity": "off" },
{ "rule": "*-dangle", "severity": "off" },
{ "rule": "*-newline", "severity": "off" },
{ "rule": "*quotes", "severity": "off" },
{ "rule": "*semi", "severity": "off" }
],

// Enable eslint for all supported languages
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml",
"toml",
"gql",
"graphql"
]
}
18 changes: 9 additions & 9 deletions packages/auto-story-generator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@ Add settings to main.ts in Storybook (`./storybook/main.ts`)

For `React`, `Vite`
```ts
import type { StorybookConfig } from "@storybook/react-vite";
import type { StorybookConfig } from '@storybook/react-vite'

import { mergeConfig } from "vite";
import { mergeConfig } from 'vite'

import autoStoryGenerator from "@takuma-ru/auto-story-generator";
import autoStoryGenerator from '@takuma-ru/auto-story-generator'

const config: StorybookConfig = {
viteFinal: async (config) =>
viteFinal: async config =>
mergeConfig(config, {
plugins: [
autoStoryGenerator.vite({
preset: "react",
imports: ["src/components/**/*.tsx"],
preset: 'react',
imports: ['src/components/**/*.tsx'],
}),
],
}),
};
}

export default config;
export default config
```

## Supported Frameworks
Expand All @@ -50,4 +50,4 @@ export default config;
| Lit | ✅ |
| Angular | 🚧 |
| Svelte | 📝 |
| Custom | 📝 |
| Custom | 📝 |
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@
/** @type {import('eslint/lib/shared/types').ConfigData} */
import antfu from '@antfu/eslint-config'

export default antfu({
rules: {
'no-console': [
'error',
{
allow: ['error', 'warn'],
},
],

'no-restricted-imports': [
'error',
{
patterns: ['./', '../'],
},
],

'no-restricted-syntax': [
'error',
{
selector: 'CallExpression[callee.object.name="consola"][callee.property.name="error"]',
message: 'consola.error is not allowed. Use throwErr() instead.',
},
],
},
})
/*
// MEMO: old config
const config = {
env: {
browser: true,
Expand Down Expand Up @@ -59,3 +87,4 @@ const config = {
};

module.exports = config;
*/
77 changes: 36 additions & 41 deletions packages/auto-story-generator/package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,45 @@
{
"name": "@takuma-ru/auto-story-generator",
"description": "Automatic real-time story file generation from React, Vue, Angular and Lit component files",
"private": false,
"version": "0.2.11",
"main": "./dist/index.js",
"module": "./dist/index.js",
"type": "module",
"types": "./dist/index.d.ts",
"version": "0.2.11",
"private": false,
"description": "Automatic real-time story file generation from React, Vue, Angular and Lit component files",
"author": "takuma-ru <[email protected]> (https://github.com/takuma-ru/)",
"license": "ISC",
"homepage": "https://auto-story-generator.takumaru.dev",
"repository": {
"type": "git",
"url": "https://github.com/takuma-ru/auto-story-generator"
},
"bugs": {
"url": "https://github.com/takuma-ru/auto-story-generator/issues",
"email": "[email protected]"
},
"keywords": [
"storybook",
"generator",
"auto",
"react",
"vue",
"lit",
"storybook-addon",
"storybook-addon-generator",
"storybook-addon-auto-story-generator"
],
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist/*",
"LICENSE.md",
"README.md"
"README.md",
"dist/*"
],
"publishConfig": {
"access": "public",
Expand All @@ -26,52 +48,25 @@
"scripts": {
"build": "tsup --dts",
"build:watch": "tsup --watch",
"lint": "eslint --ext .ts,.js .",
"lint:fix": "eslint --ext .ts,.js . --fix",
"lint:type-check": "tsc --noEmit",
"format": "prettier --write .",
"format:check": "prettier --check ."
},
"keywords": [
"storybook",
"generator",
"auto",
"react",
"vue",
"lit",
"storybook-addon",
"storybook-addon-generator",
"storybook-addon-auto-story-generator"
],
"author": "takuma-ru <[email protected]> (https://github.com/takuma-ru/)",
"license": "ISC",
"repository": {
"type": "git",
"url": "https://github.com/takuma-ru/auto-story-generator"
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"lint:type-check": "tsc --noEmit"
},
"bugs": {
"url": "https://github.com/takuma-ru/auto-story-generator/issues",
"email": "[email protected]"
},
"homepage": "https://auto-story-generator.takumaru.dev",
"dependencies": {
"consola": "^3.2.3",
"glob": "^10.3.10",
"magicast": "^0.3.2",
"minimatch": "^9.0.3",
"prettier": "^3.2.4",
"prettier": "^3.2.5",
"rxjs": "^7.8.1",
"scule": "^1.1.1",
"ts-morph": "^21.0.1",
"unplugin": "^1.5.1"
},
"devDependencies": {
"@antfu/eslint-config": "^2.13.3",
"@types/node": "^20.11.5",
"@typescript-eslint/eslint-plugin": "^6.19.0",
"@typescript-eslint/parser": "^6.19.0",
"eslint": "^8.52.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-unused-imports": "^3.0.0",
"eslint": "^8.56.0",
"tsup": "^8.0.1",
"typescript": "^5.3.3"
}
Expand Down
Loading
Loading