Skip to content

Commit 388fd8c

Browse files
SimenBcpojer
authored andcommitted
Upgrade eslint (#3897)
1 parent 5e28dda commit 388fd8c

File tree

22 files changed

+297
-438
lines changed

22 files changed

+297
-438
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
**/coverage/**
22
**/node_modules/**
33
bin/
4-
docs/
54
flow-typed/**
65
packages/*/build/**
76
packages/*/build-es5/**

.eslintrc-docs.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

.eslintrc.js

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,58 @@
77
*/
88

99
module.exports = {
10-
'extends': [
10+
extends: [
1111
'./packages/eslint-config-fb-strict/index.js',
12-
'plugin:import/errors'
12+
'plugin:import/errors',
1313
],
14-
'parser': 'babel-eslint',
15-
'rules': {
14+
parser: 'babel-eslint',
15+
rules: {
1616
'computed-property-spacing': 0,
1717
'flowtype/boolean-style': 2,
1818
'flowtype/no-primitive-constructor-types': 2,
1919
'flowtype/require-valid-file-annotation': 2,
2020
'max-len': 0,
2121
'no-multiple-empty-lines': 1,
2222
'import/no-duplicates': 2,
23-
'import/no-unresolved': [2, { 'ignore': ['^types/'] }],
23+
'import/no-unresolved': [2, { ignore: ['^types/'] }],
2424
// This has to be disabled until all type and module imports are combined
2525
// https://github.com/benmosher/eslint-plugin-import/issues/645
2626
'import/order': 0,
2727
// These has to be disabled until the whole code base is converted to ESM
2828
'import/default': 0,
2929
'import/named': 0,
3030
},
31-
'plugins': [
32-
'markdown',
33-
'import'
34-
]
31+
plugins: ['markdown', 'import'],
32+
overrides: [
33+
// to make it more suitable for running on code examples in docs/ folder
34+
{
35+
files: ['*.md'],
36+
rules: {
37+
'react/react-in-jsx-scope': 0,
38+
'react/jsx-no-undef': 0,
39+
'jest/no-focused-tests': 0,
40+
'jest/valid-expect': 0,
41+
'jest/no-identical-title': 0,
42+
'no-undef': 0,
43+
'no-unused-vars': 0,
44+
'consistent-return': 0,
45+
'import/no-unresolved': 0,
46+
'sort-keys': 0
47+
},
48+
},
49+
{
50+
files: ['examples/**/*'],
51+
rules: {
52+
'babel/func-params-comma-dangle': 0,
53+
'import/order': 0,
54+
'import/no-unresolved': [2, { 'ignore': ['^react-native$'] }]
55+
},
56+
},
57+
{
58+
files: ['scripts/**/*', 'integration_tests/**/*'],
59+
rules: {
60+
'babel/func-params-comma-dangle': 0,
61+
},
62+
},
63+
],
3564
};

blog/2016-07-27-jest-14.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ By building a test renderer that targets no specific platform we are finally abl
5454

5555
You can start using Jest with react-native by running `npm install --save-dev jest-react-native` and by adding the preset to your Jest configuration:
5656

57-
```javascript
57+
```json
5858
"jest": {
5959
"preset": "jest-react-native"
6060
}

docs/en/MockFunctions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ invokes a callback for each item in a supplied array.
2525

2626
```javascript
2727
function forEach(items, callback) {
28-
for (var index = 0; index < items.length; index++) {
28+
for (let index = 0; index < items.length; index++) {
2929
callback(items[index]);
3030
}
3131
}

examples/.eslintrc

Lines changed: 0 additions & 7 deletions
This file was deleted.

integration_tests/.eslintrc

Lines changed: 0 additions & 5 deletions
This file was deleted.

integration_tests/__tests__/iterator-to-null-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* LICENSE file in the root directory of this source tree. An additional grant
66
* of patent rights can be found in the PATENTS file in the same directory.
77
*/
8+
/* eslint-disable no-extend-native */
89

910
'use strict';
1011

package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
"codecov": "^1.0.1",
2121
"cross-spawn": "^5.1.0",
2222
"enzyme": "^2.8.2",
23-
"eslint": "^3.17.1",
23+
"eslint": "^4.1.0",
2424
"eslint-plugin-babel": "^4.1.1",
25-
"eslint-plugin-flowtype": "^2.30.3",
26-
"eslint-plugin-import": "^2.2.0",
27-
"eslint-plugin-markdown": "^1.0.0-beta.4",
28-
"eslint-plugin-react": "^6.7.1",
25+
"eslint-plugin-flowtype": "^2.34.0",
26+
"eslint-plugin-import": "^2.6.0",
27+
"eslint-plugin-markdown": "^1.0.0-beta.6",
28+
"eslint-plugin-react": "^7.1.0",
2929
"flow-bin": "^0.48.0",
3030
"glob": "^7.1.1",
3131
"graceful-fs": "^4.1.11",
@@ -57,8 +57,7 @@
5757
"clean-all": "rm -rf ./node_modules && rm -rf ./packages/*/node_modules && rm -rf ./integration_tests/*/*/node_modules && yarn run build-clean",
5858
"jest": "node ./packages/jest-cli/bin/jest.js",
5959
"jest-coverage": "yarn run jest --silent -- --coverage",
60-
"lint": "yarn run lint-prettier --silent && eslint . --cache && yarn run lint-docs --silent",
61-
"lint-docs": "eslint --config ./.eslintrc-docs.json --no-ignore --ext md ./docs/*.md",
60+
"lint": "yarn run lint-prettier --silent && eslint . --cache --ext js,md",
6261
"lint-es5-build": "eslint --no-eslintrc --no-ignore --env=browser packages/*/build-es5",
6362
"lint-prettier": "node scripts/prettier.js lint",
6463
"prettier": "node scripts/prettier.js write",

packages/babel-plugin-jest-hoist/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ $ babel --plugins jest-hoist script.js
2929
### Via Node API
3030

3131
```javascript
32-
require("babel-core").transform("code", {
33-
plugins: ["jest-hoist"]
32+
require('babel-core').transform('code', {
33+
plugins: ['jest-hoist'],
3434
});
3535
```

0 commit comments

Comments
 (0)