Skip to content

Commit

Permalink
Merge pull request #1 from deejaygeroso/feature-v1.0.0-alpha-1
Browse files Browse the repository at this point in the history
Feature v1.0.0 alpha 1
  • Loading branch information
deejaygeroso authored Feb 28, 2023
2 parents 1826995 + 98323cf commit 4e1883d
Show file tree
Hide file tree
Showing 40 changed files with 14,516 additions and 1,502 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
35 changes: 35 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nrwl/nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"],
"rules": {}
}
]
}
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
strict-peer-dependencies=false
auto-install-peers=true
node-linker=hoisted
22 changes: 21 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
{
"singleQuote": true
"arrowParens": "avoid",
"bracketSpacing": true,
"endOfLine": "auto",
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
"importOrder": [
"react(.*)$",
"@react-helper/(.*)$",
"<THIRD_PARTY_MODULES>",
"^[./]"
],
"jsxBracketSameLine": true,
"jsxSingleQuote": true,
"parser": "typescript",
"printWidth": 120,
"proseWrap": "never",
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false
}
4 changes: 2 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"recommendations": [

"nrwl.angular-console",
"esbenp.prettier-vscode"
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint"
]
}
30 changes: 30 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"eslint.format.enable": true,
"eslint.alwaysShowStatus": true,
"editor.detectIndentation": false,
"typescript.validate.enable": false,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2
}
}
43 changes: 32 additions & 11 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,56 @@
"build",
"lint",
"test",
"e2e"
"e2e",
"build-storybook"
],
"accessToken": "OTEzODY4ZmYtYmVjNC00ZmVjLThiYTAtN2NjMDViZmRiNjc5fHJlYWQtd3JpdGU="
}
}
},
"targetDefaults": {
"build": {
"dependsOn": [
"^build"
],
"dependsOn": ["^build"],
"inputs": ["production", "^production"]
},
"lint": {
"inputs": [
"production",
"^production"
"default",
"{workspaceRoot}/.eslintrc.json",
"{workspaceRoot}/.eslintignore"
]
},
"test": {
"inputs": ["default", "^production"]
},
"build-storybook": {
"inputs": ["default", "^production", "!{projectRoot}/.storybook/**/*"]
}
},
"namedInputs": {
"default": [
"{projectRoot}/**/*",
"sharedGlobals"
],
"default": ["{projectRoot}/**/*", "sharedGlobals"],
"production": [
"default"
"default",
"!{projectRoot}/.eslintrc.json",
"!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
"!{projectRoot}/tsconfig.spec.json",
"!{projectRoot}/.storybook/**/*",
"!{projectRoot}/**/*.stories.@(js|jsx|ts|tsx|mdx)"
],
"sharedGlobals": []
},
"workspaceLayout": {
"appsDir": "packages",
"libsDir": "packages"
},
"generators": {
"@nrwl/react": {
"application": {
"babel": true
},
"library": {
"unitTestRunner": "vitest"
}
}
}
}
56 changes: 54 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,65 @@
"license": "MIT",
"scripts": {},
"private": true,
"dependencies": {},
"devDependencies": {
"@babel/core": "7.12.13",
"@babel/preset-typescript": "7.12.13",
"@nrwl/eslint-plugin-nx": "15.7.2",
"@nrwl/js": "15.7.2",
"@nrwl/linter": "15.7.2",
"@nrwl/nx-cloud": "latest",
"@nrwl/react": "^15.7.2",
"@nrwl/storybook": "^15.7.2",
"@nrwl/vite": "^15.7.2",
"@nrwl/workspace": "15.7.2",
"@storybook/addon-essentials": "^6.5.15",
"@storybook/builder-vite": "^0.2.6",
"@storybook/client-api": "^6.5.16",
"@storybook/core-common": "^6.5.15",
"@storybook/core-server": "^6.5.15",
"@storybook/react": "^6.5.15",
"@svgr/webpack": "^6.1.2",
"@swc/core": "^1.2.173",
"@testing-library/react": "13.4.0",
"@trivago/prettier-plugin-sort-imports": "^4.0.0",
"@types/node": "18.11.9",
"@types/react": "18.0.25",
"@types/react-dom": "18.0.9",
"@types/react-is": "17.0.3",
"@types/styled-components": "5.1.26",
"@typescript-eslint/eslint-plugin": "^5.36.1",
"@typescript-eslint/parser": "^5.36.1",
"@vitejs/plugin-react": "^3.0.0",
"@vitest/coverage-c8": "~0.25.8",
"@vitest/ui": "^0.25.8",
"babel-loader": "8.1.0",
"babel-plugin-styled-components": "1.10.7",
"eslint": "~8.15.0",
"eslint-config-prettier": "8.1.0",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-jsx-a11y": "6.6.1",
"eslint-plugin-react": "7.31.11",
"eslint-plugin-react-hooks": "4.6.0",
"html-webpack-plugin": "^5.5.0",
"jsdom": "~20.0.3",
"node-gyp-build": "^4.6.0",
"nx": "15.7.2",
"prettier": "^2.6.2",
"typescript": "~4.8.2"
"react-test-renderer": "18.2.0",
"ts-node": "10.9.1",
"typescript": "~4.8.2",
"url-loader": "^4.1.1",
"vite": "^4.0.1",
"vite-plugin-dts": "~1.7.1",
"vite-plugin-eslint": "^1.8.1",
"vite-tsconfig-paths": "^4.0.2",
"vitest": "^0.25.8"
},
"dependencies": {
"react": "18.2.0",
"react-dom": "18.2.0",
"react-is": "18.2.0",
"styled-components": "5.3.6",
"styled-jsx": "5.1.0"
}
}
69 changes: 69 additions & 0 deletions packages/config/eslint-config-airbnb/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
const eslintSetting = {
extends: ['airbnb', 'airbnb/hooks', 'plugin:@typescript-eslint/recommended', 'prettier'],
parser: '@typescript-eslint/parser',
plugins: ['react-hooks'],
globals: {
page: true,
browser: true,
context: true,
},
plugins: ['@typescript-eslint'],
rules: {
/*
* Disabling `import/prefer-default-export` gives us the flexibility to
* use `export { default as Module } from './Module'` in index.ts files.
* As index.ts file grows having to read 1 line of exported module gives better code readability.
*/
'import/prefer-default-export': ['off'],
/*
* Disabling this rule makes our index.ts file more readable.
* This should be disabled along with `import/prefer-default-export`.
*/
'import/no-unresolved': ['off'],
/*
* For the most part of our code, we always know what files we are importing.
* Removing this won't hurt a lot but definitely will make our code much more cleaner.
*/
'import/extensions': ['off'],
/*
* Suppress errors for missing 'import React' in files.
* React version detect needs to be configured along side with this.
*/
'react/react-in-jsx-scope': 'off',
/*
* This is an opinionated rule. Prettier should handle reordering of imports for better dev experience.
*/
'import/order': 'off',
/*
* We expect react to have .ts or .tsx extension.
* Setting this overrides .js or .jsx rule extension.
*/
'react/jsx-filename-extension': ['error', { extensions: ['.ts', '.tsx'] }],
/*
* We are just basically overriding the default setting which was set to `function-declaration`.
* For this rule, only arrow functions for named components.
* This enforces code consistency type of function components.
*/
'react/function-component-definition': [
'error',
{
namedComponents: 'arrow-function',
},
],
/*
* Writing return every function is just an extra work.
* Setting return type to void is much more readable.
*/
'consistent-return': 'off',
},
settings: {
react: {
/*
* Tells eslint-plugin-react to automatically detect the version of React to use.
*/
version: 'detect',
},
},
};

module.exports = eslintSetting;
13 changes: 13 additions & 0 deletions packages/config/eslint-config-airbnb/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "@react-helper/eslint-config-airbnb",
"version": "1.0.0",
"main": "./index.js",
"dependencies": {
"@typescript-eslint/eslint-plugin": "^5.51.0",
"@typescript-eslint/parser": "^5.51.0",
"eslint": "^8.34.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-typescript-sort-keys": "^2.1.0"
}
}
40 changes: 40 additions & 0 deletions packages/config/eslint-config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module.exports = {
extends: [
'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react
'plugin:react-hooks/recommended', // Enforces Rules of React Hooks
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from @typescript-eslint/eslint-plugin
'prettier', // Turns off all rules that are unnecessary or might conflict with Prettier.
],
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
parserOptions: {
ecmaFeatures: {
jsx: true, // Allows for the parsing of JSX
},
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
},
plugins: ['react-hooks', '@typescript-eslint', 'typescript-sort-keys'],
root: true,
rules: {
'no-console': ['warn', { allow: ['info', 'error'] }],
'react/jsx-sort-props': [
'error',
{
callbacksLast: true,
ignoreCase: true,
noSortAlphabetically: false,
shorthandFirst: false,
shorthandLast: true,
},
],
semi: ['error', 'never'],
'sort-keys': ['error', 'asc', { caseSensitive: false }],
'typescript-sort-keys/interface': 'error',
'typescript-sort-keys/string-enum': 'error',
},
settings: {
react: {
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
},
},
};
14 changes: 14 additions & 0 deletions packages/config/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "@react-helper/eslint-config",
"version": "1.1.0",
"main": "./index.js",
"dependencies": {
"@typescript-eslint/eslint-plugin": "^5.51.0",
"@typescript-eslint/parser": "^5.51.0",
"eslint": "^8.34.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-typescript-sort-keys": "^2.1.0"
}
}
Loading

0 comments on commit 4e1883d

Please sign in to comment.