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

Package update linting #165

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
52 changes: 0 additions & 52 deletions .eslintrc.js

This file was deleted.

3 changes: 0 additions & 3 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ module.exports = {
"@babel/preset-react",
],
plugins: [
"@babel/plugin-proposal-class-properties",

[
"transform-react-remove-prop-types",
{
Expand All @@ -38,7 +36,6 @@ module.exports = {
"@babel/preset-react",
],
plugins: [
"@babel/plugin-proposal-class-properties",
[
"transform-react-remove-prop-types",
{
Expand Down
86 changes: 86 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import { fixupConfigRules, fixupPluginRules } from "@eslint/compat";
import react from "eslint-plugin-react";
import jsxA11Y from "eslint-plugin-jsx-a11y";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [{
ignores: ["**/.eslintrc.js", "**/perfect-scrollbar.esm.js"],
}, ...fixupConfigRules(compat.extends(
"eslint:recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:jsx-a11y/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
)), {
plugins: {
react: fixupPluginRules(react),
"jsx-a11y": fixupPluginRules(jsxA11Y),
"@typescript-eslint": fixupPluginRules(typescriptEslint),
},

languageOptions: {
globals: {
...globals.browser,
...globals.commonjs,
...globals.node,
},

parser: tsParser,
ecmaVersion: 6,
sourceType: "module",

parserOptions: {
tsconfigRootDir: process.cwd(),

ecmaFeatures: {
jsx: true,
},

project: ["./tsconfig.json"],
},
},

settings: {
react: {
version: "detect",
},
},

rules: {
"linebreak-style": ["error", "unix"],
semi: ["error", "always"],
"no-console": ["warn"],
"prefer-template": ["error"],
},
}, {
files: ["**/*.js", "**/*.jsx"],

rules: {
"@typescript-eslint/no-unsafe-assignment": 0,
"@typescript-eslint/no-unsafe-member-access": 0,
"@typescript-eslint/no-unsafe-argument": 0,
"@typescript-eslint/no-unsafe-return": 0,
"@typescript-eslint/restrict-template-expressions": 0,
"@typescript-eslint/no-unsafe-call": 0,
},
}, {
files: ["./*.config.*"],
rules: {
"@typescript-eslint/no-unsafe-assignment": "off"
}
}];
77 changes: 41 additions & 36 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,55 +36,60 @@
"react-dom": "^16.12.0 || ^17.0.0 || ^18.2.0"
},
"devDependencies": {
"@babel/cli": "7.10.5",
"@babel/core": "7.11.4",
"@babel/plugin-proposal-class-properties": "7.10.4",
"@babel/preset-env": "7.11.5",
"@babel/preset-react": "7.10.4",
"@commitlint/cli": "11.0.0",
"@commitlint/config-conventional": "11.0.0",
"@rollup/plugin-babel": "5.2.0",
"@rollup/plugin-commonjs": "11.1.0",
"@rollup/plugin-node-resolve": "7.1.3",
"@babel/cli": "7.25.9",
"@babel/core": "7.26.0",
"@babel/eslint-parser": "^7.25.9",
"@babel/preset-env": "7.26.0",
"@babel/preset-react": "7.25.9",
"@commitlint/cli": "19.5.0",
"@commitlint/config-conventional": "19.5.0",
"@eslint/compat": "^1.2.3",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.14.0",
"@rollup/plugin-babel": "6.0.4",
"@rollup/plugin-commonjs": "28.0.1",
"@rollup/plugin-node-resolve": "15.3.0",
"@rollup/plugin-terser": "0.4.4",
"@semantic-release/changelog": "6.0.3",
"@semantic-release/git": "10.0.1",
"@semantic-release/github": "9.2.6",
"@typescript-eslint/eslint-plugin": "^5.9.1",
"@typescript-eslint/parser": "^5.9.1",
"babel-eslint": "10.1.0",
"@semantic-release/github": "11.0.1",
"@types/node": "^20.17.6",
"@types/react": "^18.3.12",
"@typescript-eslint/eslint-plugin": "^8.14.0",
"@typescript-eslint/parser": "^8.14.0",
"babel-plugin-transform-react-remove-prop-types": "0.4.24",
"chokidar-cli": "2.1.0",
"eslint": "8.6.0",
"eslint-plugin-jsx-a11y": "6.5.1",
"eslint-plugin-react": "7.28.0",
"eslint-plugin-react-hooks": "^4.3.0",
"husky": "4.3.0",
"lint-staged": "10.4.0",
"prettier": "2.1.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rollup": "2.26.5",
"rollup-plugin-peer-deps-external": "2.2.3",
"rollup-plugin-terser": "5.3.0",
"semantic-release": "23.0.2",
"typescript": "^4.5.4"
"chokidar-cli": "3.0.0",
"eslint": "9.14.0",
"eslint-plugin-jsx-a11y": "6.10.2",
"eslint-plugin-react": "7.37.2",
"eslint-plugin-react-hooks": "^5.0.0",
"globals": "^15.12.0",
"husky": "9.1.6",
"lint-staged": "15.2.10",
"prettier": "3.3.3",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"rollup": "4.27.0",
"rollup-plugin-peer-deps-external": "2.2.4",
"semantic-release": "24.2.0",
"typescript": "^5.6.3"
},
"scripts": {
"build:clean": "rm -Rf dist",
"build:umd": "rollup -c",
"build:umd": "rollup -c --bundleConfigAsCjs",
"build:cjs": "BABEL_ENV=cjs babel src/components -d dist/cjs",
"build:esm": "BABEL_ENV=esm babel src/components -d dist/es",
"build": "yarn run build:clean && yarn run build:esm && yarn run build:cjs && yarn run build:umd",
"pack": "yarn pack",
"watch": "chokidar 'src/**/*.*' -c 'yarn run build:esm'"
},
"dependencies": {
"@chatscope/chat-ui-kit-styles": "^1.2.0",
"@fortawesome/fontawesome-free": "^5.12.1",
"@fortawesome/fontawesome-svg-core": "^1.2.26",
"@fortawesome/free-solid-svg-icons": "^5.12.0",
"@fortawesome/react-fontawesome": "^0.1.8",
"classnames": "^2.2.6",
"@chatscope/chat-ui-kit-styles": "^1.4.0",
"@fortawesome/fontawesome-free": "^6.6.0",
"@fortawesome/fontawesome-svg-core": "^6.6.0",
"@fortawesome/free-solid-svg-icons": "^6.6.0",
"@fortawesome/react-fontawesome": "^0.2.2",
"classnames": "^2.5.1",
"prop-types": "^15.7.2"
},
"husky": {
Expand Down
3 changes: 1 addition & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import babel from "@rollup/plugin-babel";
import peerDepsExternal from "rollup-plugin-peer-deps-external";
import { terser } from "rollup-plugin-terser";
import terser from "@rollup/plugin-terser";

export default [
// browser-friendly UMD build
Expand Down Expand Up @@ -32,7 +32,6 @@ export default [
babelHelpers: "bundled",
compact: true,
plugins: [
"@babel/plugin-proposal-class-properties",
[
"transform-react-remove-prop-types",
{
Expand Down
1 change: 1 addition & 0 deletions src/components/ContentEditable/ContentEditable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export class ContentEditable extends Component {
onInput={handleInput}
onKeyPress={handleKeyPress}
dangerouslySetInnerHTML={innerHTML()}
role="textbox"
></div>
);
}
Expand Down
4 changes: 4 additions & 0 deletions src/components/Conversation/Conversation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ const LastActivityTime = ({ time }) => (
</div>
);

LastActivityTime.propTypes = {
time: PropTypes.string
};

const UnreadDot = () => <div className={`${cName}__unread-dot`}></div>;

export const Conversation = ({
Expand Down
4 changes: 2 additions & 2 deletions src/components/ConversationList/ConversationList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const ConversationList = ({

// Memoize, to avoid re-render each time when props (children) changed
const Tag = useMemo(
() => ({ children }) => {
() => function Tag({ children }) {
// PerfectScrollbar for now cant be disabled, so render div instead of disabling it
// https://github.com/goldenyz/react-perfect-scrollbar/issues/107
if (scrollable === false || (scrollable === true && loading === true)) {
Expand All @@ -46,7 +46,7 @@ export const ConversationList = ({
);
}
},
[scrollable, loading]
[scrollable, loading, onYReachEnd]
);

return (
Expand Down
10 changes: 8 additions & 2 deletions src/components/ExpansionPanel/ExpansionPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,18 @@ export const ExpansionPanel = ({
onChange?.(!opened, e);
}
},
[onChange, open, opened, isOpened]
[onChange, opened, isOpened]
);

const onKeyDown = useCallback((ev) => {
if (ev.code && ev.code.toLowerCase() === "enter") {
handleOpen(ev);
}
}, [handleOpen]);

return (
<div {...rest} className={classNames(cName, openModifier, className)}>
<div className={`${cName}__header`} onClick={handleOpen}>
<div className={`${cName}__header`} onClick={handleOpen} role="button" tabIndex="0" onKeyDown={onKeyDown}>
<div className={`${cName}__title`}>{title}</div>
<div className={`${cName}__icon`}>
<FontAwesomeIcon icon={icon} />
Expand Down
Loading