Skip to content

Commit

Permalink
fix(deps): update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
mkosir committed Nov 2, 2024
1 parent ed6faba commit ea27ee9
Show file tree
Hide file tree
Showing 9 changed files with 130 additions and 74 deletions.
59 changes: 0 additions & 59 deletions .eslintrc

This file was deleted.

112 changes: 112 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import eslint from '@eslint/js';
import eslintConfigPrettier from 'eslint-config-prettier';
import eslintPluginImport from 'eslint-plugin-import';
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import eslintPluginReact from 'eslint-plugin-react';
import eslintPluginReactHooks from 'eslint-plugin-react-hooks';
import eslintPluginJsxA11y from 'eslint-plugin-jsx-a11y';

import tseslint from 'typescript-eslint';

export default tseslint.config(
eslint.configs.recommended,
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
eslintPluginImport.flatConfigs.recommended,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
// Uncomment once released - https://github.com/facebook/react/pull/30774
// eslintPluginReactHooks.configs.recommended,
eslintPluginReact.configs.flat.recommended,
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
eslintPluginJsxA11y.flatConfigs.recommended,
eslintPluginPrettierRecommended,
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
eslintConfigPrettier,
{
ignores: ['!.*', 'node_modules', 'dist', 'compiled', 'build'],
},
{
languageOptions: {
parserOptions: {
projectService: true,
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
tsconfigRootDir: import.meta.name,
},
},
settings: {
'import/resolver': {
typescript: { project: 'tsconfig.dev.json' },
},
react: { version: 'detect' },
},
},
{
files: ['**/*.{js,ts,tsx}'],

plugins: {
// Remove once released - https://github.com/facebook/react/pull/30774
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
'react-hooks': eslintPluginReactHooks,
},

// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
rules: {
// Remove once released - https://github.com/facebook/react/pull/30774
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
...eslintPluginReactHooks.configs.recommended.rules,

'react/jsx-sort-props': ['error', { callbacksLast: true, shorthandFirst: true }],

'no-undef': 'off',
'prefer-template': 'error',
'no-nested-ternary': 'error',
'no-unneeded-ternary': 'error',

'@typescript-eslint/ban-ts-comment': ['error', { 'ts-expect-error': 'allow-with-description' }],
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
'@typescript-eslint/array-type': ['error', { default: 'generic' }],
'@typescript-eslint/prefer-nullish-coalescing': 'error',
'@typescript-eslint/no-unnecessary-condition': 'error',
'@typescript-eslint/no-confusing-void-expression': ['error', { ignoreArrowShorthand: true }],
'@typescript-eslint/restrict-plus-operands': 'off',
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'typeAlias',
format: ['PascalCase'],
},
{
selector: 'variable',
types: ['boolean'],
format: ['PascalCase'],
prefix: ['is', 'should', 'has', 'can', 'did', 'will'],
},
{
// Generic type parameter must start with letter T, followed by any uppercase letter.
selector: 'typeParameter',
format: ['PascalCase'],
custom: { regex: '^T[A-Z]', match: true },
},
],

'import/no-default-export': 'error',
'import/order': [
'error',
{
groups: ['builtin', 'external', 'internal', 'parent', 'sibling'],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
},
},
{
files: ['stories/**/*'],
rules: {
'import/no-default-export': 'off',
},
},
);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"start": "npm run storybook",
"prepare": "husky",
"build": "rm -rf dist && rollup --config scripts/rollup.config.ts --configPlugin typescript",
"lint": "eslint --max-warnings 0 .",
"lint": "eslint --report-unused-disable-directives --max-warnings 0 .",
"lint-fix": "eslint --fix .",
"lint-staged-husky": "lint-staged",
"tsc": "tsc -p tsconfig.dev.json",
Expand Down
8 changes: 4 additions & 4 deletions scripts/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import image from '@rollup/plugin-image';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
import { defineConfig } from 'rollup';
import dts from 'rollup-plugin-dts';
import { dts } from 'rollup-plugin-dts';

import packageJson from '../package.json' assert { type: 'json' };
import tsConfig from '../tsconfig.base.json' assert { type: 'json' };
Expand Down Expand Up @@ -53,8 +53,8 @@ const rollupConfig = defineConfig([
],
external: [
// Ensure dependencies are not bundled with the library
...Object.keys(packageJson.peerDependencies || {}),
...Object.keys(packageJson.dependencies || {}),
...Object.keys(packageJson.peerDependencies),
...Object.keys(packageJson.dependencies),
'react-tabs/style/react-tabs.css',
],
},
Expand All @@ -64,7 +64,7 @@ const rollupConfig = defineConfig([
plugins: [
dts({
compilerOptions: {
baseUrl: tsConfig.compilerOptions.baseUrl,
baseUrl: './src',
paths: tsConfig.compilerOptions.paths,
},
}),
Expand Down
13 changes: 8 additions & 5 deletions src/react-demo-tab/DemoTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const localStorageKey = 'react-demo-tab';
export const DemoTab = ({ code, style, codeExt = 'jsx', styleExt = 'css', children }: DemoTabProps) => {
const [tabIndex, setTabIndex] = useLocalStorage<LocalStorage>(localStorageKey, { mainTabIndex: 0, codeTabIndex: 0 });

// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const styleImg = styleExt === 'css' ? styleImgCSS : styleImgSass;

return (
Expand All @@ -28,29 +29,31 @@ export const DemoTab = ({ code, style, codeExt = 'jsx', styleExt = 'css', childr
<Tab>Code</Tab>
</TabList>
<TabPanel className="tab-demo">{children}</TabPanel>
<TabPanel style={{ fontSize: '14px' }} className="tab-code">
<TabPanel className="tab-code" style={{ fontSize: '14px' }}>
<Tabs
defaultIndex={tabIndex.codeTabIndex}
onSelect={(index: number) => setTabIndex({ mainTabIndex: tabIndex.mainTabIndex, codeTabIndex: index })}
>
<TabList>
<Tab>
<img src={codeImg} height="30" alt="code-img" />
{/* eslint-disable-next-line @typescript-eslint/no-unsafe-assignment */}
<img alt="code-img" height="30" src={codeImg} />
</Tab>
{style && (
<Tab>
<img src={styleImg} height="30" alt="style-img" />
{/* eslint-disable-next-line @typescript-eslint/no-unsafe-assignment */}
<img alt="style-img" height="30" src={styleImg} />
</Tab>
)}
</TabList>
<TabPanel>
<SyntaxHighlighter language={codeExt} style={prism} showLineNumbers={true}>
<SyntaxHighlighter language={codeExt} showLineNumbers={true} style={prism}>
{code}
</SyntaxHighlighter>
</TabPanel>
{style && (
<TabPanel>
<SyntaxHighlighter language={styleExt} style={prism} showLineNumbers={true}>
<SyntaxHighlighter language={styleExt} showLineNumbers={true} style={prism}>
{style}
</SyntaxHighlighter>
</TabPanel>
Expand Down
2 changes: 1 addition & 1 deletion stories/ButtonGreen/_ButtonGreenDemoTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const style = `.btn-green {
}`;

export const _ButtonGreen = () => (
<DemoTab code={code} style={style} codeExt="jsx" styleExt="css">
<DemoTab code={code} codeExt="jsx" style={style} styleExt="css">
<Demo />
</DemoTab>
);
4 changes: 2 additions & 2 deletions stories/ButtonRed/_ButtonRedDemoTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const style = `.btn-red {
background-color: red;
font-size: 14px;
padding: 12px 26px;
border-radius: 6px;
border-radius: 6px;
cursor: pointer;
-webkit-transition-duration: 0.2s;
transition-duration: 0.2s;
Expand All @@ -27,7 +27,7 @@ const style = `.btn-red {
}`;

export const _ButtonRed = () => (
<DemoTab code={code} style={style} codeExt="tsx" styleExt="scss">
<DemoTab code={code} codeExt="tsx" style={style} styleExt="scss">
<Demo />
</DemoTab>
);
2 changes: 1 addition & 1 deletion stories/Counter/Counter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const Counter = () => {

const onCountInc = () => setCount(count + 1);

const msg = `Button clicked ${count} ${count > 1 ? 'times' : 'time'}`;
const msg = `Button clicked ${count.toString()} ${count > 1 ? 'times' : 'time'}`;

return (
<>
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Stories are written in .js/.jsx
"allowJs": true
},
"include": ["."],
"include": [".", ".storybook/**/*", ".commitlintrc.ts"],
// Storybook
"ts-node": {
"compilerOptions": {
Expand Down

0 comments on commit ea27ee9

Please sign in to comment.