Skip to content

Commit

Permalink
feat: add typescript support
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximiliano Forlenza committed Jan 6, 2025
1 parent 01b2fdb commit cbb2a3c
Show file tree
Hide file tree
Showing 132 changed files with 5,049 additions and 10,359 deletions.
38 changes: 16 additions & 22 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
{
"presets": [
[
"@babel/preset-react",
{
"runtime": "automatic"
}
],
["@babel/preset-env"]
"presets": [
[
"@babel/preset-react",
{
"runtime": "automatic"
}
],
"plugins": [
["module-resolver", {
["@babel/preset-env"],
"@babel/preset-typescript"
],
"plugins": [
[
"module-resolver",
{
"root": ["./"],
"alias": {
"@": "./src"
}
}]
],
"env": {
"production": {
"plugins": [
["transform-react-remove-prop-types", {
"mode": "wrap",
"ignoreFilenames": ["node_modules"]
}]
]
}
}
}
]
]
}
11 changes: 7 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
settings: {
'import/resolver': {
alias: {
extensions: ['.js'],
extensions: ['.js', '.tsx', '.ts'],
map: [['@', './src']]
}
}
Expand Down Expand Up @@ -44,9 +44,12 @@ module.exports = {
'object-curly-spacing': ['error', 'never'],
'eol-last': ['error'],
'comma-dangle': ['error', 'never'],
'react/jsx-filename-extension': [1, {
extensions: ['.js', '.jsx']
}],
'react/jsx-filename-extension': [
1,
{
extensions: ['.js', '.jsx', '.ts', '.tsx']
}
],
'arrow-parens': 'off',
'no-underscore-dangle': 'off',
'object-curly-newline': 'off'
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ build/
.idea
*.log
.history/

.codegpt
*storybook.log
27 changes: 0 additions & 27 deletions .storybook/main.js

This file was deleted.

35 changes: 35 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const path = require('path');

module.exports = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(tsx)'],
addons: [],
framework: {
name: '@storybook/react-webpack5',
options: {}
},
webpackFinal: async (config, {configType}) => {
config.resolve.alias = {
...config.resolve.alias,
'@': path.resolve(__dirname, '../src')
};

config.module.rules.push({
test: /\.(ts|tsx)$/,
use: [
{
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', ['@babel/preset-react', {runtime: 'automatic'}], '@babel/preset-typescript']
}
}
]
});

config.resolve.extensions.push('.ts', '.tsx');

return config;
},
docs: {
autodocs: true
}
};
22 changes: 13 additions & 9 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
}
/** @type { import('@storybook/react').Preview } */
const preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i
}
}
}
};

export default preview;
Loading

0 comments on commit cbb2a3c

Please sign in to comment.