Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Commit

Permalink
Upgrades ESLint and related plugins/configs. (#2231)
Browse files Browse the repository at this point in the history
Summary:
This fixes some security issues reported by GitHub.

There are still warnings on the lint, but no errors. I had to make some changes. Most notably:

## `.eslintrc.js`

Changed the value of `rules` because it was required by the new `eslint-plugin-prettier`. See prettier/eslint-plugin-prettier@478c7e5

## `/src`

Changed some lints referencing `fb-www/`. ESLint 6 reports errors on rules that aren't found (see: eslint/eslint@2d32a9e). For some reason `fb-www` rules are not found. Changing the disables to be `/* eslint-disable-next-line */` makes them valid both the open source config and Facebook's internal config.
Pull Request resolved: #2231

Reviewed By: claudiopro

Differential Revision: D18206971

Pulled By: mrkev

fbshipit-source-id: 55ca3e8a24c61250dd7cd01220ed55c73a140b9d
  • Loading branch information
mrkev authored and facebook-github-bot committed Oct 29, 2019
1 parent 5dd99d3 commit 53d2a63
Show file tree
Hide file tree
Showing 6 changed files with 360 additions and 165 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Expand Up @@ -14,7 +14,7 @@ module.exports = {
'prettier/standard',
],
rules: {
'prettier/prettier': ['error', 'fb'],
'prettier/prettier': ['error'],
},
plugins: ['prettier'],
overrides: [
Expand Down
18 changes: 9 additions & 9 deletions package.json
Expand Up @@ -52,15 +52,15 @@
"del": "^2.2.0",
"envify": "^3.4.0",
"es6-shim": "^0.34.4",
"eslint": "^5.16.0",
"eslint-config-fbjs": "^2.0.0",
"eslint-config-prettier": "^2.6.0",
"eslint-plugin-babel": "^4.1.1",
"eslint-plugin-flowtype": "^2.17.1",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-prettier": "^2.3.1",
"eslint-plugin-react": "^7.3.0",
"eslint-plugin-relay": "^0.0.8",
"eslint": "^6.6.0",
"eslint-config-fbjs": "^3.1.1",
"eslint-config-prettier": "^6.5.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-flowtype": "^4.3.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-react": "^7.16.0",
"eslint-plugin-relay": "^1.3.12",
"fbjs-scripts": "^1.1.0",
"flow-bin": "^0.92.0",
"gulp": "^4.0.0",
Expand Down
6 changes: 2 additions & 4 deletions src/component/selection/getUpdatedSelectionState.js
Expand Up @@ -28,9 +28,8 @@ function getUpdatedSelectionState(
const selection: SelectionState = nullthrows(editorState.getSelection());
if (__DEV__) {
if (!anchorKey || !focusKey) {
/* eslint-disable fb-www/no-console */
/* eslint-disable-next-line */
console.warn('Invalid selection state.', arguments, editorState.toJS());
/* eslint-enable fb-www/no-console */
return selection;
}
}
Expand All @@ -50,9 +49,8 @@ function getUpdatedSelectionState(
if (!anchorLeaf || !focusLeaf) {
// If we cannot make sense of the updated selection state, stick to the current one.
if (__DEV__) {
/* eslint-disable fb-www/no-console */
/* eslint-disable-next-line */
console.warn('Invalid selection state.', arguments, editorState.toJS());
/* eslint-enable fb-www/no-console */
}
return selection;
}
Expand Down
3 changes: 1 addition & 2 deletions src/model/modifier/__tests__/AtomicBlockUtils-test.js
Expand Up @@ -33,9 +33,8 @@ const CHARACTER = ' ';

const getInvariantViolation = msg => {
try {
/* eslint-disable fb-www/sprintf-like-args */
/* eslint-disable-next-line */
invariant(false, msg);
/* eslint-enable fb-www/sprintf-like-args */
} catch (e) {
return e;
}
Expand Down
Expand Up @@ -39,9 +39,8 @@ const initialBlock = contentState.getBlockMap().first();

const getInvariantViolation = msg => {
try {
/* eslint-disable fb-www/sprintf-like-args */
/* eslint-disable-next-line */
invariant(false, msg);
/* eslint-enable fb-www/sprintf-like-args */
} catch (e) {
return e;
}
Expand Down

0 comments on commit 53d2a63

Please sign in to comment.