chore: install Storybook

This commit is contained in:
MAZE 2024-04-27 20:07:39 +03:30
parent 583578b315
commit 65ca7e1c94
6 changed files with 8501 additions and 188 deletions

View file

@ -1,15 +1,12 @@
{ {
"root": true, "root": true,
"env": { "env": {
"browser": true, "browser": true,
"amd": true, "amd": true,
"node": true, "node": true,
"es2022": true "es2022": true
}, },
"parser": "@typescript-eslint/parser", "parser": "@typescript-eslint/parser",
"parserOptions": { "parserOptions": {
"ecmaVersion": "latest", "ecmaVersion": "latest",
"sourceType": "module", "sourceType": "module",
@ -17,7 +14,6 @@
"jsx": true "jsx": true
} }
}, },
"extends": [ "extends": [
"eslint:recommended", "eslint:recommended",
"plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended",
@ -28,9 +24,9 @@
"plugin:jsx-a11y/recommended", "plugin:jsx-a11y/recommended",
"plugin:react-hooks/recommended", "plugin:react-hooks/recommended",
"plugin:astro/recommended", "plugin:astro/recommended",
"prettier" "prettier",
"plugin:storybook/recommended"
], ],
"plugins": [ "plugins": [
"@typescript-eslint", "@typescript-eslint",
"typescript-sort-keys", "typescript-sort-keys",
@ -38,7 +34,6 @@
"sort-destructure-keys", "sort-destructure-keys",
"prettier" "prettier"
], ],
"rules": { "rules": {
"@typescript-eslint/ban-ts-comment": "off", "@typescript-eslint/ban-ts-comment": "off",
"prettier/prettier": "error", "prettier/prettier": "error",
@ -54,48 +49,39 @@
} }
] ]
}, },
"settings": { "settings": {
"react": { "react": {
"version": "detect" "version": "detect"
}, },
"import/parsers": { "import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx", ".js", ".jsx"] "@typescript-eslint/parser": [".ts", ".tsx", ".js", ".jsx"]
}, },
"import/resolver": { "import/resolver": {
"typescript": true, "typescript": true,
"node": true, "node": true,
"alias": { "alias": {
"extensions": [".js", ".jsx", ".ts", ".tsx", ".d.ts"], "extensions": [".js", ".jsx", ".ts", ".tsx", ".d.ts"],
"map": [["@", "./src"]] "map": [["@", "./src"]]
} }
} }
}, },
"overrides": [ "overrides": [
{ {
"files": ["**/*.astro"], "files": ["**/*.astro"],
"parser": "astro-eslint-parser", "parser": "astro-eslint-parser",
"parserOptions": { "parserOptions": {
"parser": "@typescript-eslint/parser", "parser": "@typescript-eslint/parser",
"extraFileExtensions": [".astro"] "extraFileExtensions": [".astro"]
}, },
"rules": { "rules": {
"prettier/prettier": "error", "prettier/prettier": "error",
"react/no-unknown-property": "off", "react/no-unknown-property": "off",
"react/jsx-key": "off" "react/jsx-key": "off"
}, },
"globals": { "globals": {
"Astro": "readonly" "Astro": "readonly"
} }
}, },
{ {
"files": ["**/*.astro/*.js"], "files": ["**/*.astro/*.js"],
"rules": { "rules": {

2
.gitignore vendored
View file

@ -19,3 +19,5 @@ pnpm-debug.log*
# macOS-specific files # macOS-specific files
.DS_Store .DS_Store
*storybook.log

19
.storybook/main.js Normal file
View file

@ -0,0 +1,19 @@
/** @type { import('@storybook/react-vite').StorybookConfig } */
const config = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [
'@storybook/addon-onboarding',
'@storybook/addon-links',
'@storybook/addon-essentials',
'@chromatic-com/storybook',
'@storybook/addon-interactions',
],
framework: {
name: '@storybook/react-vite',
options: {},
},
docs: {
autodocs: 'tag',
},
};
export default config;

13
.storybook/preview.js Normal file
View file

@ -0,0 +1,13 @@
/** @type { import('@storybook/react').Preview } */
const preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};
export default preview;

8621
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -18,7 +18,9 @@
"release": "standard-version --no-verify", "release": "standard-version --no-verify",
"release:major": "npm run release -- --release-as major", "release:major": "npm run release -- --release-as major",
"release:minor": "npm run release -- --release-as minor", "release:minor": "npm run release -- --release-as minor",
"release:patch": "npm run release -- --release-as patch" "release:patch": "npm run release -- --release-as patch",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
}, },
"dependencies": { "dependencies": {
"@astrojs/react": "^3.0.3", "@astrojs/react": "^3.0.3",
@ -41,8 +43,17 @@
"zustand": "4.4.3" "zustand": "4.4.3"
}, },
"devDependencies": { "devDependencies": {
"@chromatic-com/storybook": "1.3.3",
"@commitlint/cli": "17.7.2", "@commitlint/cli": "17.7.2",
"@commitlint/config-conventional": "17.7.0", "@commitlint/config-conventional": "17.7.0",
"@storybook/addon-essentials": "8.0.9",
"@storybook/addon-interactions": "8.0.9",
"@storybook/addon-links": "8.0.9",
"@storybook/addon-onboarding": "8.0.9",
"@storybook/blocks": "8.0.9",
"@storybook/react": "8.0.9",
"@storybook/react-vite": "8.0.9",
"@storybook/test": "8.0.9",
"@typescript-eslint/eslint-plugin": "6.7.4", "@typescript-eslint/eslint-plugin": "6.7.4",
"@typescript-eslint/parser": "6.7.4", "@typescript-eslint/parser": "6.7.4",
"astro-eslint-parser": "0.16.0", "astro-eslint-parser": "0.16.0",
@ -61,6 +72,7 @@
"eslint-plugin-react-hooks": "4.6.0", "eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-sort-destructure-keys": "1.5.0", "eslint-plugin-sort-destructure-keys": "1.5.0",
"eslint-plugin-sort-keys-fix": "1.1.2", "eslint-plugin-sort-keys-fix": "1.1.2",
"eslint-plugin-storybook": "0.8.0",
"eslint-plugin-typescript-sort-keys": "3.1.0", "eslint-plugin-typescript-sort-keys": "3.1.0",
"husky": "8.0.3", "husky": "8.0.3",
"lint-staged": "14.0.1", "lint-staged": "14.0.1",
@ -68,7 +80,9 @@
"postcss-nesting": "12.0.1", "postcss-nesting": "12.0.1",
"prettier": "3.0.3", "prettier": "3.0.3",
"prettier-plugin-astro": "0.12.0", "prettier-plugin-astro": "0.12.0",
"prop-types": "15.8.1",
"standard-version": "9.5.0", "standard-version": "9.5.0",
"storybook": "8.0.9",
"stylelint": "15.10.3", "stylelint": "15.10.3",
"stylelint-config-html": "1.1.0", "stylelint-config-html": "1.1.0",
"stylelint-config-recess-order": "4.4.0", "stylelint-config-recess-order": "4.4.0",