Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: common configuration #85 #108

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

#Remove Below Comment For Using Husky
# pnpm pre-commit
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
"lint": "eslint packages/firecamp-rest/src/**/*.{ts|tsx} packages/*.js packages-clients/*.js scripts webpack/*.js",
"test": "jest",
"prettify": "prettier --write \"platform/firecamp-platform/src/**/*.(ts|tsx)\" \"packages/firecamp-rest/src/**/*.(ts|tsx)\" \"packages/firecamp-graphql/src/**/*.(ts|tsx)\"",
"precommit": "lint-staged",
"preinstall": "npx only-allow pnpm"
"pre-commit": "pnpm --filter=@firecamp/platform --filter=@firecamp/ui pre-commit",
"preinstall": "npx only-allow pnpm",
"prepare": "husky install"
},
"lint-staged": {
"**/*.ts": [
Expand Down Expand Up @@ -72,11 +73,11 @@
"eslint-plugin-react": "^7.20.5",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.5.0",
"husky": "^8.0.1",
"husky": "^8.0.3",
"ignore-loader": "^0.1.2",
"jest-css-modules": "^2.1.0",
"jest-css-modules-transform": "^4.4.2",
"lint-staged": "^13.1.2",
"lint-staged": "^15.0.2",
"node-polyfill-webpack-plugin": "^2.0.0",
"npm-run-all": "^4.1.5",
"postcss-loader": "^7.0.2",
Expand Down
10 changes: 10 additions & 0 deletions packages/firecamp-common-config/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.idea/*
.nyc_output
.vscode
build
node_modules
test
src/**.js
coverage
*.log
yarn.lock
31 changes: 31 additions & 0 deletions packages/firecamp-common-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Usage



This repository contains all the necessary common configurations, such as ESLint, Prettier, etc., which can be imported into any other repository and used.



To download the dependency in the required repository, use the following command:

```
pnpm install @firecamp/common-config --save-dev
```

For ESLint configuration, add eslint-ts.js to the .eslintrc.js file in the repository using the following command:

```
module.exports={
...require("@firecamp/common-config/eslint-ts.js") ,
......
}
```

For tsconfig.json, add the tsconfig.json file in the repository with the following command:

```
{
extends:"@firecamp/common-config/tsconfig.json",
......
}
```
21 changes: 21 additions & 0 deletions packages/firecamp-common-config/eslint-ts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
env: {
browser: true,
es2021: true,
node: true,
},
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 12,
sourceType: 'module',
},
plugins: ['@typescript-eslint'],
rules: {
'semi-style': 'off',
quotes: [2, 'single'],
'no-param-reassign': 'off',
'no-underscore-dangle': 'off',
'arrow-parens': 'off',
},
};
21 changes: 21 additions & 0 deletions packages/firecamp-common-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "@firecamp/common-config",
"version": "1.0.0",
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
"eslint": "^7.32.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-prettier": "^5.0.1",
"husky": "^8.0.1",
"prettier": "^3.0.3"
},
"files": ["eslint-ts.js","tsconfig.json","prettierrc.json"],
"husky": {
"hooks": {
"pre-commit": "pnpm run lint"
}
}

}
15 changes: 15 additions & 0 deletions packages/firecamp-common-config/prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "all",
"semi": true,
"overrides": [
{
"files": "*.ts",
"options": {
"parser": "typescript"
}
}
]
}

34 changes: 34 additions & 0 deletions packages/firecamp-common-config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"compilerOptions": {
"target": "es5",
"outDir": "dist",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"declaration": true,
"declarationDir": "dist",
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "react-jsx",
"noImplicitAny": true,
"module": "es6",
"types": ["src/components/scripts/interfaces/raw-loader.d.ts", "jest"],
},
"include": [
"src",
"src/components/scripts/interfaces",
],
"exclude": [
"node_modules",
"lib"
]
}
3 changes: 2 additions & 1 deletion platform/firecamp-platform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"doc:json": "typedoc src/ --exclude **/*.spec.ts --target ES6 --mode file --json build/docs/typedoc.json",
"version": "standard-version",
"reset-hard": "git clean -dfx && git reset --hard && npm i",
"prepare-release": "run-s reset-hard test cov:check doc:html version doc:publish"
"prepare-release": "run-s reset-hard test cov:check doc:html version doc:publish",
"pre-commit":"pnpm run fix"
},
"engines": {
"node": ">=10"
Expand Down
3 changes: 2 additions & 1 deletion platform/firecamp-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"chromatic": "npx chromatic --project-token=4db217014cde004",
"build": "cross-env BABEL_ENV=production babel src -d dist && tsc && pnpm copy-files",
"copy-files": "copyfiles -u 1 \"src/**/*.sass\" \"src/**/*.scss\" \"src/**/*.css\" dist/",
"storybook:deploy": "pnpm chromatic --project-token=$(grep 'FIRECAMP_STORYBOOK_DEPLOY' ../../.env | cut -d '=' -f 2)"
"storybook:deploy": "pnpm chromatic --project-token=$(grep 'FIRECAMP_STORYBOOK_DEPLOY' ../../.env | cut -d '=' -f 2)",
"pre-commit":"pnpm run fix"
},
"bugs": {
"url": "https://github.com/firecamp-dev/firecamp/issues"
Expand Down
Loading
Loading