Skip to content

Commit

Permalink
feat: init lint-staged
Browse files Browse the repository at this point in the history
  • Loading branch information
BQXBQX committed Mar 23, 2024
1 parent c1886b1 commit 05776b2
Show file tree
Hide file tree
Showing 17 changed files with 2,472 additions and 571 deletions.
18 changes: 18 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export default {
"packages/ui-universal/**/*.{js,cjs,ts,json,css,scss,tsx,sass}": () => [
"pnpm --filter @sast/ui-universal lint",
"pnpm --filter @sast/ui-universal build",
"git add ."
],
"docs/**/*.{js,cjs,ts,html,json,css,scss,tsx,sass,md,mdx}": () => [
"pnpm --filter @sast/ui-docs build",
"git add ."
],
"packages/ui-react/**/*.{js,cjs,ts,html,json,css,scss,tsx,sass}": () => [
"pnpm --filter @sast/ui-react test",
"pnpm --filter @sast/ui-react format",
"pnpm --filter @sast/ui-react lint",
"git add ."
],
// "*.*": () => "pnpm cz"
}
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"ui-uni:dev": "pnpm --filter @sast/ui-universal dev",
"ui-uni:build": "pnpm --filter @sast/ui-universal build",
Expand All @@ -11,7 +12,7 @@
"ui-react:build": "pnpm --filter @sast/ui-react build:lib",
"ui-react:build-story": "pnpm --filter @sast/ui-react build",
"docs:dev": "pnpm --filter @sast/ui-docs dev",
"commit": "cz",
"commit": "git add . && pnpm lint-staged -p false && pnpm cz",
"prepare": "husky"
},
"keywords": [],
Expand All @@ -21,10 +22,15 @@
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"engines": {
"node": ">=18",
"pnpm": ">=8"
},
"devDependencies": {
"commitizen": "^4.3.0",
"cz-conventional-changelog": "^3.3.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"sass": "^1.69.5",
"typescript": "^5.3.3"
},
Expand Down
6 changes: 2 additions & 4 deletions packages/ui-react/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@
"plugin:storybook/recommended",
"prettier" // disable all rules conflict with Prettier
],
"plugins": ["jest-dom", "@stylexjs"],
"plugins": ["jest-dom"],
"parser": "@typescript-eslint/parser",
"ignorePatterns": ["dist"],
"rules": {
"@stylexjs/valid-styles": ["error"]
},
"rules": {},
"settings": {
"react": {
"version": "detect"
Expand Down
1 change: 0 additions & 1 deletion packages/ui-react/coverage/.tmp/coverage-0.json

This file was deleted.

229 changes: 149 additions & 80 deletions packages/ui-react/coverage/Button.tsx.html
Original file line number Diff line number Diff line change
@@ -1,68 +1,77 @@

<!doctype html>
<html lang="en">

<head>
<head>
<title>Code coverage report for Button.tsx</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="prettify.css" />
<link rel="stylesheet" href="base.css" />
<link rel="shortcut icon" type="image/x-icon" href="favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(sort-arrow-sprite.png);
}
<link
rel="stylesheet"
href="prettify.css"
/>
<link
rel="stylesheet"
href="base.css"
/>
<link
rel="shortcut icon"
type="image/x-icon"
href="favicon.png"
/>
<meta
name="viewport"
content="width=device-width, initial-scale=1"
/>
<style type="text/css">
.coverage-summary .sorter {
background-image: url(sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
</head>

<body>
<div class="wrapper">
<div class="pad1">
<h1><a href="index.html">All files</a> Button.tsx</h1>
<div class='clearfix'>

<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class='fraction'>46/46</span>
</div>


<div class='fl pad1y space-right2'>
<span class="strong">33.33% </span>
<span class="quiet">Branches</span>
<span class='fraction'>1/3</span>
</div>


<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/0</span>
</div>


<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class='fraction'>46/46</span>
</div>


<div class="clearfix">
<div class="fl pad1y space-right2">
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class="fraction">64/64</span>
</div>

<div class="fl pad1y space-right2">
<span class="strong">33.33% </span>
<span class="quiet">Branches</span>
<span class="fraction">1/3</span>
</div>

<div class="fl pad1y space-right2">
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class="fraction">0/0</span>
</div>

<div class="fl pad1y space-right2">
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class="fraction">64/64</span>
</div>
</div>
<p class="quiet">
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>,
<em>p</em> or <em>k</em> for the previous block.
</p>
<template id="filterTemplate">
<div class="quiet">
Filter:
<input oninput="onInput()" type="search" id="fileSearch">
</div>
<div class="quiet">
Filter:
<input
type="search"
id="fileSearch"
/>
</div>
</template>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
</div>
<div class="status-line high"></div>
<pre><table class="coverage">
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
<a name='L2'></a><a href='#L2'>2</a>
<a name='L3'></a><a href='#L3'>3</a>
Expand Down Expand Up @@ -109,7 +118,27 @@ <h1><a href="index.html">All files</a> Button.tsx</h1>
<a name='L44'></a><a href='#L44'>44</a>
<a name='L45'></a><a href='#L45'>45</a>
<a name='L46'></a><a href='#L46'>46</a>
<a name='L47'></a><a href='#L47'>47</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
<a name='L47'></a><a href='#L47'>47</a>
<a name='L48'></a><a href='#L48'>48</a>
<a name='L49'></a><a href='#L49'>49</a>
<a name='L50'></a><a href='#L50'>50</a>
<a name='L51'></a><a href='#L51'>51</a>
<a name='L52'></a><a href='#L52'>52</a>
<a name='L53'></a><a href='#L53'>53</a>
<a name='L54'></a><a href='#L54'>54</a>
<a name='L55'></a><a href='#L55'>55</a>
<a name='L56'></a><a href='#L56'>56</a>
<a name='L57'></a><a href='#L57'>57</a>
<a name='L58'></a><a href='#L58'>58</a>
<a name='L59'></a><a href='#L59'>59</a>
<a name='L60'></a><a href='#L60'>60</a>
<a name='L61'></a><a href='#L61'>61</a>
<a name='L62'></a><a href='#L62'>62</a>
<a name='L63'></a><a href='#L63'>63</a>
<a name='L64'></a><a href='#L64'>64</a>
<a name='L65'></a><a href='#L65'>65</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
Expand All @@ -136,6 +165,22 @@ <h1><a href="index.html">All files</a> Button.tsx</h1>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
Expand Down Expand Up @@ -163,36 +208,54 @@ <h1><a href="index.html">All files</a> Button.tsx</h1>
/**
* The color of the button.
*/
color?: 'primary' | 'secondary' | 'tertiary' | 'danger';
&nbsp;
color?: 'primary' | 'secondary' | 'ghost' | 'danger' | 'border';
/**
* The size of the button.
*/
size?: 'small' | 'medium' | 'large';
&nbsp;
/**
* The shadow of the button.
*/
shadow?: 'regular' | 'small' | 'medium' | 'large' | 'extraLarge' | 'inner' | 'none';
/**
* If `true`, the button will be disabled.
*/
disabled?: boolean;
/**
* If `true`, the shadow will be appear
* className of the button
*/
isShadow?: boolean;
className?: string;
/**
* disabledShadow, when the button is disabled ,the shadow is or not
*/
disabledShadow?: boolean;
}
&nbsp;
export const Button = React.forwardRef&lt;HTMLButtonElement, ButtonProps&gt;(
({ color = 'primary', size = 'medium', disabled = false, isShadow = false, ...rest }, ref) =&gt; {
(
{
color = 'primary',
shadow = 'none',
size = 'medium',
disabled = false,
className,
disabledShadow = true,
...rest
},
ref,
) =&gt; {
const btnClass = classnames(
styles['base'],
styles[color],
styles[size],
styles[<span class="branch-0 cbranch-no" title="branch not covered" >disabled ? 'disabled' : '</span>'],
styles[<span class="branch-0 cbranch-no" title="branch not covered" >isShadow ? 'shadow' : '</span>'],
styles[disabledShadow &amp;&amp; <span class="branch-0 cbranch-no" title="branch not covered" >disabled ? 'disabledShadow' : '</span>'],
styles[`shadow-${shadow}`],
);
return (
&lt;button
ref={ref}
className={btnClass}
className={`${btnClass} ${className}`}
{...rest}
disabled={disabled}
/&gt;
Expand All @@ -203,21 +266,27 @@ <h1><a href="index.html">All files</a> Button.tsx</h1>
Button.displayName = 'Button';
&nbsp;</pre></td></tr></table></pre>

<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-01-20T11:47:03.031Z
</div>
<script src="prettify.js"></script>
<script>
window.onload = function () {
prettyPrint();
};
</script>
<script src="sorter.js"></script>
<script src="block-navigation.js"></script>
</body>
<div class="push"></div>
<!-- for sticky footer -->
</div>
<!-- /wrapper -->
<div class="footer quiet pad2 space-top1 center small">
Code coverage generated by
<a
href="https://istanbul.js.org/"
target="_blank"
rel="noopener noreferrer"
>istanbul</a
>
at 2024-03-23T03:32:42.090Z
</div>
<script src="prettify.js"></script>
<script>
window.onload = function () {
prettyPrint();
};
</script>
<script src="sorter.js"></script>
<script src="block-navigation.js"></script>
</body>
</html>

Loading

0 comments on commit 05776b2

Please sign in to comment.