Skip to content

Commit 3d5b9b5

Browse files
committed
chore: eslint 10
1 parent 0cf4aa0 commit 3d5b9b5

5 files changed

Lines changed: 112 additions & 164 deletions

File tree

eslint.config.mjs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
11
import tseslint from 'typescript-eslint';
22
import callstackConfig from '@callstack/eslint-config/react-native.flat.js';
3+
import { fixupPluginRules } from '@eslint/compat';
34
import simpleImportSort from 'eslint-plugin-simple-import-sort';
4-
import jest from 'eslint-plugin-jest';
5+
6+
const patchedCallstackConfig = callstackConfig.map((configItem) => {
7+
if (!configItem.plugins?.react) {
8+
return configItem;
9+
}
10+
11+
return {
12+
...configItem,
13+
plugins: {
14+
...configItem.plugins,
15+
react: fixupPluginRules(configItem.plugins.react),
16+
},
17+
};
18+
});
519

620
export default [
721
{
822
ignores: ['build/', 'experiments-rtl/', 'website/', 'eslint.config.mjs', 'jest-setup.ts'],
923
},
10-
...callstackConfig,
24+
...patchedCallstackConfig,
1125
...tseslint.configs.strict,
1226
{
1327
plugins: {
@@ -31,9 +45,6 @@ export default [
3145
},
3246
{
3347
files: ['**/*.test.{ts,tsx}', 'src/test-utils/**'],
34-
plugins: {
35-
jest: jest,
36-
},
3748
rules: {
3849
'react/no-multi-comp': 'off',
3950
'react-native/no-color-literals': 'off',

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@
7777
"@babel/preset-react": "^7.28.5",
7878
"@babel/preset-typescript": "^7.28.5",
7979
"@callstack/eslint-config": "^15.0.0",
80+
"@eslint/compat": "^2.0.5",
81+
"@eslint/js": "^10.0.1",
8082
"@react-native/babel-preset": "0.85.0",
8183
"@react-native/jest-preset": "0.85.0",
8284
"@release-it/conventional-changelog": "^10.0.6",
@@ -87,7 +89,7 @@
8789
"babel-jest": "^30.3.0",
8890
"babel-plugin-module-resolver": "^5.0.3",
8991
"del-cli": "^7.0.0",
90-
"eslint": "^9.39.1",
92+
"eslint": "^10.2.0",
9193
"eslint-plugin-simple-import-sort": "^12.1.1",
9294
"jest": "^30.3.0",
9395
"prettier": "^3.8.2",
@@ -102,6 +104,9 @@
102104
"publishConfig": {
103105
"registry": "https://registry.npmjs.org"
104106
},
107+
"resolutions": {
108+
"@eslint/compat": "^2.0.5"
109+
},
105110
"packageManager": "yarn@4.11.0",
106111
"engines": {
107112
"node": ">=20.19.0"

src/matchers/to-have-accessible-name.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,11 @@ export function toHaveAccessibleName(
1717
const receivedName = computeAccessibleName(element);
1818
const missingExpectedValue = arguments.length === 1;
1919

20-
let pass = false;
21-
if (missingExpectedValue) {
22-
pass = receivedName !== '';
23-
} else {
24-
pass =
25-
expectedName != null
26-
? matches(expectedName, receivedName, options?.normalizer, options?.exact)
27-
: false;
28-
}
20+
const pass = missingExpectedValue
21+
? receivedName !== ''
22+
: expectedName != null
23+
? matches(expectedName, receivedName, options?.normalizer, options?.exact)
24+
: false;
2925

3026
return {
3127
pass,

src/user-event/type/type.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,11 @@ export async function type(
5757
await dispatchEvent(element, 'pressOut', buildTouchEvent());
5858
}
5959

60-
let currentText = getTextInputValue(element);
6160
for (const key of keys) {
6261
const previousText = getTextInputValue(element);
6362
const proposedText = applyKey(previousText, key);
6463
const isAccepted = isTextChangeAccepted(element, proposedText);
65-
currentText = isAccepted ? proposedText : previousText;
64+
const currentText = isAccepted ? proposedText : previousText;
6665

6766
await emitTypingEvents(element, {
6867
config: this.config,

0 commit comments

Comments
 (0)