Skip to content

Commit 3c71b8c

Browse files
authored
update ESLint (#636)
* update ESLint * f * f * f * c * f * f * f * f * r * u * f * f * u
1 parent 27ba1bd commit 3c71b8c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1865
-1214
lines changed

Diff for: .changeset/itchy-insects-vanish.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@status-im/eslint-config': patch
3+
'@status-im/components': patch
4+
'@status-im/js': patch
5+
'@status-im/colors': patch
6+
'connector': patch
7+
'@status-im/icons': patch
8+
---
9+
10+
update ESLint

Diff for: .eslintignore

-6
This file was deleted.

Diff for: .vscode/settings.json

+6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
{
22
"typescript.tsdk": "node_modules/typescript/lib",
33
"npm.packageManager": "pnpm",
4+
"eslint.useESLintClass": true,
45
"eslint.workingDirectories": [
6+
"./packages/colors",
7+
"./packages/icons",
8+
"./packages/components",
9+
"./packages/status-js",
10+
"./apps/connector",
511
{
612
"mode": "auto",
713
"#comment": "See https://github.com/microsoft/vscode-eslint/issues/1161 for reason (i.e. multiple .eslintrc config files)"

Diff for: apps/connector/.eslintrc.js

-39
This file was deleted.

Diff for: apps/connector/Jenkinsfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ pipeline {
6262
expression { changesDetected }
6363
}
6464
steps {
65-
dir("${env.WORKSPACE}/apps/connector") {
65+
dir("${env.WORKSPACE}") {
6666
script {
6767
nix.shell(
68-
'pnpm build:chrome',
68+
'pnpm turbo run build --filter=connector',
6969
pure: false,
7070
entryPoint: "${env.WORKSPACE}/apps/connector/shell.nix"
7171
)

Diff for: apps/connector/eslint.config.mjs

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import configs, { tailwindcssConfigs } from '@status-im/eslint-config'
2+
3+
/** @type {import('eslint').Linter.Config[]} */
4+
export default [
5+
...configs,
6+
...tailwindcssConfigs,
7+
{
8+
files: ['*.ts', '*.tsx'],
9+
rules: {
10+
'no-constant-binary-expression': 'error',
11+
'no-restricted-globals': ['error', 'process'],
12+
'jsx-a11y/alt-text': [
13+
1,
14+
{
15+
img: [],
16+
},
17+
],
18+
},
19+
},
20+
{
21+
files: ['*.mjs'],
22+
languageOptions: {
23+
parserOptions: {
24+
ecmaVersion: 'latest',
25+
sourceType: 'module',
26+
},
27+
},
28+
},
29+
{
30+
files: ['*.js'],
31+
languageOptions: {
32+
parserOptions: {
33+
ecmaVersion: 'latest',
34+
},
35+
},
36+
},
37+
]

Diff for: apps/connector/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
"dev:chrome": "plasmo dev --target=chrome-mv3",
1414
"dev:safari": "plasmo dev --target=safari-mv3",
1515
"dev:firefox": "plasmo dev --target=firefox-mv3",
16+
"build": "pnpm build:chrome",
1617
"build:chrome": "plasmo build --target=chrome-mv3",
1718
"build:firefox": "plasmo build --target=firefox-mv3 --zip",
18-
"lint": "eslint ./src",
19+
"lint": "eslint src",
1920
"format": "prettier --write .",
2021
"package": "plasmo package",
2122
"clean": "rimraf apps build .plasmo node_modules"
@@ -25,7 +26,7 @@
2526
"@plasmohq/storage": "^1.11.0",
2627
"@radix-ui/react-dropdown-menu": "^2.1.1",
2728
"@radix-ui/react-switch": "^1.1.0",
28-
"@status-im/colors": "^0.4.0",
29+
"@status-im/colors": "workspace:*",
2930
"cva": "^1.0.0-beta.1",
3031
"ethers": "^6.13.0",
3132
"plasmo": "0.88.0",
@@ -37,15 +38,14 @@
3738
"devDependencies": {
3839
"@ianvs/prettier-plugin-sort-imports": "4.1.1",
3940
"@parcel/bundler-experimental": "^2.7.0",
40-
"@status-im/eslint-config": "^0.3.0",
41+
"@status-im/eslint-config": "workspace:*",
4142
"@tailwindcss/typography": "^0.5.13",
4243
"@types/chrome": "0.0.258",
4344
"@types/node": "20.11.5",
4445
"@types/react": "18.2.48",
4546
"@types/react-dom": "18.2.18",
4647
"autoprefixer": "^10.4.19",
4748
"husky": "^8.0.3",
48-
"lint-staged": "^13.2.0",
4949
"postcss": "^8.4.38",
5050
"prettier": "3.2.4",
5151
"prettier-plugin-tailwindcss": "^0.6.1",

Diff for: apps/connector/src/components/status-tag.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ const styles = cva({
99
base: 'flex h-6 items-center gap-1 rounded-[20px] border px-2 text-13',
1010
variants: {
1111
status: {
12-
on: 'border-success-/20 bg-success-/10 text-success-60',
13-
off: 'border-danger-/20 bg-danger-/10 text-danger-60',
12+
on: 'border-success-50/20 bg-success-50/10 text-success-60',
13+
off: 'border-danger-50/20 bg-danger-50/10 text-danger-60',
1414
},
1515
},
1616
})

Diff for: apps/connector/src/contents/provider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export class Provider {
127127
return
128128
}
129129
}
130-
} catch (error) {
130+
} catch {
131131
// we don't reject here because incoming message is not from the proxy
132132
return
133133
}

Diff for: eslint.config.mjs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/** @type {import('eslint').Linter.Config[]} */
2+
export default [
3+
{
4+
ignores: [
5+
'**/dist',
6+
'**/node_modules',
7+
'**/protos',
8+
'**/proto',
9+
'**/coverage',
10+
'**/storybook-static',
11+
],
12+
},
13+
]

Diff for: package.json

+6-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"packages/status-js",
88
"packages/colors",
99
"packages/icons",
10-
"packages/components"
10+
"packages/components",
11+
"apps/connector"
1112
]
1213
},
1314
"keywords": [],
@@ -16,8 +17,8 @@
1617
"prepare": "husky install",
1718
"test": "turbo run test --filter=@status-im/* -- --run",
1819
"dev": "turbo run dev --filter=@status-im/* --parallel",
19-
"build": "turbo run build --filter=@status-im/* && node --version",
20-
"lint": "turbo run lint --filter=@status-im/* --filter=web",
20+
"build": "turbo run build --filter=@status-im/* --filter=connector",
21+
"lint": "turbo run lint --filter=@status-im/* --filter=connector",
2122
"typecheck": "turbo run typecheck",
2223
"format": "prettier --write .",
2324
"clean": "turbo run clean && rimraf node_modules",
@@ -32,8 +33,9 @@
3233
"@status-im/eslint-config": "workspace:*",
3334
"@tsconfig/strictest": "^2.0.0",
3435
"@types/prettier": "^2.7.2",
36+
"eslint": "^9.14.0",
3537
"husky": "^8.0.3",
36-
"lint-staged": "^13.2.0",
38+
"lint-staged": "^15.2.10",
3739
"prettier": "^3.3.3",
3840
"prettier-plugin-tailwindcss": "^0.6.6",
3941
"@types/react": "^18.0.33",

Diff for: packages/colors/.eslintrc

-4
This file was deleted.

Diff for: packages/colors/eslint.config.mjs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import configs from '@status-im/eslint-config'
2+
3+
/** @type {import('eslint').Linter.Config[]} */
4+
export default [...configs]

Diff for: packages/components/.eslintrc

-7
This file was deleted.

Diff for: packages/components/eslint.config.mjs

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import configs, { tailwindcssConfigs } from '@status-im/eslint-config'
2+
3+
/** @type {import('eslint').Linter.Config[]} */
4+
export default [...configs, ...tailwindcssConfigs]

Diff for: packages/components/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"preinstall": "npx only-allow pnpm",
3232
"dev": "vite build --watch --mode development",
3333
"build": "vite build",
34-
"postbuild": "pnpm build:types && node --version",
34+
"postbuild": "pnpm build:types",
3535
"build:types": "tsc --noEmit false --emitDeclarationOnly",
3636
"typecheck": "tsc",
3737
"lint": "eslint src",

Diff for: packages/components/src/avatar/avatar.stories.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const sizesAvatar = {
1414
}
1515

1616
const renderVariant = (variant: AvatarProps['type']) => {
17+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1718
const content = (props: any) => {
1819
const sizes = sizesAvatar[variant]
1920

@@ -47,7 +48,7 @@ const meta = {
4748
},
4849

4950
render: props => (
50-
<div className="grid gap-4 theme-yellow">
51+
<div className="grid gap-4">
5152
<h1 className="text-19">User Avatar</h1>
5253
{renderVariant('user')({
5354
...props,

Diff for: packages/components/src/icon-button/icon-button.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { Meta, StoryObj } from '@storybook/react'
77

88
const sizes = ['40', '32', '24'] as const
99

10-
// eslint-disable-next-line react/display-name
10+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1111
const renderVariant = (variant: string) => (props: any) => (
1212
<div className="flex items-center gap-4">
1313
{sizes.map(size => (

Diff for: packages/components/src/shortcut/shortcut.stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { Meta, StoryObj } from '@storybook/react'
66

77
const variants = ['primary', 'secondary', 'gray'] as const
88

9-
// eslint-disable-next-line react/display-name
9+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1010
const renderVariant = (variant: (typeof variants)[number]) => (props: any) => (
1111
<div className="flex items-center gap-2">
1212
<Shortcut {...props} variant={variant} icon={<CommandIcon />} />

Diff for: packages/components/src/skeleton/skeleton.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { cva, cx, type VariantProps } from 'cva'
22

3+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
34
const styles = cva({
45
base: 'animate-skeleton overflow-hidden',
56

Diff for: packages/components/src/tag/tag.tsx

+1-7
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,7 @@ function Tag(
2727
props: Props & (ButtonProps | DivProps),
2828
ref: Ref<HTMLButtonElement | HTMLDivElement>,
2929
) {
30-
const {
31-
size = '32',
32-
icon,
33-
iconPlacement = 'left',
34-
label,
35-
...rest
36-
} = props
30+
const { size = '32', icon, iconPlacement = 'left', label, ...rest } = props
3731

3832
const iconOnly = Boolean(icon && !label)
3933

Diff for: packages/components/src/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export type CustomisationColorType = keyof typeof customisation
88

99
export type Prettify<T> = {
1010
[K in keyof T]: T[K]
11-
} & {} // eslint-disable-line @typescript-eslint/ban-types
11+
} & {}

Diff for: packages/eslint-config/eslint.config.mjs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import js from '@eslint/js'
2+
3+
/** @type {import('eslint').Linter.Config[]} */
4+
export default [
5+
{
6+
...js.configs.recommended,
7+
files: ['**/*.js', '**/*.mjs', '**/*.cjs'],
8+
},
9+
]

0 commit comments

Comments
 (0)