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

Update eslint from v8.46.0 to v9.17.0 #172

Merged
merged 29 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
879ad12
chore: Update eslint from v8.46.0 to v9.17.0
MykhailoPV Jan 9, 2025
1d811f3
chore(yarn.lock): updade yarn
MykhailoPV Jan 9, 2025
80286af
chore(package-lock.json): Delete file
MykhailoPV Jan 9, 2025
6faca3c
chore: eslint.config.js -> eslint.config.mjs
donskov Jan 9, 2025
0e47851
chore(eslint.config.mjs): Add ignores object
MykhailoPV Jan 9, 2025
0c2ec39
chore(eslint.config.mjs): Add public to ignores
MykhailoPV Jan 10, 2025
9cf38f6
fix(eslint): Use an `interface` instead of a `type` error
MykhailoPV Jan 10, 2025
d0e7783
fix(eslint): Array type using ReadonlyArray<T> is forbidden error
MykhailoPV Jan 10, 2025
ab763ae
fix(eslint): Component definition is missing display name error
MykhailoPV Jan 10, 2025
f98384b
fix(eslint): error is defined but never used
MykhailoPV Jan 10, 2025
611d3c1
fix(eslint): Type ... trivially inferred from a ... literal, remove t…
MykhailoPV Jan 10, 2025
db5b0ce
chore(yarn.lock): updade yarn
donskov Jan 11, 2025
4663e7b
feat(eslint): add stylistic rules
donskov Jan 13, 2025
068fc78
fix(eslint): autofix
donskov Jan 13, 2025
90ca93e
chore(eslint): disable "@typescript-eslint/no-explicit-any" rule
donskov Jan 13, 2025
d6347e0
chore(eslint): fix errors
donskov Jan 13, 2025
e389fd2
fix(eslint): Use "@ts-expect-error" instead of "@ts-ignore"
MykhailoPV Jan 13, 2025
91afb20
Merge branch 'mykhailoPV/update-eslint' of https://github.com/Peculia…
MykhailoPV Jan 13, 2025
a6e19e7
chore(eslint): fix errors
donskov Jan 13, 2025
619d85d
chore(eslint): fix errors
donskov Jan 13, 2025
5cf5a96
chore(eslint): fix errors
donskov Jan 13, 2025
deb4e75
chore(eslint): fix errors
donskov Jan 13, 2025
8a10a55
chore(eslint): fix errors
donskov Jan 13, 2025
9867099
chore(eslint): fix errors
donskov Jan 13, 2025
dd0c475
fear(eslint):add "eslint-plugin-import"
donskov Jan 14, 2025
0f9cde5
deps: bump
donskov Jan 14, 2025
919b676
chore(eslint.config.mjs): Install @peculiar-config-react/base
MykhailoPV Jan 15, 2025
f3a8954
chore(package.json): Delete useless eslint dependecies
MykhailoPV Jan 15, 2025
4ef29fe
deps: bump
donskov Jan 15, 2025
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
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

32 changes: 0 additions & 32 deletions .eslintrc.js

This file was deleted.

20 changes: 20 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// eslint-disable-next-line import/no-unresolved
import tseslint from 'typescript-eslint';
import baseConfig from '@peculiar/eslint-config-base';
import reactConfig from '@peculiar/eslint-config-react';

export default tseslint.config([
...baseConfig,
...reactConfig,
{
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
{
ignores: [
'**/dist/*',
'**/public/*',
],
},
]);
13 changes: 3 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,19 @@
"build": "yarn workspaces run build",
"test:unit:coverage": "yarn workspaces run test:unit:coverage",
"check:types": "yarn workspaces run check:types",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"lint": "yarn eslint",
"prepare": "yarn build",
"publish:version": "lerna publish",
"publish:canary": "lerna publish --canary"
},
"devDependencies": {
"@emotion/jest": "^11.13.0",
"@peculiar/eslint-config-base": "^0.0.2",
"@peculiar/eslint-config-react": "^0.0.2",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3 ",
"@types/jest": "^29.5.0",
"@typescript-eslint/eslint-plugin": "5.38.1",
"@typescript-eslint/parser": "5.38.1",
"eslint": "8.46.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-airbnb-typescript": "17.0.0",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-jsx-a11y": "6.6.1",
"eslint-plugin-react": "7.31.8",
"eslint-plugin-react-hooks": "4.6.0",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.7.0",
"jest-watch-typeahead": "^2.2.2",
Expand Down
9 changes: 5 additions & 4 deletions packages/color/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// eslint-disable-next-line no-undef
module.exports = {
preset: "ts-jest",
testEnvironment: "jsdom",
preset: 'ts-jest',
testEnvironment: 'jsdom',
watchPlugins: [
"jest-watch-typeahead/filename",
"jest-watch-typeahead/testname",
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
],
};
1 change: 0 additions & 1 deletion packages/color/src/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export class Color {
palette(): Record<PaletteTypes, Color> {
const [h, s, b] = this.toHsb();
const steps = 5;

let saturationTintStep = (s - this.saturationMinMax[0]) / steps;
let saturationShadeStep = (s - this.saturationMinMax[1]) / steps;
let brightnessTintStep = (this.brightnessMinMax[1] - b) / steps;
Expand Down
1 change: 0 additions & 1 deletion packages/color/src/get_luminance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export function getLuminance(color: string | [r: number, g: number, b: number])
let rgb: number[] = typeof color === 'string' ? hexToRgb(color) : color;

rgb = rgb.map((val) => {
// eslint-disable-next-line no-param-reassign
val /= 255; // normalized

return val <= 0.03928 ? val / 12.92 : ((val + 0.055) / 1.055) ** 2.4;
Expand Down
6 changes: 6 additions & 0 deletions packages/color/src/hsb_to_rgb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,47 @@ export function hsbToRgb(h: number, s: number, b: number): [r: number, g: number
red = brightness;
green = t;
blue = p;

break;
}

case 1: {
red = q;
green = brightness;
blue = p;

break;
}

case 2: {
red = p;
green = brightness;
blue = t;

break;
}

case 3: {
red = p;
green = q;
blue = brightness;

break;
}

case 4: {
red = t;
green = p;
blue = brightness;

break;
}

case 5: {
red = brightness;
green = p;
blue = q;

break;
}

Expand Down
7 changes: 6 additions & 1 deletion packages/color/src/rgb_to_hsb.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-param-reassign */
const RGB_MAX = 255;
const HUE_MAX = 360;
const SV_MAX = 100;
Expand Down Expand Up @@ -27,13 +26,19 @@ export function rgbToHsb(r: number, g: number, b: number): [h: number, s: number
switch (max) {
case r:
h = (g - b) / d + (g < b ? 6 : 0);

break;

case g:
h = (b - r) / d + 2;

break;

case b:
h = (r - g) / d + 4;

break;

default:
break;
}
Expand Down
8 changes: 5 additions & 3 deletions packages/react-components/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import { themeLight, themeDark } from './themes';
import './global.css';

type ThemedDocsContainerProps = {
interface ThemedDocsContainerProps {
context: DocsContextProps;
children?: React.ReactNode;
};
Expand All @@ -24,7 +24,7 @@
channel.on(DARK_MODE_EVENT_NAME, setDark);

return () => channel.removeListener(DARK_MODE_EVENT_NAME, setDark);
}, [channel, setDark]);

Check warning on line 27 in packages/react-components/.storybook/preview.tsx

View workflow job for this annotation

GitHub Actions / build

React Hook React.useEffect has an unnecessary dependency: 'channel'. Either exclude it or remove the dependency array. Outer scope values like 'channel' aren't valid dependencies because mutating them doesn't re-render the component

return (
<ThemeProvider
Expand All @@ -50,12 +50,14 @@
{story()}
</ThemeProvider>
);
}
};

const preview: Preview = {
decorators: [ThemeWrapper],
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
actions: {
argTypesRegex: '^on[A-Z].*',
},
darkMode: {
dark: themeDark,
light: themeLight,
Expand Down
3 changes: 2 additions & 1 deletion packages/react-components/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// eslint-disable-next-line no-undef
module.exports = {
presets: [
"@babel/preset-env",
'@babel/preset-env',
],
};
5 changes: 3 additions & 2 deletions packages/react-components/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// eslint-disable-next-line no-undef
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
setupFilesAfterEnv: [
'@testing-library/jest-dom/extend-expect',
'<rootDir>/src/setupTests.js'
'<rootDir>/src/setupTests.ts',
],
watchPlugins: [
'jest-watch-typeahead/filename',
Expand All @@ -14,7 +15,7 @@ module.exports = {
'^.+\\.(js|jsx)$': 'babel-jest',
},
transformIgnorePatterns: [
'node_modules/(?!nanoid/.*)'
'node_modules/(?!nanoid/.*)',
],
snapshotSerializers: [
'@emotion/jest/serializer',
Expand Down
4 changes: 3 additions & 1 deletion packages/react-components/src/Alert/alert.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ const meta: Meta<typeof Alert> = {
},
tags: ['autodocs'],
argTypes: {
children: { control: 'text' },
children: {
control: 'text',
},
},
};

Expand Down
18 changes: 13 additions & 5 deletions packages/react-components/src/Alert/alert.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import { Alert } from './index';

describe('<Alert />', () => {
it('should render with default styles', () => {
const { asFragment } = render(
const {
asFragment,
} = render(
<Alert>
Alert message
</Alert>,
Expand All @@ -14,7 +16,9 @@ describe('<Alert />', () => {
});

it('should pass className', () => {
const { asFragment } = render(
const {
asFragment,
} = render(
<Alert className="my-class-name">
Alert message
</Alert>,
Expand All @@ -24,7 +28,7 @@ describe('<Alert />', () => {
});

describe('variants', () => {
const variants: Array<React.ComponentProps<typeof Alert>['variant']> = [
const variants: React.ComponentProps<typeof Alert>['variant'][] = [
'attention',
'pending',
'success',
Expand All @@ -34,7 +38,9 @@ describe('<Alert />', () => {
variants.forEach((variant) => {
describe(`variant "${variant}"`, () => {
it('enable icon', () => {
const { asFragment } = render(
const {
asFragment,
} = render(
<Alert variant={variant} disableIcon={false}>
Message
{variant}
Expand All @@ -45,7 +51,9 @@ describe('<Alert />', () => {
});

it('disable icon', () => {
const { asFragment } = render(
const {
asFragment,
} = render(
<Alert variant={variant} disableIcon>
Message
{variant}
Expand Down
2 changes: 1 addition & 1 deletion packages/react-components/src/Alert/alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
/**
* Types.
*/
type AlertOwnProps = {
interface AlertOwnProps {
/**
* The content of the component.
*/
Expand Down
Loading
Loading