Skip to content

Commit

Permalink
chore(commitlint): configure commitlint.
Browse files Browse the repository at this point in the history
  • Loading branch information
cicerohen committed Apr 28, 2022
1 parent 2cbfaba commit e6b786d
Show file tree
Hide file tree
Showing 24 changed files with 730 additions and 54 deletions.
6 changes: 6 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

echo 'commit-msg'

npx --no-install commitlint --edit "$1"
6 changes: 6 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

echo "${PWD}"

npx --no-install lint-staged --allow-empty
2 changes: 2 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
9 changes: 9 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
extends: ["@commitlint/config-conventional"],
rules: {
"scope-case": [2, "always", "lower-case"],
"subject-case": [2, "always", "lower-case"],
"subject-full-stop": [2, "always", "."],
"subject-max-length": [2, "always", 70],
},
};
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"lerna:add": "lerna add"
},
"devDependencies": {
"lerna": "^4.0.0"
"@commitlint/cli": "^16.2.4",
"@commitlint/config-conventional": "^16.2.4",
"lerna": "^4.0.0",
"lint-staged": "^12.4.1"
}
}
6 changes: 4 additions & 2 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
"url": "git+https://github.com/cicerohen/boilerplate-mfe.git"
},
"dependencies": {
"@babel/eslint-parser": "^7.16.3",
"eslint": "^7.32.0",
"eslint-plugin-react": "^7.28.0"
"eslint-plugin-react": "^7.28.0",
"@typescript-eslint/eslint-plugin": "^5.21.0",
"@typescript-eslint/parser": "^5.21.0",
"eslint-plugin-react-hooks": "^4.5.0"
}
}
15 changes: 11 additions & 4 deletions packages/eslint-config/src/eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
{
"extends": ["eslint:recommended", "plugin:react/recommended"],
"ignorePatterns": ["/dist/**/*"],
"parser": "@babel/eslint-parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended"
],
"ignorePatterns": ["/dist/**/*", "*webpack.config.*"],
"parser": "@typescript-eslint/parser",
"settings": {
"react": {
"version": "detect"
Expand All @@ -17,6 +23,7 @@
},
"rules": {
"react/react-in-jsx-scope": "off",
"react/prop-types": "off"
"react/prop-types": "off",
"@typescript-eslint/no-empty-function": "warn"
}
}
1 change: 1 addition & 0 deletions packages/mfe-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@mfe/eslint-config": "^1.0.0",
"@mfe/prettier-config": "^1.0.0",
"@mfe/webpack-config-react": "^1.0.0",
"@types/react": "^18.0.8",
"kill-port": "^1.6.1",
"typescript": "^4.5.4"
},
Expand Down
1 change: 1 addition & 0 deletions packages/mfe-dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@mfe/eslint-config": "^1.0.0",
"@mfe/prettier-config": "^1.0.0",
"@mfe/webpack-config-react": "^1.0.0",
"@types/react": "^18.0.8",
"kill-port": "^1.6.1",
"typescript": "^4.5.4"
},
Expand Down
6 changes: 5 additions & 1 deletion packages/mfe-editor/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"extends": ["@mfe/eslint-config"]
"extends": ["@mfe/eslint-config"],
"rules": {
"@typescript-eslint/no-this-alias": "off",
"prefer-rest-params": "off"
}
}
1 change: 1 addition & 0 deletions packages/mfe-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@mfe/eslint-config": "^1.0.0",
"@mfe/prettier-config": "^1.0.0",
"@mfe/webpack-config-react": "^1.0.0",
"@types/react": "^18.0.8",
"kill-port": "^1.6.1",
"typescript": "^4.5.4"
},
Expand Down
4 changes: 3 additions & 1 deletion packages/mfe-editor/src/components/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ export const Editor = () => {

const [value] = useState(initialValue);

const onChange = () => {};
const onChange = () => {
console.log("onChange editor");
};

return (
<Slate editor={editor} value={value} onChange={onChange}>
Expand Down
2 changes: 0 additions & 2 deletions packages/mfe-editor/src/components/RenderElement.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from "react";

export const RenderElement = ({ element, attributes, children }) => {
if (element.type === "numbered-list") {
return <ol {...attributes}>{children}</ol>;
Expand Down
4 changes: 2 additions & 2 deletions packages/mfe-editor/src/utils/debounce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ export const debounce = (func, wait = 50, immediate) => {
return function () {
const context = this;
const args = arguments;
let later = function () {
const later = function () {
timeout = null;
if (!immediate) {
func.apply(context, args);
}
};
let callNow = immediate && !timeout;
const callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) {
Expand Down
1 change: 1 addition & 0 deletions packages/mfe-footer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@mfe/eslint-config": "^1.0.0",
"@mfe/prettier-config": "^1.0.0",
"@mfe/webpack-config-react": "^1.0.0",
"@types/react": "^18.0.8",
"kill-port": "^1.6.1",
"typescript": "^4.5.4"
},
Expand Down
1 change: 1 addition & 0 deletions packages/mfe-header/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@mfe/eslint-config": "^1.0.0",
"@mfe/prettier-config": "^1.0.0",
"@mfe/webpack-config-react": "^1.0.0",
"@types/react": "^18.0.8",
"kill-port": "^1.6.1",
"typescript": "^4.5.4"
},
Expand Down
7 changes: 1 addition & 6 deletions packages/mfe-header/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useState } from "react";
import { useState } from "react";

import { Header } from "./components/Header";

Expand All @@ -7,10 +7,5 @@ export const App = () => {
JSON.parse(localStorage.getItem("typer:user")) || null
);

useEffect(() => {
const onSignIn = () => {};
window.addEventListener("auth:onSignIn", onSignIn);
}, []);

return <Header user={user} />;
};
6 changes: 6 additions & 0 deletions packages/mfe-home/.lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"*.{ts,tsx}": [
"eslint --fix",
"prettier --write"
]
}
5 changes: 3 additions & 2 deletions packages/mfe-home/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@
"@mfe/eslint-config": "^1.0.0",
"@mfe/prettier-config": "^1.0.0",
"@mfe/webpack-config-react": "^1.0.0",
"@types/react": "^18.0.8",
"kill-port": "^1.6.1",
"typescript": "^4.5.4"
},
"dependencies": {
"single-spa-react": "^4.4.0",
"react": "^17.0.1",
"react-dom": "^17.0.1"
"react-dom": "^17.0.1",
"single-spa-react": "^4.4.0"
}
}
2 changes: 1 addition & 1 deletion packages/mfe-home/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const App = () => {
<h2 className="text-lg text-white">It is easy and free</h2>
<a
href="#"
className="border text-white text-xs uppercase px-6 py-4 text-sm rounded-lg inline-block mt-10"
className="border text-white text-xs uppercase px-6 py-4 rounded-lg inline-block mt-10"
>
Start Writing
</a>
Expand Down
1 change: 1 addition & 0 deletions packages/mfe-root-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@mfe/webpack-config": "^1.0.0",
"copy-webpack-plugin": "^9.0.1",
"html-webpack-plugin": "^5.3.2",
"@types/react": "^18.0.8",
"kill-port": "^1.6.1",
"typescript": "^4.5.4"
}
Expand Down
1 change: 1 addition & 0 deletions packages/mfe-sidebar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@mfe/eslint-config": "^1.0.0",
"@mfe/prettier-config": "^1.0.0",
"@mfe/webpack-config-react": "^1.0.0",
"@types/react": "^18.0.8",
"kill-port": "^1.6.1",
"typescript": "^4.5.4"
},
Expand Down
1 change: 1 addition & 0 deletions packages/mfe-styleguide/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@mfe/eslint-config": "^1.0.0",
"@mfe/prettier-config": "^1.0.0",
"@mfe/webpack-config-react": "^1.0.0",
"@types/react": "^18.0.8",
"kill-port": "^1.6.1",
"typescript": "^4.5.4"
},
Expand Down
Loading

0 comments on commit e6b786d

Please sign in to comment.