Skip to content

Commit

Permalink
Merge pull request #2 from nashtech-garage/fix/bug-remaining
Browse files Browse the repository at this point in the history
Feat: Migrate to story 8 and fix  eslint cannot lint to apps
  • Loading branch information
tintungtang authored Oct 30, 2024
2 parents 423c382 + d109875 commit 28a0514
Show file tree
Hide file tree
Showing 111 changed files with 12,797 additions and 12,841 deletions.
1 change: 0 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nrwl/nx"],
"overrides": [
{
Expand Down
9 changes: 8 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{
"css.customData": [".vscode/tailwind.json"]
"css.customData": [".vscode/tailwind.json"],
"[typescript]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll": "always"
}
},
}
93 changes: 93 additions & 0 deletions apps/base-ui-toolkit-react/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
const ts = require('typescript')

module.exports = {
root: true,
env: {
browser: true,
es2021: true,
},
extends: [
'../../.eslintrc.json',
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'prettier',
'plugin:storybook/recommended',
'airbnb',
'airbnb-typescript',
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.eslint.json',
tsconfigRootDir: __dirname,
},
plugins: ['@typescript-eslint', 'react', 'simple-import-sort'],
ignorePatterns: [
'vite.config.ts',
'typings.d.ts',
'tailwind.config.js',
'theme.ts',
'*.stories.mdx',
'.eslintrc.js',
],
rules: {
'react/jsx-key': 'off',
'react/react-in-jsx-scope': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'warn',
'no-console': 'warn',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
'react/require-default-props': 'off',
'import/prefer-default-export': 'off',
'react/button-has-type': 'off',
'@typescript-eslint/semi': 'off',
'object-curly-newline': 'off',
'linebreak-style': 'off',
'no-extraneous-dependencies': 'off',
'import/no-extraneous-dependencies': 'off',
'import/extensions': [
'error',
{
ignorePackages: true,
pattern: {
css: 'always',
},
},
],
'react/function-component-definition': [
2,
{ namedComponents: 'arrow-function' },
],
'react/jsx-props-no-spreading': 'off',
'implicit-arrow-linebreak': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'jsx-a11y/no-static-element-interactions': 'off',
'jsx-a11y/anchor-is-valid': 'off',
'import/no-cycle': 'off',
'storybook/prefer-pascal-case': 'off',
'import/no-named-as-default': 'off',
'@typescript-eslint/indent': 'off',
'react/no-danger': 'off',
'react/no-array-index-key': 'off',
'max-len': ['off'],
'operator-linebreak': [
'error',
'after',
{ overrides: { '?': 'before', ':': 'before' } },
],
'react/jsx-closing-bracket-location': 'off',
'react/jsx-one-expression-per-line': 'off',
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'react/jsx-curly-newline': 'off',
'jsx-a11y/control-has-associated-label': 'off',
'function-paren-newline': 'off',
'@typescript-eslint/ban-ts-comment': 'warn',
},
settings: {
react: {
version: 'detect',
},
},
}
91 changes: 0 additions & 91 deletions apps/base-ui-toolkit-react/.eslintrc.json

This file was deleted.

36 changes: 13 additions & 23 deletions apps/base-ui-toolkit-react/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,18 @@
import type { Preview } from "@storybook/react";
import { withThemeByDataAttribute } from "@storybook/addon-styling";
import type { Preview } from '@storybook/react'

import "../src/tailwind/theme.css";

export const decorators = [
withThemeByDataAttribute({
themes: {
light: "light",
dark: "dark",
},
defaultTheme: "light",
attributeName: "data-mode",
}),
];
import '../src/tailwind/theme.css'

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
},
};

export default preview;
tags: ['autodocs'],
}

export default preview
31 changes: 16 additions & 15 deletions apps/base-ui-toolkit-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"build:lib": "tsc && vite build",
"test": "vitest",
"test:cov": "vitest run --coverage",
"lint": "eslint src/**/*.{ts,tsx} --fix",
"prepack": "json -f package.json -I -e \"delete this.devDependencies; delete this.dependencies\""
},
"dependencies": {
Expand Down Expand Up @@ -61,20 +62,19 @@
},
"devDependencies": {
"@babel/core": "7.22.10",
"@chromatic-com/storybook": "^1",
"@chromatic-com/storybook": "^3.1.0",
"@commitlint/cli": "^18.5.0",
"@commitlint/config-conventional": "^18.5.0",
"@storybook/addon-essentials": "^8.1.6",
"@storybook/addon-interactions": "^8.1.6",
"@storybook/addon-links": "^8.1.6",
"@storybook/addon-mdx-gfm": "^8.1.6",
"@storybook/addon-styling": "1.3.7",
"@storybook/blocks": "^8.1.6",
"@storybook/manager-api": "^8.1.6",
"@storybook/react": "^8.1.6",
"@storybook/react-vite": "^8.1.6",
"@storybook/test": "^8.1.6",
"@storybook/theming": "^8.1.6",
"@storybook/addon-essentials": "^8.3.6",
"@storybook/addon-interactions": "^8.3.6",
"@storybook/addon-links": "^8.3.6",
"@storybook/addon-mdx-gfm": "^8.3.6",
"@storybook/blocks": "^8.3.6",
"@storybook/manager-api": "^8.3.6",
"@storybook/react": "^8.3.6",
"@storybook/react-vite": "^8.3.6",
"@storybook/test": "^8.3.6",
"@storybook/theming": "^8.3.6",
"@tailwindcss/forms": "^0.5.6",
"@testing-library/react": "14.0.0",
"@types/node": "20.4.9",
Expand All @@ -96,7 +96,7 @@
"eslint-plugin-promise": "6.1.1",
"eslint-plugin-react": "7.33.2",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-storybook": "^0.8.0",
"eslint-plugin-storybook": "^0.10.1",
"jsdom": "22.1.0",
"json": "11.0.0",
"lint-staged": "13.2.3",
Expand All @@ -105,7 +105,7 @@
"prettier": "3.0.1",
"prop-types": "15.8.1",
"sass-embedded": "^1.80.4",
"storybook": "^8.1.6",
"storybook": "^8.3.6",
"tailwind-merge": "^1.14.0",
"tailwindcss": "3.4.0",
"typescript": "5.1.6",
Expand Down Expand Up @@ -137,7 +137,8 @@
"tar@<6.2.1": ">=6.2.1",
"ejs@<3.1.10": ">=3.1.10",
"braces@<3.0.3": ">=3.0.3",
"ws@>=8.0.0 <8.17.1": ">=8.17.1"
"ws@>=8.0.0 <8.17.1": ">=8.17.1",
"vue-template-compiler@>=2.0.0 <3.0.0": ">=3.0.0"
}
}
}
8 changes: 0 additions & 8 deletions apps/base-ui-toolkit-react/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@ import type { Meta, StoryObj } from '@storybook/react'
import { Avatar } from '.'

const meta: Meta<typeof Avatar> = {
component: Avatar,
tags: ['autodocs'],
title: 'Components/General/Avatar',
argTypes: {
size: {
options: ['sm', 'md', 'lg'],
control: 'select',
component: Avatar,
tags: ['autodocs'],
title: 'Components/General/Avatar',
argTypes: {
size: {
options: ['sm', 'md', 'lg'],
control: 'select',
},
isBordered: {
type: 'boolean',
},
},
isBordered: {
type: 'boolean',
},
},
}

export default meta
type Story = StoryObj<typeof Avatar>

export const Default: Story = {
args: {
src: 'https://i.pravatar.cc/150?u=a042581f4e29026024d',
},
args: {
src: 'https://i.pravatar.cc/150?u=a042581f4e29026024d',
},
}
Loading

0 comments on commit 28a0514

Please sign in to comment.