Skip to content

Commit

Permalink
chore(eslint): Upgrade typescript-eslint (#1460)
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoevan authored Oct 15, 2024
1 parent fc33aa8 commit 1265102
Show file tree
Hide file tree
Showing 35 changed files with 309 additions and 588 deletions.
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn update-readme
2 changes: 1 addition & 1 deletion packages/css-in-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@rollup/plugin-typescript": "~8.3.4",
"@types/jest": "~29.5.12",
"@types/stylis": "^4.0.2",
"eslint": "~8.38.0",
"eslint": "~8.45.0",
"jest": "~29.7.0",
"lint-all": "workspace:~",
"prettier": "~2.8.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/css-in-js/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"skipLibCheck": true
},
"include": ["src"],
"exclude": ["dist", "node_modules", "src/*.spec.ts"]
"exclude": ["dist", "node_modules"]
}
2 changes: 1 addition & 1 deletion packages/css-supports/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"devDependencies": {
"@rocket.chat/eslint-config-alt": "workspace:~",
"@rocket.chat/prettier-config": "workspace:~",
"eslint": "~8.38.0",
"eslint": "~8.45.0",
"lint-all": "workspace:~",
"prettier": "~2.8.7",
"rimraf": "~3.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/emitter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@rollup/plugin-node-resolve": "~13.1.3",
"@rollup/plugin-typescript": "~8.3.4",
"@types/jest": "~29.5.12",
"eslint": "~8.38.0",
"eslint": "~8.45.0",
"jest": "~29.7.0",
"lint-all": "workspace:~",
"npm-run-all": "^4.1.5",
Expand Down
6 changes: 3 additions & 3 deletions packages/eslint-config-alt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
},
"devDependencies": {
"@babel/eslint-parser": "~7.21.3",
"eslint": "~8.38.0",
"eslint": "~8.45.0",
"lint-all": "workspace:~",
"prettier": "~2.8.7"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "~5.58.0",
"@typescript-eslint/parser": "~5.58.0",
"@typescript-eslint/eslint-plugin": "~8.8.1",
"@typescript-eslint/parser": "~8.8.1",
"eslint-config-prettier": "~8.8.0",
"eslint-import-resolver-typescript": "~3.5.5",
"eslint-plugin-import": "~2.26.0",
Expand Down
87 changes: 27 additions & 60 deletions packages/eslint-config-alt/typescript/index.js
Original file line number Diff line number Diff line change
@@ -1,71 +1,38 @@
/** @type {import('eslint').Linter.Config} */
module.exports = {
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/eslint-recommended',
'../minimal',
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'prettier'],
rules: {
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/indent': 'off',
'@typescript-eslint/no-empty-function': 'error',
'@typescript-eslint/no-extra-parens': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-redeclare': 'error',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
},
],
'@typescript-eslint/no-use-before-define': 'error',
'@typescript-eslint/no-var-requires': 'off',
'func-call-spacing': 'off',
'indent': 'off',
'import/order': [
'error',
{
'newlines-between': 'always',
'groups': [
'builtin',
'external',
'internal',
['parent', 'sibling', 'index'],
],
'alphabetize': {
order: 'asc',
},
},
],
'no-empty-function': 'off',
'no-extra-parens': 'off',
'no-redeclare': 'off',
'no-spaced-func': 'off',
'no-undef': 'off',
'no-unused-vars': 'off',
'no-useless-constructor': 'off',
'no-use-before-define': 'off',
'prefer-arrow-callback': ['error', { allowNamedFunctions: true }],
'prettier/prettier': 'error',
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
typescript: {},
},
},
overrides: [
{
files: ['*.+(ts|tsx|cts|ctsx|mts|mtsx)'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/eslint-recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: ['./tsconfig.json'],
},
rules: {
'@typescript-eslint/no-dupe-class-members': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
'no-dupe-class-members': 'off',
'no-empty-function': 'off',
'no-use-before-define': 'off',
'no-useless-constructor': 'off',
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
typescript: {},
},
},
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/fuselage-hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@types/react-dom": "~17.0.25",
"@types/resize-observer-browser": "~0.1.7",
"@types/use-sync-external-store": "~0.0.3",
"eslint": "~8.38.0",
"eslint": "~8.45.0",
"jest": "~29.7.0",
"lint-all": "workspace:~",
"npm-run-all": "^4.1.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/fuselage-polyfills/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"devDependencies": {
"@rocket.chat/eslint-config-alt": "workspace:~",
"@rocket.chat/prettier-config": "workspace:~",
"eslint": "~8.38.0",
"eslint": "~8.45.0",
"lint-all": "workspace:~",
"prettier": "~2.8.7"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/fuselage-toastbar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"@types/jest": "~29.5.12",
"@types/react": "~17.0.80",
"@types/react-dom": "~17.0.25",
"eslint": "~8.38.0",
"eslint": "~8.45.0",
"jest": "~29.7.0",
"jest-environment-jsdom": "~29.7.0",
"lint-all": "workspace:~",
Expand Down
2 changes: 1 addition & 1 deletion packages/fuselage-tokens/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@rocket.chat/eslint-config-alt": "workspace:~",
"@rocket.chat/prettier-config": "workspace:~",
"build-design-tokens": "workspace:~",
"eslint": "~8.38.0",
"eslint": "~8.45.0",
"eslint-config-prettier": "~8.8.0",
"eslint-plugin-import": "~2.26.0",
"eslint-plugin-prettier": "~4.2.1",
Expand Down
25 changes: 0 additions & 25 deletions packages/fuselage/.eslintrc.js

This file was deleted.

25 changes: 25 additions & 0 deletions packages/fuselage/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"extends": [
"@rocket.chat/eslint-config-alt/typescript",
"@rocket.chat/eslint-config-alt/react"
],
"rules": {
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-use-before-define": "off",
"react/display-name": "off",
"react/no-multi-comp": "off"
},
"env": {
"jest": true
},
"overrides": [
{
"files": ["*.mdx"],
"extends": ["plugin:mdx/recommended"],
"rules": {
"react/self-closing-comp": "off"
}
}
]
}
2 changes: 1 addition & 1 deletion packages/fuselage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"css-loader": "~6.7.3",
"cssnano": "~5.0.17",
"es-check": "~7.1.1",
"eslint": "~8.38.0",
"eslint": "~8.45.0",
"eslint-mdx": "~2.0.5",
"eslint-plugin-mdx": "~2.0.5",
"jest": "~29.7.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck
import { useEffectEvent, useResizeObserver } from '@rocket.chat/fuselage-hooks';
import type {
Expand Down
2 changes: 1 addition & 1 deletion packages/fuselage/src/components/CheckBox/CheckBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const CheckBox = forwardRef(function CheckBox(
if (innerRef && innerRef.current && indeterminate !== undefined) {
innerRef.current.indeterminate = indeterminate;
}
onChange && onChange.call(innerRef.current, event);
onChange?.call(innerRef.current, event);
},
[innerRef, indeterminate, onChange]
);
Expand Down
2 changes: 1 addition & 1 deletion packages/fuselage/src/components/Options/useCursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export const useCursor = <
const [, label] = option;
return typeof label === 'string' && label[0].toLowerCase() === key;
});
~index && setCursor(index);
if (~index) setCursor(index);
}
}
});
Expand Down
4 changes: 2 additions & 2 deletions packages/fuselage/src/components/Scrollable/Scrollable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const pollTouchingEdges = (

if (dirty) {
touchingEdgesRef.current = newTouchingEdges;
onScrollContent && onScrollContent(newTouchingEdges);
onScrollContent?.(newTouchingEdges);
}
};

Expand All @@ -62,7 +62,7 @@ export const Scrollable = ({
pollTouchingEdges(element, touchingEdgesRef, onScrollContent);
}

scrollTimeoutRef.current && clearTimeout(scrollTimeoutRef.current);
if (scrollTimeoutRef.current) clearTimeout(scrollTimeoutRef.current);

scrollTimeoutRef.current = setTimeout(() => {
scrollTimeoutRef.current = undefined;
Expand Down
2 changes: 1 addition & 1 deletion packages/fuselage/src/components/Select/SelectLegacy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const SelectLegacy = forwardRef(
anchor: Anchor = SelectFocus,
onChange = () => {},
getValue = ([value] = ['', '']) => value,
getLabel = ([_, label] = ['', '']) => label,
getLabel = ([, label] = ['', '']) => label,
placeholder = '',
renderItem,
renderSelected: RenderSelected,
Expand Down
2 changes: 1 addition & 1 deletion packages/icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@rocket.chat/eslint-config-alt": "workspace:~",
"@rocket.chat/prettier-config": "workspace:~",
"build-icons": "workspace:~",
"eslint": "~8.38.0",
"eslint": "~8.45.0",
"lint-all": "workspace:~",
"npm-run-all": "^4.1.5",
"prettier": "~2.8.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/layout/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@types/jest": "~29.5.12",
"@types/react": "~17.0.80",
"@types/react-dom": "~17.0.25",
"eslint": "~8.38.0",
"eslint": "~8.45.0",
"jest": "~29.7.0",
"lint-all": "workspace:~",
"npm-run-all": "^4.1.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/logo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@types/react": "~17.0.80",
"@types/react-dom": "~17.0.25",
"build-logo": "workspace:~",
"eslint": "~8.38.0",
"eslint": "~8.45.0",
"jest": "~29.7.0",
"lint-all": "workspace:~",
"npm-run-all": "^4.1.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/memo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@rocket.chat/eslint-config-alt": "workspace:~",
"@rocket.chat/prettier-config": "workspace:~",
"@types/jest": "~29.5.12",
"eslint": "~8.38.0",
"eslint": "~8.45.0",
"jest": "~29.7.0",
"lint-all": "workspace:~",
"prettier": "~2.8.7",
Expand Down
11 changes: 0 additions & 11 deletions packages/mp3-encoder/.eslintrc.js

This file was deleted.

17 changes: 17 additions & 0 deletions packages/mp3-encoder/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://json.schemastore.org/eslintrc",
"extends": "@rocket.chat/eslint-config-alt/minimal",
"env": {
"jest": true
},
"ignorePatterns": ["dist", "node_modules", "src/lame/*.js"],
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"extends": "@rocket.chat/eslint-config-alt/typescript",
"rules": {
"new-cap": "off"
}
}
]
}
2 changes: 1 addition & 1 deletion packages/mp3-encoder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@rollup/plugin-node-resolve": "~15.0.2",
"@rollup/plugin-typescript": "~11.1.0",
"@types/jest": "~29.5.12",
"eslint": "~8.38.0",
"eslint": "~8.45.0",
"jest": "~29.7.0",
"jest-environment-jsdom": "~29.7.0",
"lint-all": "workspace:~",
Expand Down
2 changes: 1 addition & 1 deletion packages/onboarding-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"@types/react": "~17.0.80",
"@types/react-dom": "~17.0.25",
"countries-list": "^2.6.1",
"eslint": "~8.38.0",
"eslint": "~8.45.0",
"jest": "~29.7.0",
"lint-all": "workspace:~",
"npm-run-all": "^4.1.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/peggy-loader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@rocket.chat/eslint-config-alt": "workspace:~",
"@rocket.chat/prettier-config": "workspace:~",
"@types/node": "~14.18.42",
"eslint": "~8.38.0",
"eslint": "~8.45.0",
"lint-all": "workspace:~",
"npm-run-all": "^4.1.5",
"peggy": "3.0.2",
Expand Down
Loading

0 comments on commit 1265102

Please sign in to comment.