Skip to content

Commit

Permalink
chore: add eslint-plugin-no-attribute-string-literals (#5086)
Browse files Browse the repository at this point in the history
* chore: add eslint-plugin-no-attribute-string-literals

* chore: update workshop eslint configs for i18n

adds "no-attribute-string-literals/no-attribute-string-literals": "off"
  • Loading branch information
ricokahler authored and bjoerge committed Nov 6, 2023
1 parent 3122346 commit e35838d
Show file tree
Hide file tree
Showing 31 changed files with 354 additions and 234 deletions.
388 changes: 238 additions & 150 deletions .eslintrc.cjs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
"eslint-plugin-boundaries": "^3.4.0",
"eslint-plugin-i18next": "^6.0.3",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-no-attribute-string-literals": "^1.0.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"i18next/no-literal-string": "off"
}
"rules": {
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"i18next/no-literal-string": "off"
}
"rules": {
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"i18next/no-literal-string": "off"
}
"rules": {
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"i18next/no-literal-string": "off"
}
"rules": {
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"i18next/no-literal-string": "off"
}
"rules": {
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"i18next/no-literal-string": "off"
}
"rules": {
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"i18next/no-literal-string": "off"
}
"rules": {
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"i18next/no-literal-string": "off"
}
"rules": {
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"i18next/no-literal-string": "off"
}
"rules": {
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"i18next/no-literal-string": "off"
}
"rules": {
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
7 changes: 4 additions & 3 deletions packages/sanity/src/core/field/__workshop__/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"i18next/no-literal-string": "off"
}
"rules": {
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
7 changes: 4 additions & 3 deletions packages/sanity/src/core/form/__workshop__/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"i18next/no-literal-string": "off"
}
"rules": {
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"i18next/no-literal-string": "off"
}
"rules": {
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"i18next/no-literal-string": "off"
}
"rules": {
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"i18next/no-literal-string": "off"
}
"rules": {
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
7 changes: 4 additions & 3 deletions packages/sanity/src/core/form/inputs/__workshop__/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"i18next/no-literal-string": "off"
}
"rules": {
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"i18next/no-literal-string": "off"
}
"rules": {
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
7 changes: 4 additions & 3 deletions packages/sanity/src/core/preview/__workshop__/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"i18next/no-literal-string": "off"
}
"rules": {
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
7 changes: 4 additions & 3 deletions packages/sanity/src/core/schema/__workshop__/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"i18next/no-literal-string": "off"
}
"rules": {
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
7 changes: 4 additions & 3 deletions packages/sanity/src/core/store/_legacy/__workshop__/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"i18next/no-literal-string": "off"
}
"rules": {
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react'
import styled, {css} from 'styled-components'
import type {AuthProvider} from '../../../config'

const GithubRoot = styled.svg(({theme}: {theme: Theme}) => {
const GithubRootSvg = styled.svg(({theme}: {theme: Theme}) => {
const {fg} = theme.sanity.color.base

return css`
Expand All @@ -18,15 +18,15 @@ const CustomImage = styled.img`
`

const GithubLogo = () => (
<GithubRoot
<GithubRootSvg
// data-sanity-icon="google-logo"
width="1em"
height="1em"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 438.55 438.55"
>
<path d="M409.13 114.57a218.32 218.32 0 0 0-79.8-79.8Q278.94 5.36 219.27 5.36T109.21 34.77a218.29 218.29 0 0 0-79.8 79.8Q0 165 0 224.63q0 71.67 41.83 128.91t108.06 79.23q7.71 1.43 11.42-2a11.17 11.17 0 0 0 3.69-8.57q0-.86-.14-15.42t-.14-25.41l-6.57 1.14a83.77 83.77 0 0 1-15.85 1 120.73 120.73 0 0 1-19.84-2 44.34 44.34 0 0 1-19.11-8.51 36.23 36.23 0 0 1-12.56-17.6l-2.86-6.57a71.34 71.34 0 0 0-9-14.56q-6.14-8-12.42-10.85l-2-1.43a21 21 0 0 1-3.71-3.43 15.66 15.66 0 0 1-2.57-4q-.86-2 1.43-3.29C61.2 310.42 64 310 68 310l5.71.85q5.71 1.14 14.13 6.85a46.08 46.08 0 0 1 13.85 14.84q6.57 11.71 15.85 17.85t18.7 6.14a81.19 81.19 0 0 0 16.27-1.42 56.78 56.78 0 0 0 12.85-4.29q2.57-19.14 14-29.41a195.49 195.49 0 0 1-29.36-5.13 116.52 116.52 0 0 1-26.83-11.14 76.86 76.86 0 0 1-23-19.13q-9.14-11.42-15-30t-5.8-42.81q0-34.55 22.56-58.82-10.57-26 2-58.24 8.28-2.57 24.55 3.85t23.84 11q7.57 4.56 12.13 7.71a206.2 206.2 0 0 1 109.64 0l10.85-6.85a153.65 153.65 0 0 1 26.26-12.56q15.13-5.71 23.13-3.14 12.84 32.26 2.28 58.24 22.55 24.27 22.56 58.82 0 24.27-5.85 43t-15.12 30a79.82 79.82 0 0 1-23.13 19 116.74 116.74 0 0 1-26.84 11.14 195.29 195.29 0 0 1-29.23 5.07q14.8 12.84 14.81 40.58v60.2a11.37 11.37 0 0 0 3.57 8.56q3.57 3.42 11.28 2 66.24-22 108.07-79.23t41.83-128.91q-.03-59.62-29.43-110.05z" />
</GithubRoot>
</GithubRootSvg>
)

const GoogleLogo = () => (
Expand Down
10 changes: 5 additions & 5 deletions packages/sanity/src/core/studio/components/navbar/NavDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const Root = styled(Layer)`
height: 100%;
`

const Backdrop = styled(motion(Card))`
const BackdropMotion = styled(motion(Card))`
position: absolute;
top: 0;
left: 0;
Expand All @@ -54,7 +54,7 @@ const Backdrop = styled(motion(Card))`
background: var(--card-shadow-penumbra-color);
`

const InnerCard = styled(motion(Card))`
const InnerCardMotion = styled(motion(Card))`
position: relative;
pointer-events: all;
flex-direction: column;
Expand Down Expand Up @@ -131,7 +131,7 @@ export const NavDrawer = memo(function NavDrawer(props: NavDrawerProps) {
{isOpen && (
<TrapFocus autoFocus returnFocus>
<Root onKeyDown={handleKeyDown}>
<Backdrop
<BackdropMotion
animate="open"
data-open={isOpen}
exit="closed"
Expand All @@ -140,7 +140,7 @@ export const NavDrawer = memo(function NavDrawer(props: NavDrawerProps) {
transition={ANIMATION_TRANSITION}
variants={BACKDROP_VARIANTS}
/>
<InnerCard
<InnerCardMotion
animate="open"
data-open={isOpen}
display="flex"
Expand Down Expand Up @@ -244,7 +244,7 @@ export const NavDrawer = memo(function NavDrawer(props: NavDrawerProps) {
</Stack>
</Card>
)}
</InnerCard>
</InnerCardMotion>
</Root>
</TrapFocus>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"i18next/no-literal-string": "off"
}
"rules": {
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"i18next/no-literal-string": "off"
}
"rules": {
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
7 changes: 4 additions & 3 deletions packages/sanity/src/desk/__workshop__/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"i18next/no-literal-string": "off"
}
"rules": {
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"rules": {
"no-nested-ternary": "off",
"i18next/no-literal-string": "off"
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"i18next/no-literal-string": "off"
}
"rules": {
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"rules": {
"i18next/no-literal-string": "off"
}
"rules": {
"i18next/no-literal-string": "off",
"no-attribute-string-literals/no-attribute-string-literals": "off"
}
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7466,6 +7466,11 @@ eslint-plugin-jsx-a11y@^6.7.1:
object.fromentries "^2.0.6"
semver "^6.3.0"

eslint-plugin-no-attribute-string-literals@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-no-attribute-string-literals/-/eslint-plugin-no-attribute-string-literals-1.0.0.tgz#8b09178922fa20047d1b23166f4e3839acc649f1"
integrity sha512-agpa3mK8H3e/nvlGzgIPc8kz6/lQIK9M1CiEQO5H3Rj3ujyhl39016oGz1wJjB4EKf2KoKowcfbUoWWh0G70Cw==

eslint-plugin-prettier@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.0.tgz#6887780ed95f7708340ec79acfdf60c35b9be57a"
Expand Down

0 comments on commit e35838d

Please sign in to comment.