Skip to content

Commit e043113

Browse files
anilreddykattaboujeepossum
authored andcommitted
Continuation to #3771 for snake case file naming (#3920)
* Resolved conflicts * Including eslint file for forcing file names * renaming files * renaming files
1 parent eb9be5a commit e043113

File tree

116 files changed

+248
-212
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+248
-212
lines changed

.eslintrc.js

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
module.exports = {
1010
extends: [
1111
'./packages/eslint-config-fb-strict/index.js',
12-
'plugin:import/errors',
12+
'plugin:import/errors'
1313
],
1414
parser: 'babel-eslint',
1515
rules: {
@@ -20,15 +20,16 @@ module.exports = {
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,
30+
'unicorn/filename-case': [2, {case: 'snakeCase'}]
3031
},
31-
plugins: ['markdown', 'import'],
32+
plugins: ['markdown', 'import', 'unicorn'],
3233
overrides: [
3334
// to make it more suitable for running on code examples in docs/ folder
3435
{
@@ -43,22 +44,31 @@ module.exports = {
4344
'no-unused-vars': 0,
4445
'consistent-return': 0,
4546
'import/no-unresolved': 0,
46-
'sort-keys': 0
47-
},
47+
'sort-keys': 0,
48+
'unicorn/filename-case': 0
49+
}
4850
},
4951
{
5052
files: ['examples/**/*'],
5153
rules: {
5254
'babel/func-params-comma-dangle': 0,
5355
'import/order': 0,
54-
'import/no-unresolved': [2, { 'ignore': ['^react-native$'] }]
55-
},
56+
'import/no-unresolved': [2, {ignore: ['^react-native$']}],
57+
'unicorn/filename-case': 0
58+
}
5659
},
5760
{
5861
files: ['scripts/**/*', 'integration_tests/**/*'],
5962
rules: {
6063
'babel/func-params-comma-dangle': 0,
61-
},
64+
'unicorn/filename-case': 0
65+
}
6266
},
63-
],
67+
{
68+
files: ['**/__mocks__/**/*', 'website/**/*', '**/jest-runtime/**/*', '**/src/Console*'],
69+
rules: {
70+
'unicorn/filename-case': 0
71+
}
72+
}
73+
]
6474
};

examples/react-native/.flowconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ experimental.strict_type_args=true
2626

2727
munge_underscores=true
2828

29-
module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
29+
module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'global_image_stub'
3030
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
3131

3232
suppress_type=$FlowIssue

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"eslint-plugin-import": "^2.6.0",
2929
"eslint-plugin-markdown": "^1.0.0-beta.6",
3030
"eslint-plugin-react": "^7.1.0",
31+
"eslint-plugin-unicorn": "^2.1.2",
3132
"flow-bin": "^0.48.0",
3233
"glob": "^7.1.1",
3334
"graceful-fs": "^4.1.11",
@@ -114,7 +115,7 @@
114115
"transform": {
115116
"^.+\\.js$": "<rootDir>/packages/babel-jest"
116117
},
117-
"setupTestFrameworkScriptFile": "<rootDir>/testSetupFile.js",
118+
"setupTestFrameworkScriptFile": "<rootDir>/test_setup_file.js",
118119
"snapshotSerializers": [
119120
"<rootDir>/packages/pretty-format/build/plugins/convert_ansi.js"
120121
],
@@ -130,5 +131,6 @@
130131
"testMatch": [
131132
"**/*.test.js"
132133
]
133-
}
134+
},
135+
"dependencies": {}
134136
}

packages/jest-cli/src/__tests__/generate_empty_coverage.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
const os = require('os');
1313

14-
const generateEmptyCoverage = require('../generateEmptyCoverage');
14+
const generateEmptyCoverage = require('../generate_empty_coverage');
1515

1616
jest.mock('jest-runtime', () => {
1717
const realRuntime = require.requireActual('jest-runtime');

packages/jest-cli/src/__tests__/search_source.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('SearchSource', () => {
3434

3535
beforeEach(() => {
3636
Runtime = require('jest-runtime');
37-
SearchSource = require('../SearchSource');
37+
SearchSource = require('../search_source');
3838
normalize = require('jest-config').normalize;
3939
});
4040

@@ -415,7 +415,7 @@ describe('SearchSource', () => {
415415
});
416416

417417
it('returns empty search result if no related tests were found', () => {
418-
const input = ['no tests.js'];
418+
const input = ['no_tests.js'];
419419
const data = searchSource.findRelatedTestsFromPattern(input);
420420
expect(data.tests).toEqual([]);
421421
});
File renamed without changes.

packages/jest-cli/src/__tests__/test_runner.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
'use strict';
1212

13-
const TestRunner = require('../TestRunner');
14-
const TestWatcher = require('../TestWatcher');
15-
const SummaryReporter = require('../reporters/SummaryReporter');
13+
const TestRunner = require('../test_runner');
14+
const TestWatcher = require('../test_watcher');
15+
const SummaryReporter = require('../reporters/summary_reporter');
1616

1717
let workerFarmMock;
1818

@@ -27,8 +27,8 @@ jest.mock('worker-farm', () => {
2727
return mock;
2828
});
2929

30-
jest.mock('../TestWorker', () => {});
31-
jest.mock('../reporters/DefaultReporter');
30+
jest.mock('../test_worker', () => {});
31+
jest.mock('../reporters/default_reporter');
3232

3333
test('.addReporter() .removeReporter()', () => {
3434
const runner = new TestRunner({}, {});

packages/jest-cli/src/__tests__/test_sequencer.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jest.mock('fs');
1212
const fs = require('fs');
1313
const path = require('path');
1414

15-
const TestSequencer = require('../TestSequencer');
15+
const TestSequencer = require('../test_sequencer');
1616

1717
const FAIL = 0;
1818
const SUCCESS = 1;

packages/jest-cli/src/__tests__/watch.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
'use strict';
1212

1313
const chalk = require('chalk');
14-
const TestWatcher = require('../TestWatcher');
14+
const TestWatcher = require('../test_watcher');
1515
const {KEYS} = require('../constants');
1616

1717
const runJestMock = jest.fn();
1818

1919
jest.doMock('chalk', () => new chalk.constructor({enabled: false}));
2020
jest.doMock(
21-
'../runJest',
21+
'../run_jest',
2222
() =>
2323
function() {
2424
const args = Array.from(arguments);

0 commit comments

Comments
 (0)