Skip to content

Commit

Permalink
fix: storybook works (#361)
Browse files Browse the repository at this point in the history
* fix: get storybook working

* fix: babel,eslint,typescript,storybook works

* fix: invalid import in explore.ipld.io

* fix: use in explore.ipld.io
  • Loading branch information
SgtPooki authored Jun 2, 2023
1 parent 5895c68 commit d8d2507
Show file tree
Hide file tree
Showing 34 changed files with 7,943 additions and 606 deletions.
17 changes: 14 additions & 3 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"presets": [
["@babel/preset-env", {
"modules": false
"modules": false,
"targets": "> 2%, not dead"
}],
["@babel/preset-typescript", {
"isTSX": true,
Expand All @@ -10,6 +11,16 @@
"@babel/preset-react"
],
"plugins": [
"@babel/plugin-proposal-class-properties"
]
"@babel/plugin-proposal-class-properties",
],
"ignore": [
"**/*.test.js",
"**/*.test.jsx",
"**/*.test.ts",
"**/*.test.tsx",
"**/*.stories.js",
"**/*.stories.jsx",
"**/*.stories.ts",
"**/*.stories.tsx"
],
}
19 changes: 13 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
module.exports = {
parser: '@typescript-eslint/parser',
plugins: [
'import'
],
ignorePatterns: ['node_modules'],
parserOptions: {
project: './tsconfig.eslint.json'
},
plugins: ['import'],
extends: [
'react-app',
'plugin:jsx-a11y/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
'plugin:import/typescript',
'ipfs'
'ipfs',
'plugin:storybook/recommended'
],
rules: {
'import/order': ['error', {
Expand All @@ -25,8 +28,12 @@ module.exports = {
},
warnOnUnassignedImports: true
}],
'no-console': ['error', { allow: ['error', 'info', 'time', 'timeEnd', 'warn'] }],
'import/extensions': ['error', 'never'], // Errors using extensions because ts + vite + babel + storybook needs.
'no-console': ['error', {
allow: ['error', 'info', 'time', 'timeEnd', 'warn']
}],
'no-warning-comments': ['off'],
strict: ['error', 'never']
strict: ['error', 'never'],
'react/jsx-filename-extension': ['error', { extensions: ['.jsx', '.tsx'] }]
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ dist
npm-debug.log*
yarn-debug.log*
yarn-error.log*
storybook-static
4 changes: 0 additions & 4 deletions .storybook/addons.js

This file was deleted.

12 changes: 0 additions & 12 deletions .storybook/config.js

This file was deleted.

25 changes: 25 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { StorybookConfig } from '@storybook/react-vite';
import { mergeConfig } from 'vite';

import viteConfig from '../vite.config';

const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
],
framework: {
name: '@storybook/react-vite',
options: {},
},
docs: {
autodocs: 'tag',
},
async viteFinal(config) {
// Merge custom configuration into the default config
return mergeConfig(config, viteConfig);
},
};
export default config;
22 changes: 22 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { type Preview } from '@storybook/react';

// import CSS files
import 'ipfs-css'
import 'react-virtualized/styles.css'
import 'tachyons'
import '../src/components/loader/Loader.css'
import '../src/components/object-info/LinksTable.css'

const preview: Preview = {
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
};

export default preview;
Loading

0 comments on commit d8d2507

Please sign in to comment.