Skip to content

Commit 2455dfd

Browse files
authored
chore: update eslint & its plugin version (#526)
### Description Of Changes Aims to resolve [UIKIT-1715](https://sendbird.atlassian.net/browse/UIKIT-1715) and [UIKIT-3841](https://sendbird.atlassian.net/browse/UIKIT-3841). Updated ESLint version to latest and related plugins too.
1 parent f705388 commit 2455dfd

File tree

35 files changed

+10321
-5329
lines changed

35 files changed

+10321
-5329
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ __test__/*/**.js
33
__test__/*/**.jsx
44
*.spec.js
55
*.mock.js
6-
src/ui/MessageInput/index.jsx
76
src/_externals/**/*
87

98
__snapshots__/**/*

.eslintrc.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = {
1212
Atomics: 'readonly',
1313
SharedArrayBuffer: 'readonly',
1414
},
15-
parser: 'babel-eslint',
15+
parser: "@babel/eslint-parser",
1616
parserOptions: {
1717
ecmaFeatures: {
1818
jsx: true,
@@ -36,6 +36,8 @@ module.exports = {
3636
},
3737
],
3838
"react/forbid-prop-types": 0,
39+
// we don't want to force to define function component only
40+
"react/function-component-definition": "off",
3941
"no-unused-expressions": "off",
4042
"@typescript-eslint/no-unused-expressions": ["error"],
4143
},

.eslintrc.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
{
22
"root": true,
3+
"globals": {
4+
"JSX": true,
5+
"React": true,
6+
"ChildNode": true,
7+
"ReactElement": true,
8+
"globalThis": true,
9+
"Locale": true,
10+
"SendBird": true
11+
},
312
"env": {
413
"browser": true,
514
"es6": true,
@@ -35,6 +44,7 @@
3544
"@typescript-eslint/no-explicit-any": "off",
3645
"@typescript-eslint/no-unused-expressions": "error",
3746
"react/display-name": "off",
47+
"react/function-component-definition": "off",
3848
"import/extensions": [
3949
"error",
4050
"ignorePackages",
@@ -61,6 +71,7 @@
6171
"no-bitwise": "off",
6272
"no-restricted-syntax": "off",
6373
"no-prototype-builtins": "off",
74+
"no-unsafe-optional-chaining": "off",
6475
"import/no-unresolved": "off",
6576
"import/no-extraneous-dependencies": "off",
6677
"import/no-useless-path-segments": "off",
@@ -89,7 +100,11 @@
89100
// In some cases, eslint requires semicolon and wants it removed at the same time
90101
// https://stackoverflow.com/questions/58474874/eslint-demands-semicolon-and-wants-it-removed-at-the-same-time
91102
"semi": "off",
92-
"@typescript-eslint/semi": ["error"]
103+
"@typescript-eslint/semi": ["error"],
104+
// Not to make ESLint complains a type is only being used as type but recognized as a unused variable
105+
// https://stackoverflow.com/questions/57802057/eslint-configuring-no-unused-vars-for-typescript
106+
"no-unused-vars": "off",
107+
"@typescript-eslint/no-unused-vars": ["error"]
93108
},
94109
"extends": [
95110
"plugin:react/recommended",

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ To read more: https://webpack.js.org/configuration/resolve/#resolvefallback
138138
### Creating/exporting new components
139139

140140
1. Define your component inside './src'
141-
2. Add the following line to './src/index.js'
142-
`export NewComponent from './src/location/of/NewComponent';`
141+
2. Add the following line to './src/index.ts'
142+
`export { default as NewComponent } from './src/location/of/NewComponent';`
143143
3. Add the following line to './exports.js'
144144
`NewComponent: 'src/location/of/NewComponent',`
145145

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ module.exports = {
44
'@babel/preset-react',
55
'@babel/preset-typescript',
66
],
7-
plugins: ['@babel/plugin-proposal-class-properties'],
7+
plugins: ['@babel/plugin-proposal-class-properties', '@babel/plugin-syntax-export-default-from'],
88
};

exports.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export default {
22
// legacy
3-
index: 'src/index.js',
3+
index: 'src/index.ts',
44

55
// lame-js
66
// remove when they remove 1.2.2

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
"homepage": "https://sendbird.com",
8080
"devDependencies": {
8181
"@babel/core": "^7.8.4",
82+
"@babel/eslint-parser": "^7.21.8",
8283
"@babel/plugin-proposal-class-properties": "^7.8.3",
8384
"@babel/plugin-proposal-export-default-from": "^7.8.3",
8485
"@babel/preset-env": "^7.8.3",
@@ -101,24 +102,23 @@
101102
"@svgr/webpack": "^5.1.0",
102103
"@testing-library/jest-dom": "^5.16.5",
103104
"@testing-library/react": "^13.4.0",
104-
"@typescript-eslint/eslint-plugin": "^3.10.1",
105-
"@typescript-eslint/parser": "^3.10.1",
105+
"@typescript-eslint/eslint-plugin": "^5.59.2",
106+
"@typescript-eslint/parser": "^5.59.2",
106107
"autoprefixer": "^9.7.4",
107-
"babel-eslint": "^10.0.3",
108108
"babel-jest": "^29.0.1",
109109
"babel-loader": "^8.0.6",
110110
"browserslist": "^4.14.5",
111111
"caniuse-lite": "^1.0.30001148",
112112
"css-loader": "^3.4.2",
113113
"dts-bundle-generator": "^6.5.0",
114-
"eslint": "^6.8.0",
115-
"eslint-config-airbnb": "^18.0.1",
116-
"eslint-config-airbnb-base": "^14.0.0",
114+
"eslint": "^8.40.0",
115+
"eslint-config-airbnb": "^19.0.4",
116+
"eslint-config-airbnb-base": "^15.0.0",
117117
"eslint-plugin-babel": "^5.3.1",
118-
"eslint-plugin-import": "^2.25.2",
119-
"eslint-plugin-jsx-a11y": "^6.2.3",
120-
"eslint-plugin-react": "^7.18.0",
121-
"eslint-plugin-react-hooks": "^1.7.0",
118+
"eslint-plugin-import": "^2.27.5",
119+
"eslint-plugin-jsx-a11y": "^6.7.1",
120+
"eslint-plugin-react": "^7.32.2",
121+
"eslint-plugin-react-hooks": "^4.6.0",
122122
"global-jsdom": "^8.5.0",
123123
"jest": "^29.0.1",
124124
"jest-environment-jsdom": "^29.0.1",

0 commit comments

Comments
 (0)