Skip to content

Commit

Permalink
Use new eslint-config-fbjs, fix lint warnings
Browse files Browse the repository at this point in the history
Summary:
I just shipped `eslint-config-fbjs` which much more closely matches the lint config we have internally, uses a few plugins, and has the globals we need for Flow. This also takes care of the really large list of Flow-related unused/undef var warnings. With this you're back down to 0 warnings.
Closes #1280

Reviewed By: zpao

Differential Revision: D3562291

Pulled By: kassens

fbshipit-source-id: ea70968d2fbf9022435af032f6a147fa491cf228
  • Loading branch information
zpao authored and Facebook Github Bot 2 committed Jul 14, 2016
1 parent 48c1cea commit cc04ade
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 29 deletions.
19 changes: 3 additions & 16 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
---
parser: babel-eslint

extends:
- ./node_modules/fbjs-scripts/eslint/.eslintrc.js

plugins:
- react
- fbjs

rules:
react/jsx-uses-react: 2

globals:
$Keys: true
$FixMe: true
$FlowFixMe: true
$FlowIssue: true
Iterator: true
IteratorResult: true
ReactClass: true
ReactElement: true
# this is very noisy, so disable
consistent-return: 0
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,16 @@
"devDependencies": {
"babel-cli": "^6.9.0",
"babel-core": "^6.9.0",
"babel-eslint": "^6.0.4",
"babel-eslint": "^6.1.2",
"babel-plugin-transform-runtime": "^6.9.0",
"babel-polyfill": "^6.9.0",
"babel-preset-fbjs": "^2.0.0",
"del": "^2.2.0",
"eslint": "^2.10.2",
"eslint-plugin-react": "^5.1.1",
"eslint": "^3.0.1",
"eslint-config-fbjs": "^1.0.0",
"eslint-plugin-babel": "^3.3.0",
"eslint-plugin-flow-vars": "^0.4.0",
"eslint-plugin-react": "^5.2.2",
"fbjs-scripts": "^0.7.1",
"flow-bin": "^0.28.0",
"graphql": "0.6.0",
Expand Down
14 changes: 8 additions & 6 deletions src/legacy/store/GraphQLQueryRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,14 @@ function runQueries(
},
});
} else {
if (everyObject(remainingRequiredFetchMap, canResolve) &&
hasItems(remainingRequiredFetchMap)) {
readyState.update({
ready: true,
stale: true,
}, [{type: 'CACHE_RESTORED_REQUIRED'}]);
if (
everyObject(remainingRequiredFetchMap, canResolve) &&
hasItems(remainingRequiredFetchMap)
) {
readyState.update({
ready: true,
stale: true,
}, [{type: 'CACHE_RESTORED_REQUIRED'}]);
} else {
readyState.update({}, [{type: 'CACHE_RESTORE_FAILED'}]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/legacy/store/__tests__/GraphQLRange-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ describe('GraphQLRange', () => {
]);
});

it('should not make empty segment for after().last() query with gap', () => {
it('should not make empty segment for after().last() query with gap', () => {
let queryCalls = [
{name: 'after', value: null},
{name: 'last', value: 3},
Expand Down
2 changes: 1 addition & 1 deletion src/store/__tests__/RelayStoreData-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ describe('RelayStoreData', () => {
},
'789': {
'client:1': true,
}
},
},
};
expect(stringifiedStoreData).toEqual(JSON.stringify(expectedStoreData));
Expand Down
2 changes: 1 addition & 1 deletion src/tools/__mocks__/RelayTestUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ function prettifyQueryString(queryText, indentSize) {
indent = indent.substr(0, indent.length - 2);
output += '\n' + indent + '}';
} else if (match[0] === ',') {
output += ',' + '\n' + indent;
output += ',\n' + indent;
} else {
output += match[0];
}
Expand Down
2 changes: 1 addition & 1 deletion src/traversal/__tests__/writeRelayUpdatePayload-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ describe('writeRelayUpdatePayload()', () => {
});

describe('node/range delete mutations', () => {
let store, queueStore, writer, queueWriter, feedbackID, connectionID, firstCommentID, secondCommentID, firstEdgeID, secondEdgeID;
let store, queueStore, writer, queueWriter, feedbackID, connectionID, firstCommentID, secondCommentID, firstEdgeID, secondEdgeID; // eslint-disable-line max-len

beforeEach(() => {
const records = {};
Expand Down

0 comments on commit cc04ade

Please sign in to comment.