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

eslint-plugin-panda #2739

Merged
merged 10 commits into from
Dec 29, 2024
Merged
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
10 changes: 10 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import panda from '@pandacss/eslint-plugin'
import stylisticTs from '@stylistic/eslint-plugin'
import typescriptEslint from '@typescript-eslint/eslint-plugin'
import typescriptParser from '@typescript-eslint/parser'
Expand Down Expand Up @@ -28,6 +29,7 @@ const commonPlugins = {
'@typescript-eslint': typescriptEslint,
import: importPlugin,
'react-hooks': reactHooks,
'@pandacss': panda,
}

const commonRules = {
Expand Down Expand Up @@ -191,6 +193,14 @@ export default [
// react-refresh

'react-refresh/only-export-components': 'error',
// pandacss

...panda.configs.recommended.rules,
'@pandacss/no-config-function-in-source': 'off',
'@pandacss/prefer-longhand-properties': 'error',
'@pandacss/no-dynamic-styling': 'off',
'@pandacss/no-hardcoded-color': 'error',
'@pandacss/no-property-renaming': 'error',
},
},

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@capacitor/cli": "^6.2.0",
"@pandacss/dev": "^0.47.0",
"@pandacss/eslint-plugin": "^0.2.3",
"@sinonjs/fake-timers": "^13.0.4",
"@stylistic/eslint-plugin": "^2.11.0",
"@testing-library/dom": "^10.4.0",
Expand Down
4 changes: 4 additions & 0 deletions src/colors.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ const colors = {
pinkAgainstFg: 'rgba(233, 12, 89, 1)',
brightBlue: 'rgba(70, 223, 240, 1)', // #46dff0
exportTextareaColor: 'rgba(170, 170, 170, 1)', // #aaa, also used in anchorButton
inherit: 'inherit',
currentColor: 'currentColor',
},
light: {
// Background colors in capacitor app needs to be in hexadecimal codes
Expand Down Expand Up @@ -128,6 +130,8 @@ const colors = {
pinkAgainstFg: 'rgba(227, 179, 196, 1)',
brightBlue: 'rgba(70, 223, 240, 1)', // #46dff0
exportTextareaColor: 'rgba(85, 85, 85, 1)',
inherit: 'inherit',
currentColor: 'currentColor',
},
} as const

Expand Down
6 changes: 2 additions & 4 deletions src/components/Bullet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,7 @@ const Bullet = ({
const isHolding = state.draggedSimplePath && head(state.draggedSimplePath) === head(simplePath)
return isHolding || isDragging || isMulticursor
})
const bulletIsDivider = useSelector(state =>
isDivider(getThoughtById(state, thoughtId)?.value) ? 'none' : undefined,
)
const bulletIsDivider = useSelector(state => isDivider(getThoughtById(state, thoughtId)?.value))

/** Returns true if the thought is pending. */
const pending = useSelector(state => {
Expand Down Expand Up @@ -591,7 +589,7 @@ const Bullet = ({
marginLeft: '-3px',
},
},
display: bulletIsDivider,
display: bulletIsDivider ? 'none' : undefined,
position: 'absolute',
verticalAlign: 'top',
cursor: 'pointer',
Expand Down
4 changes: 2 additions & 2 deletions src/components/LayoutTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ const TreeNode = ({
const marginRight = isTableCol1 ? xCol2 - (width || 0) - x - (bulletWidth || 0) : 0

// Speed up the tree-node's transition (normally layoutNodeAnimationDuration) by 50% on New (Sub)Thought only.
const layoutTransition = isLastActionNewThought
const transition = isLastActionNewThought
? `left {durations.layoutNodeAnimationFast} ease-out,top {durations.layoutNodeAnimationFast} ease-out`
: `left {durations.layoutNodeAnimation} ease-out,top {durations.layoutNodeAnimation} ease-out`

Expand All @@ -468,7 +468,7 @@ const TreeNode = ({
// It should not be based on editable values such as Path, value, rank, etc, otherwise moving the thought would make it appear to be a completely new thought to React.
className={css({
position: 'absolute',
transition: layoutTransition,
transition,
})}
style={{
// Cannot use transform because it creates a new stacking context, which causes later siblings' DropChild to be covered by previous siblings'.
Expand Down
2 changes: 1 addition & 1 deletion src/components/Toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ const Toolbar: FC<ToolbarProps> = ({ customize, onSelect, selected }) => {
textAlign: 'right',
maxWidth: '100%',
userSelect: 'none',
WebkitTapHighlightColor: '{colors.bgTransparent}',
WebkitTapHighlightColor: 'bgTransparent',
whiteSpace: 'nowrap',
...(!customize && {
zIndex: 'toolbarContainer',
Expand Down
2 changes: 1 addition & 1 deletion src/components/modals/Auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ const ModalAuth = () => {
</button>
)}

{error && <span className={css({ color: 'crimson' })}>{error}</span>}
{error && <span className={css({ color: 'error' })}>{error}</span>}
</div>
</ModalComponent>
)
Expand Down
2 changes: 1 addition & 1 deletion src/components/modals/Signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ const ModalSignup = () => {
{/* Show validation or submit error. */}
{(validationError || submitError) && (
<div className={css({ display: 'flex', minHeight: '100px', flexDirection: 'column' })}>
<span className={css({ color: 'crimson', paddingBottom: '30px', fontSize: '18px' })}>
<span className={css({ color: 'error', paddingBottom: '30px', fontSize: '18px' })}>
{validationError || submitError}
</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/util/getHideCaretAnimationName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const hideCaretAnimationNames = [

const hideCaret = cva({
base: {
animationDuration: '{durations.layoutSlowShift}',
animationDuration: 'layoutSlowShift',
},
variants: {
animation: hideCaretAnimationNames.reduce(
Expand Down
Loading
Loading