Skip to content

Commit 9100d63

Browse files
jaworekthymikee
andauthored
chore(breaking): update dependencies with new Babel parser (#235)
* chore: update project dependencies * chore: experiment with babel.config * chore: update yarn.lock * chore: add prettier * fix: use correct signs * fix: update yarn.lock of tests * chore: remove duplicate prettier in react config * chore: move preset-react to react.js * test: prettier * fix: allow more node versions with stable ESM * fix: prettier test Co-authored-by: Michał Pierzchała <[email protected]>
1 parent e69c739 commit 9100d63

File tree

8 files changed

+3486
-3949
lines changed

8 files changed

+3486
-3949
lines changed

node.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,14 @@ module.exports = {
4444
overrides: [
4545
{
4646
files: ['*.js', '*.jsx'],
47-
parser: 'babel-eslint',
47+
parser: '@babel/eslint-parser',
48+
parserOptions: {
49+
babelOptions: {
50+
presets: ['@babel/preset-flow'],
51+
},
52+
},
4853
plugins: ['flowtype'],
49-
extends: ['plugin:flowtype/recommended', 'prettier/flowtype'],
54+
extends: ['plugin:flowtype/recommended', 'prettier'],
5055
settings: {
5156
'import/extensions': [...extensions.JS, ...extensions.TS],
5257
'import/resolver': {

package.json

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "11.0.0",
44
"description": "ESLint preset extending Airbnb, Flow, Prettier and Jest",
55
"engines": {
6-
"node": ">=10.13.0"
6+
"node": "^12.22.0 || ^13.14.0 || ^14.17.0 || ^15.3.0 || >=16.0.0"
77
},
88
"main": "./react-native.js",
99
"repository": "[email protected]:callstack/eslint-config-callstack.git",
@@ -15,28 +15,31 @@
1515
"callstack"
1616
],
1717
"dependencies": {
18-
"@typescript-eslint/eslint-plugin": "^4.15.0",
19-
"@typescript-eslint/parser": "^4.15.0",
20-
"babel-eslint": "^10.0.3",
21-
"eslint-config-prettier": "^6.10.1",
22-
"eslint-plugin-flowtype": "^4.5.2",
23-
"eslint-plugin-import": "^2.25.2",
24-
"eslint-plugin-jest": "^25.0.5",
25-
"eslint-plugin-prettier": "^3.1.3",
26-
"eslint-plugin-promise": "^4.2.1",
27-
"eslint-plugin-react": "^7.17.0",
28-
"eslint-plugin-react-hooks": "^4.0.0",
29-
"eslint-plugin-react-native": "^3.8.1",
30-
"eslint-plugin-react-native-a11y": "^2.0.0",
18+
"@babel/core": "^7.16.0",
19+
"@babel/eslint-parser": "^7.16.3",
20+
"@babel/preset-flow": "^7.16.0",
21+
"@babel/preset-react": "^7.16.0",
22+
"@typescript-eslint/eslint-plugin": "^5.4.0",
23+
"@typescript-eslint/parser": "^5.4.0",
24+
"eslint-config-prettier": "^8.3.0",
25+
"eslint-plugin-flowtype": "^7.0.0",
26+
"eslint-plugin-import": "^2.25.3",
27+
"eslint-plugin-jest": "^25.3.0",
28+
"eslint-plugin-prettier": "^4.0.0",
29+
"eslint-plugin-promise": "^5.1.1",
30+
"eslint-plugin-react": "^7.27.1",
31+
"eslint-plugin-react-hooks": "^4.3.0",
32+
"eslint-plugin-react-native": "^3.11.0",
33+
"eslint-plugin-react-native-a11y": "^3.0.0",
3134
"eslint-restricted-globals": "^0.2.0",
32-
"prettier": "^2.0.4"
35+
"prettier": "^2.4.1"
3336
},
3437
"peerDependencies": {
35-
"eslint": ">=6"
38+
"eslint": ">=7"
3639
},
3740
"devDependencies": {
38-
"eslint": "^6.7.2",
39-
"typescript": "^4.0.3"
41+
"eslint": "^7.32.0",
42+
"typescript": "^4.5.2"
4043
},
4144
"scripts": {
4245
"test": "yarn --cwd test && yarn --cwd test eslint --report-unused-disable-directives --ext .js,.ts,.jsx,.tsx ."

react.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ const WARNING = 1;
33
const ERROR = 2;
44

55
module.exports = {
6-
extends: [
7-
require.resolve('./node.js'),
8-
'plugin:react/recommended',
9-
'prettier/react',
10-
],
6+
extends: [require.resolve('./node.js'), 'plugin:react/recommended'],
117
env: {
128
browser: true,
139
},
@@ -17,6 +13,16 @@ module.exports = {
1713
jsx: true,
1814
},
1915
},
16+
overrides: [
17+
{
18+
files: ['*.js', '*.jsx'],
19+
parserOptions: {
20+
babelOptions: {
21+
presets: ['@babel/preset-react', '@babel/preset-flow'],
22+
},
23+
},
24+
},
25+
],
2026
rules: {
2127
'react/display-name': OFF,
2228
'react/no-multi-comp': [WARNING, { ignoreStateless: true }],

test/babel.config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

test/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ export function Hook() {
4444

4545
React.useEffect(() => {
4646
try {
47-
map.get('formData');
47+
map.get(
48+
// eslint-disable-next-line prettier/prettier
49+
'formData');
4850
} catch (_hugeObject) {
4951
// handled
5052
}

test/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,17 @@ export default class Bool extends React.Component<Props> {
3636
return this.props.updateMode(token);
3737
};
3838

39-
animate = (_: ?number) => {};
39+
animate = (_: number) => {};
4040
}
4141

4242
export function Hook() {
4343
const map = new Map();
4444

4545
React.useEffect(() => {
4646
try {
47-
map.get('formData');
47+
map.get(
48+
// eslint-disable-next-line prettier/prettier
49+
'formData');
4850
} catch (_hugeObject) {
4951
// handled
5052
}

0 commit comments

Comments
 (0)