Skip to content

Commit

Permalink
feat: add spaceView
Browse files Browse the repository at this point in the history
  • Loading branch information
hosseinmd committed Jun 15, 2022
1 parent 75862bc commit 121e8ba
Show file tree
Hide file tree
Showing 15 changed files with 7,926 additions and 8,125 deletions.
147 changes: 67 additions & 80 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
const isCommit = process.env.COMMIT;

module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2020,
ecmaFeatures: {
jsx: true,
jsx: true
},
project: "./tsconfig.json",
sourceType: "module",
createDefaultProgram: true,
createDefaultProgram: true
},
extends: [
"prettier",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"plugin:react/recommended",
],
extends: ["prettier", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended", "plugin:react/recommended", "plugin:storybook/recommended"],
plugins: ["react-hooks"],
rules: {
"no-console": [isCommit ? "error" : "warn", { allow: ["warn", "error"] }],
"no-console": [isCommit ? "error" : "warn", {
allow: ["warn", "error"]
}],
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-empty-interface": "off",
"react/prop-types": "off",
Expand All @@ -30,81 +26,72 @@ module.exports = {
"prefer-const": "error",
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
"react-hooks/rules-of-hooks": "error", // Checks rules of Hooks
"react-hooks/exhaustive-deps": "error", // Checks effect dependencies
"react-hooks/rules-of-hooks": "error",
// Checks rules of Hooks
"react-hooks/exhaustive-deps": "error",
// Checks effect dependencies
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{ argsIgnorePattern: "^_", ignoreRestSiblings: true },
],
"@typescript-eslint/no-unused-vars": ["warn", {
argsIgnorePattern: "^_",
ignoreRestSiblings: true
}],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/camelcase": "off",
"prettier/prettier": [
"off",
{
endOfLine: "auto",
},
],
"prettier/prettier": ["off", {
endOfLine: "auto"
}],
camelcase: "off",
...(isCommit
? {
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", ignoreRestSiblings: true },
],
"@typescript-eslint/no-non-null-assertion": "error",
...(isCommit ? {
"@typescript-eslint/no-unused-vars": ["error", {
argsIgnorePattern: "^_",
ignoreRestSiblings: true
}],
"@typescript-eslint/no-non-null-assertion": "error"
} : {
"@typescript-eslint/naming-convention": ["error", // {
// selector: 'default',
// format: ['camelCase'],
// },
{
selector: "variable",
format: ["camelCase", "UPPER_CASE", "PascalCase"],
leadingUnderscore: "allow",
filter: {
// you can expand this regex to add more allowed names
regex: "^([_]+[A-Z]+[_]+)$",
match: false
}
: {
"@typescript-eslint/naming-convention": [
"error",
// {
// selector: 'default',
// format: ['camelCase'],
// },
{
selector: "variable",
format: ["camelCase", "UPPER_CASE", "PascalCase"],
leadingUnderscore: "allow",
filter: {
// you can expand this regex to add more allowed names
regex: "^([_]+[A-Z]+[_]+)$",
match: false,
},
},
{
selector: "variable",
types: ["boolean"],
format: ["PascalCase", "UPPER_CASE"],
prefix: ["is", "should", "has", "can", "did", "will"],
filter: {
// you can expand this regex to add more allowed names
regex: "^[_]+.*$",
match: false,
},
},
{
selector: "function",
format: ["camelCase", "PascalCase"],
leadingUnderscore: "allow",
},
// {
// selector: 'parameter',
// format: ['strictCamelCase'],
// leadingUnderscore: 'allow',
// },
// {
// selector: 'memberLike',
// format: ['strictCamelCase'],
// leadingUnderscore: 'allow',
// },
{
selector: "typeLike",
format: ["PascalCase"],
},
],
}),
},
};
}, {
selector: "variable",
types: ["boolean"],
format: ["PascalCase", "UPPER_CASE"],
prefix: ["is", "should", "has", "can", "did", "will"],
filter: {
// you can expand this regex to add more allowed names
regex: "^[_]+.*$",
match: false
}
}, {
selector: "function",
format: ["camelCase", "PascalCase"],
leadingUnderscore: "allow"
}, // {
// selector: 'parameter',
// format: ['strictCamelCase'],
// leadingUnderscore: 'allow',
// },
// {
// selector: 'memberLike',
// format: ['strictCamelCase'],
// leadingUnderscore: 'allow',
// },
{
selector: "typeLike",
format: ["PascalCase"]
}]
})
}
};
60 changes: 22 additions & 38 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,34 @@ const configOverrides = require("../config-overrides");
module.exports = {
stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
addons: [
"storybook/addons",
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/core-events",
"@storybook/api",
"@storybook/addon-interactions",
"@storybook/preset-create-react-app",
],
previewHead: (head) => `
${head}
<style>
#docs-root {
overflow:auto;
height:100%;
scrollbar-width: thin;
scrollbar-color: #91a8c3 transparent;
}
#docs-root::-webkit-scrollbar {
width: 8px;
}
#docs-root::-webkit-scrollbar-track {
background: transparent;
}
#docs-root::-webkit-scrollbar-thumb {
background: #91a8c3;
}
</style>
`,
framework: "@storybook/react",
core: {
builder: "@storybook/builder-webpack5",
},
webpackFinal: async (config) => {
config = configOverrides.webpack(config, "", 5);

config.resolve.alias = {
...(config.resolve.alias || {}),
// Transform all direct `react-native` imports to `react-native-web`
"react-native$": "react-native-web",
// make sure we're rendering output using **web** Storybook not react-native
"@storybook/react-native": "@storybook/react",
// plugin-level react-native-web extensions
"react-native-svg": "react-native-svg/lib/commonjs/ReactNativeSVG.web",
// ...
};
// config.resolve.alias = {
// ...(config.resolve.alias || {}),
// // Transform all direct `react-native` imports to `react-native-web`
// "react-native$": "react-native-web",
// // make sure we're rendering output using **web** Storybook not react-native
// "@storybook/react-native": "@storybook/react",
// // plugin-level react-native-web extensions
// "react-native-svg": "react-native-svg/lib/commonjs/ReactNativeSVG.web",
// // ...
// };

config.plugins.forEach((plugin) => {
if (plugin?.definitions?.__MOCK__ === false) {
plugin.definitions.__MOCK__ = true;
}
});
// config.plugins.forEach((plugin) => {
// if (plugin?.definitions?.__MOCK__ === false) {
// plugin.definitions.__MOCK__ = true;
// }
// });

// mutate babel-loader
// config.module.rules[0].use[0].options.plugins.push([
Expand Down
9 changes: 9 additions & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
}
9 changes: 3 additions & 6 deletions config-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const webpack = require("webpack");
const path = require("path");
const ModuleScopePlugin = require("react-dev-utils/ModuleScopePlugin");

const ESLintPlugin = require("eslint-webpack-plugin/");
const resolvePath = (relativePath) => path.resolve(__dirname, relativePath);

const appIncludes = [resolvePath("./src")];
Expand All @@ -14,17 +13,15 @@ module.exports = {
(plugin) => !(plugin instanceof ModuleScopePlugin),
);

config.module.rules[0].include = appIncludes;
// config.module.rules[0].include = appIncludes;

const jsConfig = config.module.rules.find(({ include }) => include);
jsConfig.include = appIncludes;
// const jsConfig = config.module.rules.find(({ include }) => include);
// jsConfig.include = appIncludes;

const __DEV__ = env !== "production";

config.plugins.push(new webpack.DefinePlugin({ __DEV__ }));

config.plugins = config.plugins.filter((v) => !(v instanceof ESLintPlugin));

return config;
},
// The Jest config to use when running your jest tests - note that the normal rewires do not
Expand Down
Loading

0 comments on commit 121e8ba

Please sign in to comment.