mirror of
https://github.com/status-im/metro.git
synced 2025-03-04 04:30:38 +00:00
Consolidate eslint config + fix some issues
Reviewed By: davidaurelio Differential Revision: D6519564 fbshipit-source-id: 0cd894e92dfde451f8ee69d6c7c3d4cbd73b83ea
This commit is contained in:
parent
f044f42030
commit
5e65dfcf81
18
.eslintrc
18
.eslintrc
@ -1,18 +0,0 @@
|
||||
{
|
||||
"extends": "eslint-config-fb-strict",
|
||||
"plugins": [
|
||||
"prettier"
|
||||
],
|
||||
"parser": "babel-eslint",
|
||||
"rules": {
|
||||
"prettier/prettier": [
|
||||
"error",
|
||||
"fb",
|
||||
"@format"
|
||||
],
|
||||
"max-len": 0,
|
||||
"no-var": 0,
|
||||
"prefer-arrow-callback": 0,
|
||||
"sort-keys": 0
|
||||
}
|
||||
}
|
26
.eslintrc.js
Normal file
26
.eslintrc.js
Normal file
@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
env: {
|
||||
node: true,
|
||||
},
|
||||
extends: 'eslint-config-fb-strict',
|
||||
plugins: ['babel', 'flowtype', 'prettier'],
|
||||
parser: 'babel-eslint',
|
||||
rules: {
|
||||
'extra-arrow-initializer': 'off',
|
||||
'max-len': 'off',
|
||||
'no-alert': 'off',
|
||||
'no-console-disallow': 'off',
|
||||
'no-var': 'off',
|
||||
'prefer-arrow-callback': 'off',
|
||||
'prefer-const': ['warn', {destructuring: 'all'}],
|
||||
'prettier/prettier': ['error', 'fb', '@format'],
|
||||
'sort-keys': 'off',
|
||||
},
|
||||
};
|
@ -17,7 +17,7 @@
|
||||
"babel-preset-fbjs": "^2.1.0",
|
||||
"chalk": "^1.1.3",
|
||||
"codecov": "^2.2.0",
|
||||
"eslint": "^3.11.1",
|
||||
"eslint": "^3.19.0",
|
||||
"eslint-config-fb-strict": "^20.0.3",
|
||||
"eslint-plugin-babel": "^4.0.0",
|
||||
"eslint-plugin-flowtype": "^2.28.2",
|
||||
|
@ -1,10 +0,0 @@
|
||||
{
|
||||
"rules": {
|
||||
"extra-arrow-initializer": 0,
|
||||
"no-alert": 0,
|
||||
"no-console-disallow": 0
|
||||
},
|
||||
"env": {
|
||||
"node": true
|
||||
}
|
||||
}
|
@ -76,7 +76,7 @@ function isRequireCall(callee) {
|
||||
}
|
||||
|
||||
function processImportCall(context, path, node, depMapIdent) {
|
||||
const [nameLiteral, name] = getModuleNameFromCallArgs(node);
|
||||
const [, name] = getModuleNameFromCallArgs(node);
|
||||
const index = assignDependencyIndex(context, name, 'import');
|
||||
const mapLookup = createDepMapLookup(depMapIdent, index);
|
||||
const newImport = makeAsyncRequire({
|
||||
|
@ -42,9 +42,9 @@ describe('getOrderedDependencyPaths', () => {
|
||||
),
|
||||
);
|
||||
|
||||
expect(
|
||||
await getOrderedDependencyPaths(deltaBundler, ['/tmp'], {}),
|
||||
).toEqual(['/tmp/1.js', '/tmp/2.js', '/tmp/3.js', '/tmp/4.js']);
|
||||
expect(await getOrderedDependencyPaths(deltaBundler, ['/tmp'], {})).toEqual(
|
||||
['/tmp/1.js', '/tmp/2.js', '/tmp/3.js', '/tmp/4.js'],
|
||||
);
|
||||
});
|
||||
|
||||
it('Should add assets data dependencies correctly', async () => {
|
||||
@ -62,17 +62,17 @@ describe('getOrderedDependencyPaths', () => {
|
||||
),
|
||||
);
|
||||
|
||||
expect(
|
||||
await getOrderedDependencyPaths(deltaBundler, ['/tmp'], {}),
|
||||
).toEqual([
|
||||
'/tmp/1.js',
|
||||
'/tmp/2.png@2x',
|
||||
'/tmp/2.png@3x',
|
||||
'/tmp/3.js',
|
||||
'/tmp/4.png@2x',
|
||||
'/tmp/4.png@3x',
|
||||
'/tmp/5.js',
|
||||
]);
|
||||
expect(await getOrderedDependencyPaths(deltaBundler, ['/tmp'], {})).toEqual(
|
||||
[
|
||||
'/tmp/1.js',
|
||||
'/tmp/2.png@2x',
|
||||
'/tmp/2.png@3x',
|
||||
'/tmp/3.js',
|
||||
'/tmp/4.png@2x',
|
||||
'/tmp/4.png@3x',
|
||||
'/tmp/5.js',
|
||||
],
|
||||
);
|
||||
|
||||
expect(getAssetFiles.mock.calls).toEqual([
|
||||
['/tmp/2.png', undefined],
|
||||
|
Loading…
x
Reference in New Issue
Block a user