Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: sort member in imports #8846

Merged
merged 2 commits into from
Aug 18, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports = {
extends: [
'./packages/eslint-config-fb-strict/index.js',
'plugin:import/errors',
'plugin:import/typescript',
'prettier',
'prettier/flowtype',
],
Expand All @@ -18,12 +19,14 @@ module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint/eslint-plugin'],
rules: {
'@typescript-eslint/array-type': ['error', 'generic'],
'@typescript-eslint/array-type': ['error', {default: 'generic'}],
'@typescript-eslint/ban-types': 'error',
'@typescript-eslint/no-unused-vars': [
'error',
{argsIgnorePattern: '^_'},
],
// Since we do `export =`. Remove for Jest 25
'import/default': 'off',
'import/order': 'error',
'no-dupe-class-members': 'off',
'no-unused-vars': 'off',
Expand Down Expand Up @@ -108,10 +111,6 @@ module.exports = {
'no-console': 0,
'no-unused-vars': 2,
'prettier/prettier': 2,
},
settings: {
'import/resolver': {
'eslint-import-resolver-typescript': true,
},
'sort-imports': [2, {ignoreDeclarationSort: true}],
},
};
2 changes: 1 addition & 1 deletion docs/TutorialReact.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export default class CheckboxWithLabel extends React.Component {
```javascript
// __tests__/CheckboxWithLabel-test.js
import React from 'react';
import {render, fireEvent, cleanup} from '@testing-library/react';
import {cleanup, fireEvent, render} from '@testing-library/react';
import CheckboxWithLabel from '../CheckboxWithLabel';

// automatically unmount and cleanup DOM after the test is finished.
Expand Down
2 changes: 1 addition & 1 deletion e2e/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as fs from 'fs';
import * as path from 'path';
import {Config} from '@jest/types';

import {sync as spawnSync, ExecaReturns} from 'execa';
import {ExecaReturns, sync as spawnSync} from 'execa';
import {createDirectory} from 'jest-util';
import rimraf from 'rimraf';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2004-present Facebook. All Rights Reserved.

import React from 'react';
import {render, fireEvent, cleanup} from '@testing-library/react';
import {cleanup, fireEvent, render} from '@testing-library/react';
import CheckboxWithLabel from '../CheckboxWithLabel';

// automatically unmount and cleanup DOM after the test is finished.
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"@types/babel__template": "^7.0.0",
"@types/jest": "24.0.2",
"@types/node": "*",
"@typescript-eslint/eslint-plugin": "^1.10.2",
"@typescript-eslint/parser": "^1.10.2",
"@typescript-eslint/eslint-plugin": "^2.0.0",
"@typescript-eslint/parser": "^2.0.0",
"ansi-regex": "^4.0.0",
"ansi-styles": "^3.2.0",
"babel-eslint": "^10.0.2",
Expand All @@ -28,7 +28,6 @@
"debug": "^4.0.1",
"eslint": "^5.6.0",
"eslint-config-prettier": "^5.0.0",
"eslint-import-resolver-typescript": "^1.1.1",
"eslint-plugin-babel": "^5.1.0",
"eslint-plugin-flowtype": "^2.35.0",
"eslint-plugin-import": "^2.6.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-jest/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import * as path from 'path';
import {Transformer} from '@jest/transform';
import {Config} from '@jest/types';
import {
loadPartialConfig,
PartialConfig,
TransformOptions,
transformSync as babelTransform,
loadPartialConfig,
} from '@babel/core';
import chalk from 'chalk';
import slash from 'slash';
Expand Down
14 changes: 7 additions & 7 deletions packages/expect/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
import * as matcherUtils from 'jest-matcher-utils';
import {
AsyncExpectationResult,
SyncExpectationResult,
Expect,
ExpectationResult,
Matchers as MatcherInterface,
MatcherState as JestMatcherState,
Matchers as MatcherInterface,
MatchersObject,
PromiseMatcherFn,
RawMatcherFn,
SyncExpectationResult,
ThrowingMatcherFn,
PromiseMatcherFn,
Expect,
} from './types';

import {iterableEquality, subsetEquality} from './utils';
Expand All @@ -35,16 +35,16 @@ import {
objectContaining,
objectNotContaining,
stringContaining,
stringNotContaining,
stringMatching,
stringNotContaining,
stringNotMatching,
} from './asymmetricMatchers';
import {
INTERNAL_MATCHER_FLAG,
getState,
setState,
getMatchers,
getState,
setMatchers,
setState,
} from './jestMatchersObject';
import extractExpectedAssertionsErrors from './extractExpectedAssertionsErrors';

Expand Down
6 changes: 3 additions & 3 deletions packages/expect/src/matchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import getType, {isPrimitive} from 'jest-get-type';
import {
DIM_COLOR,
EXPECTED_COLOR,
MatcherHintOptions,
RECEIVED_COLOR,
SUGGEST_TO_CONTAIN_EQUAL,
ensureExpectedIsNonNegativeInteger,
Expand All @@ -19,13 +20,12 @@ import {
matcherErrorMessage,
matcherHint,
printDiffOrStringify,
printReceived,
printExpected,
printReceived,
printWithType,
stringify,
MatcherHintOptions,
} from 'jest-matcher-utils';
import {MatchersObject, MatcherState} from './types';
import {MatcherState, MatchersObject} from './types';
import {
printExpectedConstructorName,
printExpectedConstructorNameNot,
Expand Down
10 changes: 5 additions & 5 deletions packages/expect/src/spyMatchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@

import getType, {isPrimitive} from 'jest-get-type';
import {
DIM_COLOR,
EXPECTED_COLOR,
MatcherHintOptions,
RECEIVED_COLOR,
diff,
ensureExpectedIsNumber,
ensureNoExpected,
DIM_COLOR,
EXPECTED_COLOR,
matcherErrorMessage,
matcherHint,
MatcherHintOptions,
printExpected,
printReceived,
printWithType,
RECEIVED_COLOR,
stringify,
} from 'jest-matcher-utils';
import {MatchersObject, MatcherState, SyncExpectationResult} from './types';
import {MatcherState, MatchersObject, SyncExpectationResult} from './types';
import {equals} from './jasmineUtils';
import {iterableEquality} from './utils';

Expand Down
4 changes: 2 additions & 2 deletions packages/expect/src/toThrowMatchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
import {formatStackTrace, separateMessageFromStack} from 'jest-message-util';
import {
EXPECTED_COLOR,
MatcherHintOptions,
RECEIVED_COLOR,
matcherErrorMessage,
matcherHint,
printDiffOrStringify,
printExpected,
printReceived,
printWithType,
MatcherHintOptions,
} from 'jest-matcher-utils';
import {
printExpectedConstructorName,
Expand All @@ -27,8 +27,8 @@ import {
printReceivedStringContainExpectedSubstring,
} from './print';
import {
MatchersObject,
MatcherState,
MatchersObject,
RawMatcherFn,
SyncExpectationResult,
} from './types';
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-circus/src/__mocks__/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import * as fs from 'fs';
import {tmpdir} from 'os';
import * as path from 'path';
import {createHash} from 'crypto';
import {sync as spawnSync, ExecaReturns} from 'execa';
import {ExecaReturns, sync as spawnSync} from 'execa';
import {skipSuiteOnWindows} from '@jest/test-utils';

const CIRCUS_PATH = require.resolve('../../build');
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-circus/src/eventHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import {TEST_TIMEOUT_SYMBOL} from './types';

import {
addErrorToEachTestUnderDescribe,
makeDescribe,
describeBlockHasTests,
getTestDuration,
invariant,
makeDescribe,
makeTest,
describeBlockHasTests,
} from './utils';
import {
injectGlobalErrorHandlers,
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-circus/src/formatNodeAssertErrors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import {AssertionError} from 'assert';
import {Circus} from '@jest/types';
import {
DiffOptions,
diff,
printExpected,
printReceived,
DiffOptions,
} from 'jest-matcher-utils';
import chalk from 'chalk';
import prettyFormat from 'pretty-format';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ import {
} from 'jest-snapshot';
import throat from 'throat';
import {
ROOT_DESCRIBE_BLOCK_NAME,
addEventHandler,
dispatch,
getState as getRunnerState,
ROOT_DESCRIBE_BLOCK_NAME,
} from '../state';
import {getTestID} from '../utils';
import run from '../run';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import expect from 'expect';

import {
addSerializer,
toMatchSnapshot,
toMatchInlineSnapshot,
toThrowErrorMatchingSnapshot,
toMatchSnapshot,
toThrowErrorMatchingInlineSnapshot,
toThrowErrorMatchingSnapshot,
} from 'jest-snapshot';

export default (config: {expand: boolean}) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-circus/src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import {Circus} from '@jest/types';
import {RETRY_TIMES} from './types';

import {getState, dispatch} from './state';
import {dispatch, getState} from './state';
import {
callAsyncCircusFn,
getAllHooksForDescribe,
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

// TODO: remove @jest/core exports for the next major
import {
getVersion,
runCLI,
SearchSource,
TestScheduler,
TestWatcher,
getVersion,
runCLI,
} from '@jest/core';
import {run} from './cli';

Expand Down
4 changes: 2 additions & 2 deletions packages/jest-cli/src/init/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import chalk from 'chalk';
import prompts from 'prompts';
import {sync as realpath} from 'realpath-native';
import defaultQuestions, {testScriptQuestion} from './questions';
import {NotFoundPackageJsonError, MalformedPackageJsonError} from './errors';
import {PACKAGE_JSON, JEST_CONFIG} from './constants';
import {MalformedPackageJsonError, NotFoundPackageJsonError} from './errors';
import {JEST_CONFIG, PACKAGE_JSON} from './constants';
import generateConfigFile from './generate_config_file';
import modifyPackageJson from './modify_package_json';
import {ProjectPackageJson} from './types';
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-config/src/ReporterValidationErrors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {Config} from '@jest/types';
import {ValidationError} from 'jest-validate';
import chalk from 'chalk';
import getType from 'jest-get-type';
import {DOCUMENTATION_NOTE, BULLET} from './utils';
import {BULLET, DOCUMENTATION_NOTE} from './utils';

const validReporterTypes = ['array', 'string'];
const ERROR = `${BULLET}Reporter Validation Error`;
Expand Down
6 changes: 3 additions & 3 deletions packages/jest-config/src/normalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ import getMaxWorkers from './getMaxWorkers';
import {
BULLET,
DOCUMENTATION_NOTE,
replaceRootDirInPath,
_replaceRootDirTags,
escapeGlobCharacters,
getTestEnvironment,
getRunner,
getSequencer,
getTestEnvironment,
getWatchPlugin,
replaceRootDirInPath,
resolve,
getSequencer,
} from './utils';
import {DEFAULT_JS_PATTERN, DEFAULT_REPORTER_LABEL} from './constants';
import {validateReporters} from './ReporterValidationErrors';
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-console/src/BufferedConsole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import assert from 'assert';
import {Console} from 'console';
import {format} from 'util';
import chalk from 'chalk';
import {getCallsite, SourceMapRegistry} from '@jest/source-map';
import {SourceMapRegistry, getCallsite} from '@jest/source-map';
import {
ConsoleBuffer,
LogCounters,
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-core/src/SearchSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {escapePathForRegex} from 'jest-regex-util';
import {replaceRootDirInPath} from 'jest-config';
import {buildSnapshotResolver} from 'jest-snapshot';
import {replacePathSepForGlob, testPathPatternToRegExp} from 'jest-util';
import {TestPathCases, Filter, Stats} from './types';
import {Filter, Stats, TestPathCases} from './types';

export type SearchResult = {
noSCM?: boolean;
Expand Down
8 changes: 4 additions & 4 deletions packages/jest-core/src/TestScheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ import {
CoverageReporter,
DefaultReporter,
NotifyReporter,
Reporter,
SummaryReporter,
VerboseReporter,
Reporter,
} from '@jest/reporters';
import exit from 'exit';
import {
addResult,
AggregatedResult,
buildFailureTestResult,
makeEmptyAggregatedTestResult,
SerializableError,
TestResult,
addResult,
buildFailureTestResult,
makeEmptyAggregatedTestResult,
} from '@jest/test-result';
import ReporterDispatcher from './ReporterDispatcher';
import TestWatcher from './TestWatcher';
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-core/src/getChangedFilesPromise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import {Config} from '@jest/types';
import {getChangedFilesForRoots, ChangedFilesPromise} from 'jest-changed-files';
import {ChangedFilesPromise, getChangedFilesForRoots} from 'jest-changed-files';
import {formatExecError} from 'jest-message-util';
import chalk from 'chalk';

Expand Down
2 changes: 1 addition & 1 deletion packages/jest-core/src/lib/watch_plugins_helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import {Config} from '@jest/types';
import {WatchPlugin, UsageData} from 'jest-watcher';
import {UsageData, WatchPlugin} from 'jest-watcher';

export const filterInteractivePlugins = (
watchPlugins: Array<WatchPlugin>,
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-core/src/runJest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import TestScheduler, {TestSchedulerContext} from './TestScheduler';
import FailedTestsCache from './FailedTestsCache';
import collectNodeHandles from './collectHandles';
import TestWatcher from './TestWatcher';
import {TestRunData, Filter} from './types';
import {Filter, TestRunData} from './types';

const getTestPaths = async (
globalConfig: Config.GlobalConfig,
Expand Down
Loading