mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-05 07:07:26 +08:00
packager: trying out @format
Summary: Internally when adding `format` we have a lint rule that automatically reformat using `prettier` and the project rule. I'm concerned how we can ensure this stays consistent when merging PRs though. It's not a big issue because the volume of PRs is low, but we'll have to figure it out later on. Reviewed By: davidaurelio Differential Revision: D5035830 fbshipit-source-id: 6f2bc9eb8212938ff785a34d2684efd1a9813e1a
This commit is contained in:
committed by
Facebook Github Bot
parent
48c27b9a6c
commit
8f6d040c23
@@ -7,6 +7,7 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
@@ -18,13 +19,15 @@ const getAssetDataFromName = require('./lib/getAssetDataFromName');
|
||||
import type {CachedReadResult, ConstructorArgs, ReadResult} from './Module';
|
||||
|
||||
class AssetModule extends Module {
|
||||
|
||||
resolution: mixed;
|
||||
_name: string;
|
||||
_type: string;
|
||||
_dependencies: Array<string>;
|
||||
|
||||
constructor(args: ConstructorArgs & {dependencies: Array<string>}, platforms: Set<string>) {
|
||||
constructor(
|
||||
args: ConstructorArgs & {dependencies: Array<string>},
|
||||
platforms: Set<string>,
|
||||
) {
|
||||
super(args);
|
||||
const {resolution, name, type} = getAssetDataFromName(this.path, platforms);
|
||||
this.resolution = resolution;
|
||||
@@ -38,9 +41,12 @@ class AssetModule extends Module {
|
||||
}
|
||||
|
||||
readCached(): CachedReadResult {
|
||||
/** $FlowFixMe: improper OOP design. AssetModule, being different from a
|
||||
* normal Module, shouldn't inherit it in the first place. */
|
||||
return {result: {dependencies: this._dependencies}, outdatedDependencies: []};
|
||||
return {
|
||||
/** $FlowFixMe: improper OOP design. AssetModule, being different from a
|
||||
* normal Module, shouldn't inherit it in the first place. */
|
||||
result: {dependencies: this._dependencies},
|
||||
outdatedDependencies: [],
|
||||
};
|
||||
}
|
||||
|
||||
/** $FlowFixMe: improper OOP design. */
|
||||
@@ -49,9 +55,9 @@ class AssetModule extends Module {
|
||||
}
|
||||
|
||||
getName() {
|
||||
return super.getName().then(
|
||||
id => id.replace(/\/[^\/]+$/, `/${this._name}.${this._type}`)
|
||||
);
|
||||
return super
|
||||
.getName()
|
||||
.then(id => id.replace(/\/[^\/]+$/, `/${this._name}.${this._type}`));
|
||||
}
|
||||
|
||||
hash() {
|
||||
|
||||
Reference in New Issue
Block a user